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