From a042eff8bc745f5ce741365ba5310cc8c79360f3 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Fri, 5 Jan 2024 14:20:41 +0100 Subject: [PATCH] improve test assertions --- .../office/migration/ImportOfficeTables.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeTables.java b/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeTables.java index ac221907..ff7273e8 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeTables.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeTables.java @@ -87,12 +87,28 @@ public class ImportOfficeTables extends ContextBasedTest { throw new RuntimeException(e); } - // no sensible content without contacts, thus just checking counts - assertThat(partners.size()).isEqualTo(3); - assertThat(contacts.size()).isEqualTo(0); - assertThat(persons.size()).isEqualTo(3); - assertThat(debitors.size()).isEqualTo(3); - assertThat(memberships.size()).isEqualTo(3); + // no contacts yet => mostly null values + assertThat(partners.toString()).isEqualToIgnoringWhitespace(""" + { + 7=partner(null, null: null), + 10=partner(null, null: null), + 12=partner(null, null: null) + } + """); + assertThat(contacts.toString()).isEqualTo("{}"); + assertThat(debitors.toString()).isEqualToIgnoringWhitespace(""" + { + 7=debitor(10007: null, null), + 10=debitor(10010: null, null), + 12=debitor(11012: null, null)} + """); + assertThat(memberships.toString()).isEqualToIgnoringWhitespace(""" + { + 7=Membership(10007, null, null, 10007, [2000-12-06,), NONE), + 10=Membership(10010, null, null, 10010, [2000-12-06,2016-01-01), UNKNOWN), + 12=Membership(11012, null, null, 11012, [2021-04-01,), NONE) + } + """); } @Test @@ -118,7 +134,7 @@ public class ImportOfficeTables extends ContextBasedTest { 101=contact(label='Frau Dr. Jenny Meyer , JM e.K.', emailAddresses='jm@example.org'), 102=contact(label='Herr Andrew Meyer , JM e.K.', emailAddresses='am@example.org'), 71=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'), - 121=contact(label='Paule Schmidt , Test PS', emailAddresses='ps@example.com') + 121=contact(label='Paule Schmidt , Test PS', emailAddresses='ps@example.com') } """); assertThat(persons.toString()).isEqualToIgnoringWhitespace("""