Update the TestCommandFactory to have the validators.
continuous-integration/drone/push Build is passing Details

main
KKlochko 2 years ago
parent 238957419e
commit 11b1377a37

@ -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");

Loading…
Cancel
Save