I write a custom Gradle plugin. Started working on integration testing and faced the following question:
My plugin applies the following logic, among other things:
repositories.maven(repository -> {
repository.setName(NAME);
repository.setUrl(URL);
repository.mavenContent(MavenRepositoryContentDescriptor::releasesOnly);
});
Then, while testing with Spock:
def "repositories are set up correctly"() {
given:
def repositories = project.repositories
expect:
repositories.size() == 1
repositories[0] instanceof MavenArtifactRepository
def repoReleases = repositories[0] as MavenArtifactRepository
repoReleases.name == NAME
repoReleases.url.toString() == URL
// how to check that this repository is for releases only?
}
How do I prompt the project to show me whether it will use this repository for snapshots or not?
Or is this kind of deep testing not worth the effort?