Add the error for an empty test.
continuous-integration/drone/tag Build is passing Details

main 0.12.3
KKlochko 2 years ago
parent 2e12fdbd34
commit 5c1e69ed32

@ -0,0 +1,20 @@
package space.kklochko.simple_jbdd.tests.commands.decorators;
import space.kklochko.simple_jbdd.tests.Test;
import space.kklochko.simple_jbdd.tests.commands.AbstractTestCommand;
public class ErrorDecorator<T extends Test> extends AbstractDecorator<T> {
public ErrorDecorator(String error_label, AbstractTestCommand<T> command, String type) {
super(error_label, command);
setType(type);
}
public boolean test() {
return false;
}
public boolean runMethod() {
return false;
};
}

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

Loading…
Cancel
Save