|
|
@ -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.SimpleTestCommand;
|
|
|
|
import space.kklochko.simple_jbdd.tests.commands.decorators.BlockDecorator;
|
|
|
|
import space.kklochko.simple_jbdd.tests.commands.decorators.BlockDecorator;
|
|
|
|
import space.kklochko.simple_jbdd.tests.commands.decorators.ErrorDecorator;
|
|
|
|
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.annotation.Annotation;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
@ -21,8 +22,18 @@ public class TestCommandFactory {
|
|
|
|
|
|
|
|
|
|
|
|
AbstractTestCommand<Test> aTestCommand = createTest(aClass, input);
|
|
|
|
AbstractTestCommand<Test> aTestCommand = createTest(aClass, input);
|
|
|
|
|
|
|
|
|
|
|
|
if(test_methods.size() == 0)
|
|
|
|
ArrayList<Validator> validators = new ArrayList<>();
|
|
|
|
return new ErrorDecorator("ERROR!!! No blocks!!!", aTestCommand, "Error");
|
|
|
|
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")) {
|
|
|
|
if(test_methods.containsKey("Then")) {
|
|
|
|
ArrayList<Method> thens = getMethodsInReverseOrder(test_methods, "Then");
|
|
|
|
ArrayList<Method> thens = getMethodsInReverseOrder(test_methods, "Then");
|
|
|
|