As a user I would like to map a Gradle ConfigurationContainer to a set of model using a custom mapper.
Total Runs | Success Rate | Failures | Errors | Skipped | Total time (ms) |
---|---|---|---|---|---|
1 | 100.0% | 0 | 0 | 0 | 0.036 seconds |
TestSubject:
- io.github.gregoranders.gradle.dependencies.tooling.model.mapper.ConfigurationContainerMapper
- io.github.gregoranders.gradle.dependencies.tooling.model.api.Configuration
Issues:
See:
- https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Configuration.html
- https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/ConfigurationContainer.html
- io.github.gregoranders.gradle.dependencies.tooling.model.api.Configuration
- io.github.gregoranders.gradle.dependencies.tooling.model.mapper.ConfigurationContainerMapper
Features
should map a gradle configuration container preserving the order
Result: PASS Time: 0.033 seconds
- Given a gradle configuration A
def configurationA = Mock(Configuration)
- And a gradle dependency B
def configurationB = Mock(Configuration)
- And a gradle configuration container containing A and B
def configurationContainer = Mock(ConfigurationContainer)
- When the unit under test maps this container
def set = testSubject.map(configurationContainer)
- Then following interactions should be executed
interaction {
1 * configurationContainer.stream() >> Stream.of(configurationA, configurationB)
1 * configurationA.getName() >> 'configurationAName'
1 * configurationA.getDependencies() >> {
def dependencySet = Mock(DependencySet)
1 * dependencySet.stream() >> Stream.empty()
dependencySet
}
1 * configurationB.getName() >> 'configurationBName'
1 * configurationB.getDependencies() >> {
def dependencySet = Mock(DependencySet)
1 * dependencySet.stream() >> Stream.empty()
dependencySet
}
}
- And the returned set should contain two mapped configurations
set.size() == 2
- And the first configuration should be of the expected type
set[0] instanceof io.github.gregoranders.gradle.dependencies.tooling.model.api.Configuration
- And have the expected values
set[0].name() == 'configurationAName'
set[0].dependencies().size() == 0
- And the second configuration should be of the expected type
set[1] instanceof io.github.gregoranders.gradle.dependencies.tooling.model.api.Configuration
- And have the expected values
set[1].name() == 'configurationBName'
set[1].dependencies().size() == 0
- And no exceptions should be thrown
noExceptionThrown()