As a user I would like to map a Gradle DependencySet 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.005 seconds |
TestSubject:
- io.github.gregoranders.idea.gradle.dependencies.gradle.tooling.model.mapper.DependencySetMapper
- io.github.gregoranders.idea.gradle.dependencies.gradle.tooling.model.api.Dependency
Issues:
See:
- https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/Dependency.html
- https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/DependencySet.html
- io.github.gregoranders.idea.gradle.dependencies.gradle.tooling.model.api.Dependency
- io.github.gregoranders.idea.gradle.dependencies.gradle.tooling.model.mapper.DependencySetMapper
Features
should map a gradle dependency set preserving the order
Result: PASS Time: 0.002 seconds
- Given a gradle dependency A
def dependencyA = Mock(org.gradle.api.artifacts.Dependency)
- And a gradle dependency B
def dependencyB = Mock(org.gradle.api.artifacts.Dependency)
- And a gradle dependency set containing A and B
def dependencySet = Mock(DependencySet)
- When the unit under test maps this set
def set = testSubject.map(dependencySet)
- Then following interactions should be executed
interaction {
1 * dependencySet.stream() >> Stream.of(dependencyA, dependencyB)
1 * dependencyA.getGroup() >> 'dependencyAGroup'
1 * dependencyA.getName() >> 'dependencyAName'
1 * dependencyA.getVersion() >> 'dependencyAVersion'
1 * dependencyB.getGroup() >> 'dependencyBGroup'
1 * dependencyB.getName() >> 'dependencyBName'
1 * dependencyB.getVersion() >> 'dependencyBVersion'
}
- And the returned set should contain two mapped dependencies
set.size() == 2
- And the first dependency should be of the expected type
set[0] instanceof Dependency
- And have the expected values
verifyDependency(set[0], 'dependencyAGroup', 'dependencyAName', 'dependencyAVersion')
- And the second dependency should be of the expected type
set[1] instanceof Dependency
- And have the expected values
verifyDependency(set[1], 'dependencyBGroup', 'dependencyBName', 'dependencyBVersion')
- And no exceptions should be thrown
noExceptionThrown()