"Fossies" - the Fresh Open Source Software Archive 
Member "gradle-8.1.1/subprojects/dependency-management/src/test/groovy/org/gradle/api/internal/artifacts/repositories/AbstractArtifactRepositoryChangingNameAfterContainerInclusion.groovy" (20 Apr 2023, 1554 Bytes) of package /linux/misc/gradle-8.1.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Java source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /*
2 * Copyright 2012 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.gradle.api.internal.artifacts.repositories
18
19 import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.VersionParser
20 import org.gradle.test.fixtures.AbstractProjectBuilderSpec
21
22 class AbstractArtifactRepositoryChangingNameAfterContainerInclusion extends AbstractProjectBuilderSpec {
23
24 def "cannot change the name of the repository after it has been added to a container"() {
25 def repo = new TestRepo(name: "name")
26
27 given:
28 project.repositories.add(repo)
29
30 when:
31 repo.name = "changed"
32
33 then:
34 IllegalStateException e = thrown()
35 e.message == 'The name of an ArtifactRepository cannot be changed after it has been added to a repository container. You should set the name when creating the repository.'
36 }
37
38 class TestRepo extends AbstractArtifactRepository {
39 def TestRepo() {
40 super(null, new VersionParser())
41 }
42 }
43 }