print only initially given properties

This commit is contained in:
Michael Hoennig 2024-10-21 16:09:02 +02:00
parent 4babea24a1
commit a643b86295

View File

@ -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;
}