feature/add-scenario-test-for-deceased-partner-with-community-of-heirs #137

Merged
3 changed files with 33 additions and 29 deletions
Showing only changes of commit 83ab12f3e0 - Show all commits

View File

@ -227,7 +227,8 @@ class HsOfficeScenarioTests extends ScenarioTest {
new ReplaceContactData(scenarioTest)
.given("partnerName", "Test AG")
.given("newContactCaption", "Test AG - China")
.given("newPostalAddress", """
.given(
"newPostalAddress", """
"firm": "Test AG",
"name": "Fi Zhong-Kha",
"building": "Thi Chi Koh Building",
@ -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,9 +626,7 @@ 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",

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