From 4911ca54c03de1f7c358b9092f44dbb051161550 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 18 Oct 2024 11:49:02 +0200 Subject: [PATCH] fix CreateSelfDebitorForPartner --- .../hsadminng/hs/office/usecases/UseCase.java | 2 +- .../hsadminng/hs/office/usecases/UseCaseTest.java | 11 +++++++++-- .../usecases/debitor/CreateSelfDebitorForPartner.java | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java index 3adf416a..06e34350 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCase.java @@ -55,7 +55,7 @@ public abstract class UseCase> { } public final HttpResponse doRun() { - requirements.forEach((alias, factpory) -> factpory.apply(alias).run()); + requirements.forEach((alias, factory) -> factory.apply(alias).run().keep()); return run(); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java index 17c393fc..db83585b 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/UseCaseTest.java @@ -20,8 +20,11 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import java.util.stream.Collectors; import java.util.stream.Stream; +import static org.assertj.core.api.Assertions.assertThat; + public abstract class UseCaseTest extends ContextBasedTest { final static String RUN_AS_USER = "superuser-alex@hostsharing.net"; // TODO.test: use global:AGENT when implemented @@ -85,8 +88,12 @@ public abstract class UseCaseTest extends ContextBasedTest { return aliases.containsKey(alias); } - static Alias getAlias(final String alias) { - return aliases.get(alias); + static Alias getAlias(final String name) { + final var alias = aliases.get(name); + assertThat(alias).as("alias '" + name + "' not found in aliases [" + + aliases.keySet().stream().map(v -> "'" + v + "'").collect(Collectors.joining(", ")) + "]" + ).isNotNull(); + return alias; } static void putAlias(final String name, final Alias value) { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java index 8f310ea0..a616e2db 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/usecases/debitor/CreateSelfDebitorForPartner.java @@ -43,8 +43,8 @@ public class CreateSelfDebitorForPartner extends UseCase