From de0c8dcfbc2f4c5d2630d9191e0e29f6940432b6 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Mon, 10 Oct 2022 09:33:17 +0200 Subject: [PATCH] Array.fromFormatted --- ...iceBankAccountRepositoryIntegrationTest.java | 17 ++++++++++------- ...sOfficeDebitorRepositoryIntegrationTest.java | 2 +- ...ceRelationshipRepositoryIntegrationTest.java | 2 +- src/test/java/net/hostsharing/test/Array.java | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepositoryIntegrationTest.java index d2b3758e..4fc23694 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/bankaccount/HsOfficeBankAccountRepositoryIntegrationTest.java @@ -112,14 +112,17 @@ class HsOfficeBankAccountRepositoryIntegrationTest extends ContextBasedTest { "hs_office_bankaccount#sometempaccC.admin", "hs_office_bankaccount#sometempaccC.tenant" )); - assertThat(grantDisplaysOf(rawGrantRepo.findAll())).containsExactlyInAnyOrder(Array.from( + assertThat(grantDisplaysOf(rawGrantRepo.findAll())).containsExactlyInAnyOrder(Array.fromFormatted( initialGrantNames, - "{ grant role hs_office_bankaccount#sometempaccC.owner to role global#global.admin by system and assume }", - "{ grant perm delete on hs_office_bankaccount#sometempaccC to role hs_office_bankaccount#sometempaccC.owner by system and assume }", - "{ grant role hs_office_bankaccount#sometempaccC.tenant to role hs_office_bankaccount#sometempaccC.admin by system and assume }", - "{ grant role hs_office_bankaccount#sometempaccC.admin to role hs_office_bankaccount#sometempaccC.owner by system and assume }", - "{ grant perm view on hs_office_bankaccount#sometempaccC to role hs_office_bankaccount#sometempaccC.tenant by system and assume }", - "{ grant role hs_office_bankaccount#sometempaccC.owner to user selfregistered-user-drew@hostsharing.org by global#global.admin and assume }" + "{ grant perm delete on hs_office_bankaccount#sometempaccC to role hs_office_bankaccount#sometempaccC.owner by system and assume }", + "{ grant role hs_office_bankaccount#sometempaccC.owner to role global#global.admin by system and assume }", + "{ grant role hs_office_bankaccount#sometempaccC.owner to user selfregistered-user-drew@hostsharing.org by global#global.admin and assume }", + + "{ grant role hs_office_bankaccount#sometempaccC.admin to role hs_office_bankaccount#sometempaccC.owner by system and assume }", + + "{ grant perm view on hs_office_bankaccount#sometempaccC to role hs_office_bankaccount#sometempaccC.tenant by system and assume }", + "{ grant role hs_office_bankaccount#sometempaccC.tenant to role hs_office_bankaccount#sometempaccC.admin by system and assume }", + null )); } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java index b478bcb0..e8b66df9 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/debitor/HsOfficeDebitorRepositoryIntegrationTest.java @@ -120,7 +120,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTest { "hs_office_debitor#20002Fourthe.G.-forthcontact.admin", "hs_office_debitor#20002Fourthe.G.-forthcontact.owner", "hs_office_debitor#20002Fourthe.G.-forthcontact.tenant")); - assertThat(grantDisplaysOf(rawGrantRepo.findAll())).containsExactlyInAnyOrder(Array.fromSkippingNull( + assertThat(grantDisplaysOf(rawGrantRepo.findAll())).containsExactlyInAnyOrder(Array.fromFormatted( initialGrantNames, "{ grant perm * on hs_office_debitor#20002Fourthe.G.-forthcontact to role hs_office_debitor#20002Fourthe.G.-forthcontact.owner by system and assume }", "{ grant role hs_office_debitor#20002Fourthe.G.-forthcontact.owner to role global#global.admin by system and assume }", diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipRepositoryIntegrationTest.java index 7ea0986b..be6f3a72 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/relationship/HsOfficeRelationshipRepositoryIntegrationTest.java @@ -121,7 +121,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest { "hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.admin", "hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.owner", "hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.tenant")); - assertThat(grantDisplaysOf(rawGrantRepo.findAll())).containsExactlyInAnyOrder(Array.fromSkippingNull( + assertThat(grantDisplaysOf(rawGrantRepo.findAll())).containsExactlyInAnyOrder(Array.fromFormatted( initialGrantNames, "{ grant perm * on hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita to role hs_office_relationship#BesslerAnita-with-JOINT_AGENT-BesslerAnita.owner by system and assume }", diff --git a/src/test/java/net/hostsharing/test/Array.java b/src/test/java/net/hostsharing/test/Array.java index 5eb40887..87fa92ff 100644 --- a/src/test/java/net/hostsharing/test/Array.java +++ b/src/test/java/net/hostsharing/test/Array.java @@ -22,7 +22,7 @@ public class Array { return resultList.toArray(String[]::new); } - public static String[] fromSkippingNull(final List initialList, final String... additionalStrings) { + public static String[] fromFormatted(final List initialList, final String... additionalStrings) { final var resultList = new ArrayList<>(initialList); resultList.addAll(Arrays.stream(additionalStrings) .filter(Objects::nonNull)