JetBrains IntelliJ Gradle Dependencies Plugin

Specification run results

View on GitHub

Gradle utilities

As a user I would like to be able to collect dependencies of a Gradle JVM project.

Total Runs Success Rate Failures Errors Skipped Total time (ms)
5 100.0% 0 0 0 3.066 seconds

TestSubject:

Issues:

See:

Features


should return an empty set of dependencies of a simple project with no dependencies

Result: PASS Time: 2.020 seconds

def path = getProjectPath('simple-no-dependencies')
def project = testSubject.getDependencies(path)
project.group() == 'io.github.gregoranders'
project.name() == 'simple-no-dependencies'
project.version() == '0.0.1'
project.description() == 'Simple project no dependencies'
project.configurations().forEach(configuration -> {
    assert configuration.dependencies().size() == 0
})
noExceptionThrown()

should return a set of dependencies of a simple project with dependencies

Result: PASS Time: 0.321 seconds

def path = getProjectPath('simple-with-dependencies')
def project = testSubject.getDependencies(path)
project.group() == 'io.github.gregoranders'
project.name() == 'simple-with-dependencies'
project.version() == '0.0.2'
project.description() == 'Simple project with dependencies'
project.configurations().forEach(configuration -> {
    if (configuration.name() == 'implementation') {
        assert configuration.dependencies().size() == 1
        assertDependency(configuration.dependencies()[0], 'org.slf4j', 'slf4j-api', '1.7.32')
    }
})
project.configurations().forEach(configuration -> {
    if (configuration.name() == 'runtimeOnly') {
        assert configuration.dependencies().size() == 2
        assertDependency(configuration.dependencies()[0], 'ch.qos.logback', 'logback-core', '1.2.9')
        assertDependency(configuration.dependencies()[1], 'ch.qos.logback', 'logback-classic', '1.2.9')
    }
})
noExceptionThrown()

should return a multi project with no dependencies

Result: PASS Time: 0.302 seconds

def path = getProjectPath('multi-no-dependencies')
def project = testSubject.getDependencies(path)
project.group() == 'io.github.gregoranders'
project.name() == 'multi-no-dependencies'
project.version() == '0.0.1'
project.description() == 'Multi project no dependencies'
project.configurations().forEach(configuration -> {
    assert configuration.dependencies().size() == 0
})
project.subProjects().size() == 3
project.subProjects()[0].name() == 'api'
project.subProjects()[0].group() == 'io.github.gregoranders'
project.subProjects()[1].name() == 'impl'
project.subProjects()[1].group() == 'io.github.gregoranders'
project.subProjects()[2].name() == 'test'
project.subProjects()[2].group() == 'io.github.gregoranders'
noExceptionThrown()

should return a multi project with dependencies

Result: PASS Time: 0.254 seconds

def path = getProjectPath('multi-with-dependencies')
def project = testSubject.getDependencies(path)
project.name() == 'multi-with-dependencies'
project.version() == '0.0.1'
project.description() == 'Multi project with dependencies'
project.configurations().forEach(configuration -> {
    assert configuration.dependencies().size() == 0
})
project.subProjects().size() == 3
project.subProjects()[0].name() == 'api'
project.subProjects()[0].version() == '0.0.2'
project.subProjects()[0].configurations().forEach(configuration -> {
    assert configuration.dependencies().size() == 0
})
project.subProjects()[1].name() == 'impl'
project.subProjects()[1].version() == '0.0.3'
project.subProjects()[1].configurations().forEach(configuration -> {
                if (configuration.name() == 'implementation') {
                    assert configuration.dependencies().size() == 2

                    assertDependency(configuration.dependencies()[0], 'io.github.gregoranders', 'api', '0.0.2')
                    assertDependency(configuration.dependencies()[1], 'org.slf4j', 'slf4j-api', '1.7.32')
                }
            })
project.subProjects()[2].name() == 'test'
project.subProjects()[2].version() == '0.0.4'
project.subProjects()[2].configurations().forEach(configuration -> {
                if (configuration.name() == 'implementation') {
                    assert configuration.dependencies().size() == 2

                    assertDependency(configuration.dependencies()[0], 'io.github.gregoranders', 'impl', '0.0.3')
                    assertDependency(configuration.dependencies()[1], 'org.slf4j', 'slf4j-api', '1.7.32')
                }
            })
project.subProjects()[2].configurations().forEach(configuration -> {
                if (configuration.name() == 'testImplementation') {
                    assert configuration.dependencies().size() == 1

                    assertDependency(configuration.dependencies()[0], 'org.junit.jupiter', 'junit-jupiter-engine', '5.8.2')
                }
            })
noExceptionThrown()

should throw an exception

Result: PASS Time: 0.077 seconds

def path = Path.of('foo')
testSubject.getDependencies(path)
GradleUtilitiesException exception = thrown()
exception.getMessage().contains("Could not fetch model of type 'Project' using connection to Gradle distribution")
exception.getCause() instanceof BuildException