Update the TestCommandFactory to have the validators.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -9,6 +9,7 @@ import space.kklochko.simple_jbdd.tests.commands.AbstractTestCommand;
|
||||
import space.kklochko.simple_jbdd.tests.commands.SimpleTestCommand;
|
||||
import space.kklochko.simple_jbdd.tests.commands.decorators.BlockDecorator;
|
||||
import space.kklochko.simple_jbdd.tests.commands.decorators.ErrorDecorator;
|
||||
import space.kklochko.simple_jbdd.tests.factories.validators.*;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -21,8 +22,18 @@ public class TestCommandFactory {
|
||||
|
||||
AbstractTestCommand<Test> aTestCommand = createTest(aClass, input);
|
||||
|
||||
if(test_methods.size() == 0)
|
||||
return new ErrorDecorator("ERROR!!! No blocks!!!", aTestCommand, "Error");
|
||||
ArrayList<Validator> validators = new ArrayList<>();
|
||||
validators.add(new EmptyValidator());
|
||||
validators.add(new HasMethodsWithArgumentsValidator());
|
||||
validators.add(new HasNonVoidMethodsValidator());
|
||||
validators.add(new HasPrivateMethodsValidator());
|
||||
|
||||
for(var validator : validators) {
|
||||
if(validator.validate(test_methods)) {
|
||||
String name = validator.getMessage();
|
||||
return new ErrorDecorator(name, aTestCommand, validator.getErrorType());
|
||||
}
|
||||
}
|
||||
|
||||
if(test_methods.containsKey("Then")) {
|
||||
ArrayList<Method> thens = getMethodsInReverseOrder(test_methods, "Then");
|
||||
|
||||
Reference in New Issue
Block a user