take co from representative...Name

This commit is contained in:
Michael Hoennig 2024-12-18 09:21:59 +01:00
parent 9b58997fb7
commit 83ab12f3e0
3 changed files with 33 additions and 29 deletions

View File

@ -227,16 +227,17 @@ class HsOfficeScenarioTests extends ScenarioTest {
new ReplaceContactData(scenarioTest)
.given("partnerName", "Test AG")
.given("newContactCaption", "Test AG - China")
.given("newPostalAddress", """
"firm": "Test AG",
"name": "Fi Zhong-Kha",
"building": "Thi Chi Koh Building",
"street": "No.2 Commercial Second Street",
"district": "Niushan Wei Wu",
"city": "Dongguan City",
"province": "Guangdong Province",
"country": "China"
""")
.given(
"newPostalAddress", """
"firm": "Test AG",
"name": "Fi Zhong-Kha",
"building": "Thi Chi Koh Building",
"street": "No.2 Commercial Second Street",
"district": "Niushan Wei Wu",
"city": "Dongguan City",
"province": "Guangdong Province",
"country": "China"
""")
.given("newOfficePhoneNumber", "++15 999 654321")
.given("newEmailAddress", "norden@test-ag.example.org")
.doRun();
@ -263,6 +264,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Order(20)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class DebitorScenarios {
@Test
@Order(2010)
@Requires("Partner: P-31010 - Test AG")
@ -624,14 +626,12 @@ class HsOfficeScenarioTests extends ScenarioTest {
.given("representativeGivenName", "Lena")
.given("representativeFamilyName", "Stadland")
.given(
// "name": "Erbengemeinschaft Michelle Matthieu", // FIXME: automatic?
"communityOfHeirsPostalAddress", """
"co": "Lena Stadland", // FIXME: take this form representative...?
"street": "Im Wischer 14",
"zipcode": "22987",
"city": "Hamburg",
"country": "Germany"
""")
"street": "Im Wischer 14",
"zipcode": "22987",
"city": "Hamburg",
"country": "Germany"
""")
.given("communityOfHeirsOfficePhoneNumber", "+49 40 666666")
.given("communityOfHeirsEmailAddress", "lena.stadland@example.org")
.doRun();

View File

@ -48,6 +48,7 @@ public class ReplaceDeceasedPartnerWithCommunityOfHeirs extends UseCase<ReplaceD
"caption": "Erbengemeinschaft %{nameOfDeceasedPerson}",
"postalAddress": {
"name": "Erbengemeinschaft %{nameOfDeceasedPerson}",
"co": "%{representativeGivenName} %{representativeFamilyName}",
%{communityOfHeirsPostalAddress}
},
"phoneNumbers": {

View File

@ -80,18 +80,7 @@ public abstract class ScenarioTest extends ContextBasedTest {
@AfterEach
void afterScenario(final TestInfo testInfo) { // final TestInfo testInfo
testInfo.getTestMethod() .ifPresent(currentTestMethod -> {
// FIXME: extract to method
final var producesAnnot = currentTestMethod.getAnnotation(Produces.class);
if (producesAnnot != null && producesAnnot.permanent()) {
final var testMethodProduces = producedAliases(producesAnnot);
testMethodProduces.forEach(declaredAlias ->
assertThat(knowVariables().containsKey(declaredAlias))
.as("@Producer method " + currentTestMethod.getName() +
" did declare but not produce \"" + declaredAlias + "\"")
.isTrue() );
}
});
verifyProduceDeclaration(testInfo);
properties.clear();
testReport.close();
@ -182,6 +171,20 @@ public abstract class ScenarioTest extends ContextBasedTest {
}
}
private static void verifyProduceDeclaration(final TestInfo testInfo) {
testInfo.getTestMethod().ifPresent(currentTestMethod -> {
final var producesAnnot = currentTestMethod.getAnnotation(Produces.class);
if (producesAnnot != null && producesAnnot.permanent()) {
final var testMethodProduces = producedAliases(producesAnnot);
testMethodProduces.forEach(declaredAlias ->
assertThat(knowVariables().containsKey(declaredAlias))
.as("@Producer method " + currentTestMethod.getName() +
" did declare but not produce \"" + declaredAlias + "\"")
.isTrue() );
}
});
}
static boolean containsAlias(final String alias) {
return aliases.containsKey(alias);
}