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

View File

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

View File

@ -80,18 +80,7 @@ public abstract class ScenarioTest extends ContextBasedTest {
@AfterEach @AfterEach
void afterScenario(final TestInfo testInfo) { // final TestInfo testInfo void afterScenario(final TestInfo testInfo) { // final TestInfo testInfo
testInfo.getTestMethod() .ifPresent(currentTestMethod -> { verifyProduceDeclaration(testInfo);
// 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() );
}
});
properties.clear(); properties.clear();
testReport.close(); 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) { static boolean containsAlias(final String alias) {
return aliases.containsKey(alias); return aliases.containsKey(alias);
} }