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:
Phillip Webb
2013-10-08 20:22:59 -07:00
parent 910202b0f6
commit efe102bd51
8 changed files with 259 additions and 216 deletions

View File

@@ -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.

View File

@@ -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)
}