diff --git a/src/main/java/space/kklochko/simple_jbdd/tests/commands/decorators/ErrorDecorator.java b/src/main/java/space/kklochko/simple_jbdd/tests/commands/decorators/ErrorDecorator.java new file mode 100644 index 0000000..99c9009 --- /dev/null +++ b/src/main/java/space/kklochko/simple_jbdd/tests/commands/decorators/ErrorDecorator.java @@ -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 extends AbstractDecorator { + public ErrorDecorator(String error_label, AbstractTestCommand command, String type) { + super(error_label, command); + setType(type); + } + + public boolean test() { + return false; + } + + public boolean runMethod() { + return false; + }; +} + diff --git a/src/main/java/space/kklochko/simple_jbdd/tests/factories/TestCommandFactory.java b/src/main/java/space/kklochko/simple_jbdd/tests/factories/TestCommandFactory.java index 6af4934..0fef440 100644 --- a/src/main/java/space/kklochko/simple_jbdd/tests/factories/TestCommandFactory.java +++ b/src/main/java/space/kklochko/simple_jbdd/tests/factories/TestCommandFactory.java @@ -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.SimpleTestCommand; 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.reflect.Method; @@ -20,6 +21,9 @@ public class TestCommandFactory { AbstractTestCommand aTestCommand = createTest(aClass, input); + if(test_methods.size() == 0) + return new ErrorDecorator("ERROR!!! No blocks!!!", aTestCommand, "Error"); + if(test_methods.containsKey("Then")) { ArrayList thens = getMethodsInReverseOrder(test_methods, "Then"); for(Method then : thens) {