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.011 seconds |
TestSubject:
- io.github.gregoranders.idea.gradle.dependencies.gradle.tooling.model.mapper.ConfigurationContainerMapper
- io.github.gregoranders.idea.gradle.dependencies.gradle.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.idea.gradle.dependencies.gradle.tooling.model.api.Configuration
- io.github.gregoranders.idea.gradle.dependencies.gradle.tooling.model.mapper.ConfigurationContainerMapper
Features
should map a gradle configuration container preserving the order
Result: PASS Time: 0.008 seconds
- Given a gradle configuration A
def configurationA = Mock(org.gradle.api.artifacts.Configuration)
- And a gradle dependency B
def configurationB = Mock(org.gradle.api.artifacts.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 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 Configuration
- And have the expected values
set[1].name() == 'configurationBName'
set[1].dependencies().size() == 0
- And no exceptions should be thrown
noExceptionThrown()