feature/use-case-acceptance-tests #116
@ -8,6 +8,7 @@ import org.apache.commons.collections4.map.LinkedMap;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
@ -21,6 +22,7 @@ public abstract class UseCase<T extends UseCase<?>> {
|
||||
private final UseCaseTest testSuite;
|
||||
private final Map<String, Function<String, UseCase<?>>> requirements = new LinkedMap<>();
|
||||
private final String resultAlias;
|
||||
private final Map<String, Object> givenProperties = new LinkedHashMap<>();
|
||||
private String nextTitle; // FIXME: ugly
|
||||
|
||||
public UseCase(final UseCaseTest testSuite) {
|
||||
@ -55,7 +57,7 @@ public abstract class UseCase<T extends UseCase<?>> {
|
||||
| name | value |
|
||||
|------|-------|
|
||||
""".trim());
|
||||
UseCaseTest.properties().forEach((key, value) -> log("| " + key + " | " + value + " |"));
|
||||
givenProperties.forEach((key, value) -> log("| " + key + " | " + value + " |"));
|
||||
log("");
|
||||
requirements.forEach((alias, factory) -> factory.apply(alias).run().keep());
|
||||
return run();
|
||||
@ -64,6 +66,7 @@ public abstract class UseCase<T extends UseCase<?>> {
|
||||
protected abstract HttpResponse run();
|
||||
|
||||
public final UseCase<T> given(final String propName, final Object propValue) {
|
||||
givenProperties.put(propName, propValue);
|
||||
UseCaseTest.putProperty(propName, propValue);
|
||||
return this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user