Polish CLI tester code
Reduce duplication by extracting FileOptions class to be shared by both the RunCommand and the TestCommand. Also applied minor code convention tweaks.
This commit is contained in:
@@ -22,6 +22,7 @@ import org.springframework.boot.cli.command.tester.TestResults
|
||||
import java.lang.annotation.Annotation
|
||||
import java.lang.reflect.Method
|
||||
|
||||
|
||||
/**
|
||||
* Groovy script to run JUnit tests inside the {@link TestCommand}.
|
||||
* Needs to be compiled along with the actual code to work properly.
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
import org.springframework.boot.cli.command.tester.TestResults
|
||||
|
||||
|
||||
/**
|
||||
* Groovy script define abstract basis for automated testers for {@link TestCommand}.
|
||||
* Needs to be compiled along with the actual code to work properly.
|
||||
@@ -28,14 +29,14 @@ public abstract class AbstractTester {
|
||||
Set<Class<?>> testable = findTestableClasses(compiled)
|
||||
|
||||
if (testable.size() == 0) {
|
||||
return TestResults.none
|
||||
return TestResults.NONE
|
||||
}
|
||||
|
||||
return test(testable.toArray(new Class<?>[0]))
|
||||
}
|
||||
|
||||
abstract protected Set<Class<?>> findTestableClasses(List<Class<?>> compiled)
|
||||
protected abstract Set<Class<?>> findTestableClasses(List<Class<?>> compiled)
|
||||
|
||||
abstract protected TestResults test(Class<?>[] testable)
|
||||
protected abstract TestResults test(Class<?>[] testable)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user