add some asserts

This commit is contained in:
Michael Hoennig 2022-10-30 09:00:11 +01:00
parent d44d2e3e82
commit 1134401310

View File

@ -42,6 +42,7 @@ import java.util.Map;
import static net.hostsharing.hsadminng.mapper.PostgresDateRange.toPostgresDateRange; import static net.hostsharing.hsadminng.mapper.PostgresDateRange.toPostgresDateRange;
import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.assertj.core.api.Assertions.assertThat;
@DataJpaTest @DataJpaTest
@Import({ Context.class, JpaAttempt.class }) @Import({ Context.class, JpaAttempt.class })
@ -75,6 +76,13 @@ public class ImportBusinessPartners extends ContextBasedTest {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(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 @Test
@ -87,6 +95,43 @@ public class ImportBusinessPartners extends ContextBasedTest {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(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 @Test