Michael Hoennig
2022-10-30 3b1a9853846feac5d1e026956c3e55dfa880bd44
add some asserts
1 files modified
45 ■■■■■ changed files
src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportBusinessPartners.java 45 ●●●●● patch | view | raw | blame | history
src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportBusinessPartners.java
@@ -42,6 +42,7 @@
import static net.hostsharing.hsadminng.mapper.PostgresDateRange.toPostgresDateRange;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.assertj.core.api.Assertions.assertThat;
@DataJpaTest
@Import({ Context.class, JpaAttempt.class })
@@ -75,6 +76,13 @@
        } catch (Exception e) {
            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);
    }
    @Test
@@ -87,6 +95,43 @@
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        assertThat(partners.toString()).isEqualToIgnoringWhitespace("""
                {
                     7=partner(Michael, Mellies: Herr Michael Mellies ),
                    10=partner(JM e.K.: Frau Dr. Jenny Meyer , JM e.K.),
                    12=partner(Test PS: Paule Schmidt , Test PS)
                }
                """);
        assertThat(contacts.toString()).isEqualToIgnoringWhitespace("""
                {
                    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')
                 }
                """);
        assertThat(persons.toString()).isEqualToIgnoringWhitespace("""
                {
                     7=person(personType='UNKNOWN', tradeName='', familyName='Michael', givenName='Mellies'),
                    10=person(personType='UNKNOWN', tradeName='JM e.K.', familyName='Jenny', givenName='Meyer'),
                    12=person(personType='UNKNOWN', tradeName='Test PS', familyName='Paule', givenName='Schmidt')
                }
                """);
        assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
                {
                     7=debitor(10007: Michael, Mellies),
                    10=debitor(10010: JM e.K.),
                    12=debitor(11012: Test PS)
                }
                """);
        assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
                {
                     7=Membership(10007, Michael, Mellies, 10007, [2000-12-06,), NONE),
                    10=Membership(10010, JM e.K., 10010, [2000-12-06,2016-01-01), UNKNOWN),
                    12=Membership(11012, Test PS, 11012, [2021-04-01,), NONE)
                }
                """);
    }
    @Test