Skip to content

Commit

Permalink
Test: UndeclaredDependencyRuleSpec adds a test to ensure there are no…
Browse files Browse the repository at this point in the history
… errors when all dependencies are declared
  • Loading branch information
OdysseusLives committed Feb 18, 2020
1 parent 152e94b commit 9e6ca72
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,48 @@ class UndeclaredDependencyRuleSpec extends TestKitSpecification {
[sample] | [sample, commonsLogging] | 'api'
}

@Unroll
def 'simple - no errors when all dependencies are declared for #configuration configuration'() {
given:
def repo = new File(projectDir, 'repo')
repo.mkdirs()

def samplePom = new Pom(sample.getGroup(), sample.getArtifact(), sample.getVersion())
samplePom.addDependency(commonsLogging.getGroup(), commonsLogging.getArtifact(), commonsLogging.getVersion())
ArtifactHelpers.setupSamplePomWith(repo, sample, samplePom.generate())
ArtifactHelpers.setupSampleJar(repo, sample)

setupBuildGradleSimpleSetup(repo, configuration == 'api')
buildFile << """\
configurations {
myConfiguration
compileClasspath.extendsFrom myConfiguration
}
dependencies {
${deps.collect { " $configuration '$it'" }.join('\n')}
testImplementation 'junit:junit:4.+'
}
""".stripIndent()

when:

createJavaSourceFile(main)
createJavaTestFile(projectDir)

then:
def result = runTasksSuccessfully('build', 'fixGradleLint')

result.output.contains('Corrected 0 lint problems')
result.output.contains('Passed lint check with 0 violations')

where:
deps | configuration
[sample, commonsLogging] | 'implementation'
[sample, commonsLogging] | 'compile'
[sample, commonsLogging] | 'api'
[sample, commonsLogging] | 'myConfiguration'
}

@Unroll
def 'adds dependencies alphabetically for #configuration configuration'() {
given:
Expand Down

0 comments on commit 9e6ca72

Please sign in to comment.