com.github.fridujo.junit.extension.classpath.ClasspathContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of classpath-junit-extension Show documentation
Show all versions of classpath-junit-extension Show documentation
JUnit5 extension to run tests with classpath customizations
The newest version!
package com.github.fridujo.junit.extension.classpath;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import com.github.fridujo.junit.extension.classpath.maven.Maven;
class ClasspathContext {
private Maven maven;
Optional getMaven(PathElement path) {
if (maven == null) {
maven = Maven.from(path).orElse(null);
}
return Optional.ofNullable(maven);
}
Set listDependencies(PathElement path) {
return getMaven(path).map(m -> m.listDependencies(path)).orElse(Collections.emptySet());
}
}