Compare commits

..

No commits in common. "07b5e4686bc954e1d4cb9050f6ac93c939475add" and "c3f3efaf18fd82d21a6d450e8b565eb63d09c485" have entirely different histories.

12 changed files with 49 additions and 88 deletions

View File

@ -95,6 +95,3 @@ if [ ! -f .environment ]; then
cp .tc-environment .environment cp .tc-environment .environment
fi fi
source .environment source .environment
alias scenario-reports-upload='./gradlew convertMarkdownToHtml && ssh hsh03-hsngdev@h50.hostsharing.net "rm doms/hsngdev.hs-example.de/htdocs-ssl/scenarios/office/*.html" && scp doc/scenarios/*.html hsh03-hsngdev@h50.hostsharing.net:doms/hsngdev.hs-example.de/htdocs-ssl/scenarios/office'
alias scenario-reports-online='open https://hsngdev.hs-example.de/scenarios/office'

View File

@ -410,7 +410,7 @@ tasks.register('convertMarkdownToHtml') {
group = 'Conversion' group = 'Conversion'
// Define the template file and input directory // Define the template file and input directory
def templateFile = file('doc/scenarios/.template.html') def templateFile = file('doc/scenarios/template.html')
// Task configuration and execution // Task configuration and execution
doFirst { doFirst {
@ -425,7 +425,7 @@ tasks.register('convertMarkdownToHtml') {
// Check if the template file exists // Check if the template file exists
if (!templateFile.exists()) { if (!templateFile.exists()) {
throw new GradleException("Template file 'doc/scenarios/.template.html' not found.") throw new GradleException("Template file 'doc/scenarios/template.html' not found.")
} }
} }

View File

@ -14,7 +14,6 @@ public class SystemProcess {
@Getter @Getter
private String stdOut; private String stdOut;
@Getter @Getter
private String stdErr; private String stdErr;
@ -22,6 +21,7 @@ public class SystemProcess {
this.processBuilder = new ProcessBuilder(command); this.processBuilder = new ProcessBuilder(command);
} }
public String getCommand() { public String getCommand() {
return processBuilder.command().toString(); return processBuilder.command().toString();
} }

View File

@ -343,7 +343,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
} }
@Test @Test
@Order(4202) @Order(4201)
@Requires("Membership: M-3101000 - Test AG") @Requires("Membership: M-3101000 - Test AG")
void shouldRevertCoopSharesSubscription() { void shouldRevertCoopSharesSubscription() {
new CreateCoopSharesRevertTransaction(this) new CreateCoopSharesRevertTransaction(this)

View File

@ -4,7 +4,6 @@ import net.hostsharing.hsadminng.hs.office.scenarios.UseCase.HttpResponse;
import java.util.function.Consumer; import java.util.function.Consumer;
import static net.hostsharing.hsadminng.hs.office.scenarios.TemplateResolver.Resolver.DROP_COMMENTS;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
public class PathAssertion { public class PathAssertion {
@ -19,7 +18,7 @@ public class PathAssertion {
public Consumer<UseCase.HttpResponse> contains(final String resolvableValue) { public Consumer<UseCase.HttpResponse> contains(final String resolvableValue) {
return response -> { return response -> {
try { try {
response.path(path).map(Object::toString).contains(ScenarioTest.resolve(resolvableValue, DROP_COMMENTS)); response.path(path).map(Object::toString).contains(ScenarioTest.resolve(resolvableValue));
} catch (final AssertionError e) { } catch (final AssertionError e) {
// without this, the error message is often lacking important context // without this, the error message is often lacking important context
fail(e.getMessage() + " in `path(\"" + path + "\").contains(\"" + resolvableValue + "\")`" ); fail(e.getMessage() + " in `path(\"" + path + "\").contains(\"" + resolvableValue + "\")`" );

View File

@ -3,7 +3,6 @@ package net.hostsharing.hsadminng.hs.office.scenarios;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonEntity;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository; import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRepository;
import net.hostsharing.hsadminng.hs.office.scenarios.TemplateResolver.Resolver;
import net.hostsharing.hsadminng.lambda.Reducer; import net.hostsharing.hsadminng.lambda.Reducer;
import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; import net.hostsharing.hsadminng.rbac.context.ContextBasedTest;
import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
@ -27,8 +26,6 @@ import java.util.stream.Collectors;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static java.util.Optional.ofNullable; import static java.util.Optional.ofNullable;
import static net.hostsharing.hsadminng.hs.office.scenarios.TemplateResolver.Resolver.DROP_COMMENTS;
import static net.hostsharing.hsadminng.hs.office.scenarios.TemplateResolver.Resolver.DROP_COMMENTS;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
public abstract class ScenarioTest extends ContextBasedTest { public abstract class ScenarioTest extends ContextBasedTest {
@ -41,11 +38,11 @@ public abstract class ScenarioTest extends ContextBasedTest {
public String toString() { public String toString() {
return ObjectUtils.toString(uuid); return ObjectUtils.toString(uuid);
} }
} }
private final static Map<String, Alias<?>> aliases = new HashMap<>();
private final static Map<String, Alias<?>> aliases = new HashMap<>();
private final static Map<String, Object> properties = new HashMap<>(); private final static Map<String, Object> properties = new HashMap<>();
public final TestReport testReport = new TestReport(aliases); public final TestReport testReport = new TestReport(aliases);
@LocalServerPort @LocalServerPort
@ -142,9 +139,9 @@ public abstract class ScenarioTest extends ContextBasedTest {
} }
static UUID uuid(final String nameWithPlaceholders) { static UUID uuid(final String nameWithPlaceholders) {
final var resolvedName = resolve(nameWithPlaceholders, DROP_COMMENTS); final var resoledName = resolve(nameWithPlaceholders);
final UUID alias = ofNullable(knowVariables().get(resolvedName)).filter(v -> v instanceof UUID).map(UUID.class::cast).orElse(null); final UUID alias = ofNullable(knowVariables().get(resoledName)).filter(v -> v instanceof UUID).map(UUID.class::cast).orElse(null);
assertThat(alias).as("alias '" + resolvedName + "' not found in aliases nor in properties [" + assertThat(alias).as("alias '" + resoledName + "' not found in aliases nor in properties [" +
knowVariables().keySet().stream().map(v -> "'" + v + "'").collect(Collectors.joining(", ")) + "]" knowVariables().keySet().stream().map(v -> "'" + v + "'").collect(Collectors.joining(", ")) + "]"
).isNotNull(); ).isNotNull();
return alias; return alias;
@ -165,13 +162,13 @@ public abstract class ScenarioTest extends ContextBasedTest {
return map; return map;
} }
public static String resolve(final String text, final Resolver resolver) { public static String resolve(final String text) {
final var resolved = new TemplateResolver(text, ScenarioTest.knowVariables()).resolve(resolver); final var resolved = new TemplateResolver(text, ScenarioTest.knowVariables()).resolve();
return resolved; return resolved;
} }
public static Object resolveTyped(final String text) { public static Object resolveTyped(final String text) {
final var resolved = resolve(text, DROP_COMMENTS); final var resolved = resolve(text);
try { try {
return UUID.fromString(resolved); return UUID.fromString(resolved);
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {

View File

@ -10,39 +10,29 @@ import java.util.Objects;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static net.hostsharing.hsadminng.hs.office.scenarios.TemplateResolver.Resolver.DROP_COMMENTS;
public class TemplateResolver { public class TemplateResolver {
public enum Resolver { private final static Pattern pattern = Pattern.compile(",(\\s*})", Pattern.MULTILINE);
DROP_COMMENTS, // deletes comments ('#{whatever}' -> '') private static final String IF_NOT_FOUND_SYMBOL = "???";
KEEP_COMMENTS // deletes comments ('#{whatever}' -> '')
}
enum PlaceholderPrefix { enum PlaceholderPrefix {
RAW('%') { RAW('%') {
@Override @Override
String convert(final Object value, final Resolver resolver) { String convert(final Object value) {
return value != null ? value.toString() : ""; return value != null ? value.toString() : "";
} }
}, },
JSON_QUOTED('$'){ JSON_QUOTED('$'){
@Override @Override
String convert(final Object value, final Resolver resolver) { String convert(final Object value) {
return jsonQuoted(value); return jsonQuoted(value);
} }
}, },
URI_ENCODED('&'){ URI_ENCODED('&'){
@Override @Override
String convert(final Object value, final Resolver resolver) { String convert(final Object value) {
return value != null ? URLEncoder.encode(value.toString(), StandardCharsets.UTF_8) : ""; return value != null ? URLEncoder.encode(value.toString(), StandardCharsets.UTF_8) : "";
} }
},
COMMENT('#'){
@Override
String convert(final Object value, final Resolver resolver) {
return resolver == DROP_COMMENTS ? "" : value.toString();
}
}; };
private final char prefixChar; private final char prefixChar;
@ -59,17 +49,12 @@ public class TemplateResolver {
return Arrays.stream(values()).filter(p -> p.prefixChar == givenChar).findFirst().orElseThrow(); return Arrays.stream(values()).filter(p -> p.prefixChar == givenChar).findFirst().orElseThrow();
} }
abstract String convert(final Object value, final Resolver resolver); // FIXME: why Object and not String? abstract String convert(final Object value);
} }
private final static Pattern pattern = Pattern.compile(",(\\s*})", Pattern.MULTILINE);
private static final String IF_NOT_FOUND_SYMBOL = "???";
private final String template; private final String template;
private final Map<String, Object> properties; private final Map<String, Object> properties;
private final StringBuilder resolved = new StringBuilder(); private final StringBuilder resolved = new StringBuilder();
private Resolver resolver;
private int position = 0; private int position = 0;
public TemplateResolver(final String template, final Map<String, Object> properties) { public TemplateResolver(final String template, final Map<String, Object> properties) {
@ -77,8 +62,7 @@ public class TemplateResolver {
this.properties = properties; this.properties = properties;
} }
String resolve(final Resolver resolver) { String resolve() {
this.resolver = resolver;
final var resolved = copy(); final var resolved = copy();
final var withoutDroppedLines = dropLinesWithNullProperties(resolved); final var withoutDroppedLines = dropLinesWithNullProperties(resolved);
final var result = removeDanglingCommas(withoutDroppedLines); final var result = removeDanglingCommas(withoutDroppedLines);
@ -135,10 +119,10 @@ public class TemplateResolver {
placeholder.append(fetchChar()); placeholder.append(fetchChar());
} }
} }
final var content = new TemplateResolver(placeholder.toString(), properties).resolve(resolver); final var name = new TemplateResolver(placeholder.toString(), properties).resolve();
final var value = intro != '#' ? propVal(content) : content; final var value = propVal(name);
resolved.append( resolved.append(
PlaceholderPrefix.ofPrefixChar(intro).convert(value, resolver) PlaceholderPrefix.ofPrefixChar(intro).convert(value)
); );
skipChar('}'); skipChar('}');
} }

View File

@ -4,7 +4,6 @@ import org.junit.jupiter.api.Test;
import java.util.Map; import java.util.Map;
import static net.hostsharing.hsadminng.hs.office.scenarios.TemplateResolver.Resolver.DROP_COMMENTS;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
class TemplateResolverUnitTest { class TemplateResolverUnitTest {
@ -43,7 +42,7 @@ class TemplateResolverUnitTest {
Map.entry("simple placeholder", "einfach"), Map.entry("simple placeholder", "einfach"),
Map.entry("nested placeholder", "verschachtelt"), Map.entry("nested placeholder", "verschachtelt"),
Map.entry("with-special-chars", "3&3 AG") Map.entry("with-special-chars", "3&3 AG")
)).resolve(DROP_COMMENTS); )).resolve();
assertThat(resolved).isEqualTo(""" assertThat(resolved).isEqualTo("""
with optional JSON quotes: with optional JSON quotes:

View File

@ -1,7 +1,6 @@
package net.hostsharing.hsadminng.hs.office.scenarios; package net.hostsharing.hsadminng.hs.office.scenarios;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import net.hostsharing.hsadminng.system.SystemProcess;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.TestInfo;
@ -11,16 +10,13 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map; import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
public class TestReport { public class TestReport {
private final static File markdownLogFile = new File("doc/scenarios/.last-debug-log.md"); private final static File markdownLogFile = new File("doc/scenarios/last-debug-log.md");
public static final SimpleDateFormat MM_DD_YYYY_HH_MM_SS = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
private final Map<String, ?> aliases; private final Map<String, ?> aliases;
private final PrintWriter markdownLog; // records everything for debugging purposes private final PrintWriter markdownLog; // records everything for debugging purposes
@ -65,16 +61,8 @@ public class TestReport {
printLine("\n" +output + "\n"); printLine("\n" +output + "\n");
} }
void silent(final Runnable code) {
silent++;
code.run();
silent--;
}
public void close() { public void close() {
if (markdownReport != null) { if (markdownReport != null) {
printPara("---");
printPara("generated on " + MM_DD_YYYY_HH_MM_SS.format(new Date()) + " for branch " + currentGitBranch());
markdownReport.close(); markdownReport.close();
System.out.println("SCENARIO REPORT: " + asClickableLink(markdownReportFile)); System.out.println("SCENARIO REPORT: " + asClickableLink(markdownReportFile));
} }
@ -114,10 +102,9 @@ public class TestReport {
return result.toString(); return result.toString();
} }
@SneakyThrows void silent(final Runnable code) {
private String currentGitBranch() { silent++;
final var gitRevParse = new SystemProcess("git", "rev-parse", "--abbrev-ref", "HEAD"); code.run();
gitRevParse.execute(); silent--;
return gitRevParse.getStdOut().split("\\R", 2)[0];
} }
} }

View File

@ -34,8 +34,6 @@ import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import static java.net.URLEncoder.encode; import static java.net.URLEncoder.encode;
import static net.hostsharing.hsadminng.hs.office.scenarios.TemplateResolver.Resolver.DROP_COMMENTS;
import static net.hostsharing.hsadminng.hs.office.scenarios.TemplateResolver.Resolver.KEEP_COMMENTS;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.platform.commons.util.StringUtils.isBlank; import static org.junit.platform.commons.util.StringUtils.isBlank;
@ -118,11 +116,11 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
public final void obtain( public final void obtain(
final String title, final String alias,
final Supplier<HttpResponse> http, final Supplier<HttpResponse> http,
final Function<HttpResponse, String> extractor, final Function<HttpResponse, String> extractor,
final String... extraInfo) { final String... extraInfo) {
withTitle(title, () -> { withTitle(ScenarioTest.resolve(alias), () -> {
final var response = http.get().keep(extractor); final var response = http.get().keep(extractor);
Arrays.stream(extraInfo).forEach(testReport::printPara); Arrays.stream(extraInfo).forEach(testReport::printPara);
return response; return response;
@ -130,15 +128,15 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
public final void obtain(final String alias, final Supplier<HttpResponse> http, final String... extraInfo) { public final void obtain(final String alias, final Supplier<HttpResponse> http, final String... extraInfo) {
withTitle(alias, () -> { withTitle(ScenarioTest.resolve(alias), () -> {
final var response = http.get().keep(); final var response = http.get().keep();
Arrays.stream(extraInfo).forEach(testReport::printPara); Arrays.stream(extraInfo).forEach(testReport::printPara);
return response; return response;
}); });
} }
public HttpResponse withTitle(final String resolvableTitle, final Supplier<HttpResponse> code) { public HttpResponse withTitle(final String title, final Supplier<HttpResponse> code) {
this.nextTitle = resolvableTitle; this.nextTitle = ScenarioTest.resolve(title);
final var response = code.get(); final var response = code.get();
this.nextTitle = null; this.nextTitle = null;
return response; return response;
@ -146,7 +144,7 @@ public abstract class UseCase<T extends UseCase<?>> {
@SneakyThrows @SneakyThrows
public final HttpResponse httpGet(final String uriPathWithPlaceholders) { public final HttpResponse httpGet(final String uriPathWithPlaceholders) {
final var uriPath = ScenarioTest.resolve(uriPathWithPlaceholders, DROP_COMMENTS); final var uriPath = ScenarioTest.resolve(uriPathWithPlaceholders);
final var request = HttpRequest.newBuilder() final var request = HttpRequest.newBuilder()
.GET() .GET()
.uri(new URI("http://localhost:" + testSuite.port + uriPath)) .uri(new URI("http://localhost:" + testSuite.port + uriPath))
@ -159,7 +157,7 @@ public abstract class UseCase<T extends UseCase<?>> {
@SneakyThrows @SneakyThrows
public final HttpResponse httpPost(final String uriPathWithPlaceholders, final JsonTemplate bodyJsonTemplate) { public final HttpResponse httpPost(final String uriPathWithPlaceholders, final JsonTemplate bodyJsonTemplate) {
final var uriPath = ScenarioTest.resolve(uriPathWithPlaceholders, DROP_COMMENTS); final var uriPath = ScenarioTest.resolve(uriPathWithPlaceholders);
final var requestBody = bodyJsonTemplate.resolvePlaceholders(); final var requestBody = bodyJsonTemplate.resolvePlaceholders();
final var request = HttpRequest.newBuilder() final var request = HttpRequest.newBuilder()
.POST(BodyPublishers.ofString(requestBody)) .POST(BodyPublishers.ofString(requestBody))
@ -174,7 +172,7 @@ public abstract class UseCase<T extends UseCase<?>> {
@SneakyThrows @SneakyThrows
public final HttpResponse httpPatch(final String uriPathWithPlaceholders, final JsonTemplate bodyJsonTemplate) { public final HttpResponse httpPatch(final String uriPathWithPlaceholders, final JsonTemplate bodyJsonTemplate) {
final var uriPath = ScenarioTest.resolve(uriPathWithPlaceholders, DROP_COMMENTS); final var uriPath = ScenarioTest.resolve(uriPathWithPlaceholders);
final var requestBody = bodyJsonTemplate.resolvePlaceholders(); final var requestBody = bodyJsonTemplate.resolvePlaceholders();
final var request = HttpRequest.newBuilder() final var request = HttpRequest.newBuilder()
.method(HttpMethod.PATCH.toString(), BodyPublishers.ofString(requestBody)) .method(HttpMethod.PATCH.toString(), BodyPublishers.ofString(requestBody))
@ -189,7 +187,7 @@ public abstract class UseCase<T extends UseCase<?>> {
@SneakyThrows @SneakyThrows
public final HttpResponse httpDelete(final String uriPathWithPlaceholders) { public final HttpResponse httpDelete(final String uriPathWithPlaceholders) {
final var uriPath = ScenarioTest.resolve(uriPathWithPlaceholders, DROP_COMMENTS); final var uriPath = ScenarioTest.resolve(uriPathWithPlaceholders);
final var request = HttpRequest.newBuilder() final var request = HttpRequest.newBuilder()
.DELETE() .DELETE()
.uri(new URI("http://localhost:" + testSuite.port + uriPath)) .uri(new URI("http://localhost:" + testSuite.port + uriPath))
@ -209,7 +207,7 @@ public abstract class UseCase<T extends UseCase<?>> {
final String title, final String title,
final Supplier<UseCase.HttpResponse> http, final Supplier<UseCase.HttpResponse> http,
final Consumer<UseCase.HttpResponse>... assertions) { final Consumer<UseCase.HttpResponse>... assertions) {
withTitle(title, () -> { withTitle(ScenarioTest.resolve(title), () -> {
final var response = http.get(); final var response = http.get();
Arrays.stream(assertions).forEach(assertion -> assertion.accept(response)); Arrays.stream(assertions).forEach(assertion -> assertion.accept(response));
return response; return response;
@ -221,7 +219,7 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
public String uriEncoded(final String text) { public String uriEncoded(final String text) {
return encode(ScenarioTest.resolve(text, DROP_COMMENTS), StandardCharsets.UTF_8); return encode(ScenarioTest.resolve(text), StandardCharsets.UTF_8);
} }
public static class JsonTemplate { public static class JsonTemplate {
@ -233,7 +231,7 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
String resolvePlaceholders() { String resolvePlaceholders() {
return ScenarioTest.resolve(template, DROP_COMMENTS); return ScenarioTest.resolve(template);
} }
} }
@ -278,7 +276,7 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
public HttpResponse keep(final Function<HttpResponse, String> extractor) { public HttpResponse keep(final Function<HttpResponse, String> extractor) {
final var alias = nextTitle != null ? ScenarioTest.resolve(nextTitle, DROP_COMMENTS) : resultAlias; final var alias = nextTitle != null ? nextTitle : resultAlias;
assertThat(alias).as("cannot keep result, no alias found").isNotNull(); assertThat(alias).as("cannot keep result, no alias found").isNotNull();
final var value = extractor.apply(this); final var value = extractor.apply(this);
@ -296,7 +294,7 @@ public abstract class UseCase<T extends UseCase<?>> {
} }
public HttpResponse keep() { public HttpResponse keep() {
final var alias = nextTitle != null ? ScenarioTest.resolve(nextTitle, DROP_COMMENTS) : resultAlias; final var alias = nextTitle != null ? nextTitle : resultAlias;
assertThat(alias).as("cannot keep result, no title or alias found for locationUuid: " + locationUuid).isNotNull(); assertThat(alias).as("cannot keep result, no title or alias found for locationUuid: " + locationUuid).isNotNull();
return keepAs(alias); return keepAs(alias);
@ -315,13 +313,13 @@ public abstract class UseCase<T extends UseCase<?>> {
@SneakyThrows @SneakyThrows
public String getFromBody(final String path) { public String getFromBody(final String path) {
return JsonPath.parse(response.body()).read(ScenarioTest.resolve(path, DROP_COMMENTS)); return JsonPath.parse(response.body()).read(ScenarioTest.resolve(path));
} }
@SneakyThrows @SneakyThrows
public <T> Optional<T> getFromBodyAsOptional(final String path) { public <T> Optional<T> getFromBodyAsOptional(final String path) {
try { try {
return Optional.ofNullable(JsonPath.parse(response.body()).read(ScenarioTest.resolve(path, DROP_COMMENTS))); return Optional.ofNullable(JsonPath.parse(response.body()).read(ScenarioTest.resolve(path)));
} catch (final PathNotFoundException e) { } catch (final PathNotFoundException e) {
return null; // means the property did not exist at all, not that it was there with value null return null; // means the property did not exist at all, not that it was there with value null
} }
@ -337,9 +335,9 @@ public abstract class UseCase<T extends UseCase<?>> {
// the title // the title
if (nextTitle != null) { if (nextTitle != null) {
testReport.printLine("\n### " + ScenarioTest.resolve(nextTitle, KEEP_COMMENTS) + "\n"); testReport.printLine("\n### " + nextTitle + "\n");
} else if (resultAlias != null) { } else if (resultAlias != null) {
testReport.printLine("\n### Create " + resultAlias + "\n"); testReport.printLine("\n### " + resultAlias + "\n");
} else { } else {
fail("please wrap the http...-call in the UseCase using `withTitle(...)`"); fail("please wrap the http...-call in the UseCase using `withTitle(...)`");
} }

View File

@ -17,7 +17,7 @@ public abstract class CreateCoopSharesTransaction extends UseCase<CreateCoopShar
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
obtain("#{Find }membershipUuid", () -> obtain("membershipUuid", () ->
httpGet("/api/hs/office/memberships?memberNumber=&{memberNumber}") httpGet("/api/hs/office/memberships?memberNumber=&{memberNumber}")
.expecting(OK).expecting(JSON).expectArrayElements(1), .expecting(OK).expecting(JSON).expectArrayElements(1),
response -> response.getFromBody("$[0].uuid") response -> response.getFromBody("$[0].uuid")