amend test data (Paule -> Petra) which was confusingly similar to basic test data (Paul) + cleanup
This commit is contained in:
parent
082d5ab635
commit
b96de8efa6
@ -134,7 +134,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
{
|
||||
7=partner(Mellies, Michael: Herr Michael Mellies ),
|
||||
10=partner(JM e.K.: Frau Dr. Jenny Meyer , JM e.K.),
|
||||
12=partner(Test PS: Paule Schmidt , Test PS)
|
||||
12=partner(Test PS: Petra Schmidt , Test PS)
|
||||
}
|
||||
""");
|
||||
assertThat(contacts.toString()).isEqualToIgnoringWhitespace("""
|
||||
@ -142,14 +142,14 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
71=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'),
|
||||
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'),
|
||||
121=contact(label='Paule Schmidt , Test PS', emailAddresses='ps@example.com')
|
||||
121=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com')
|
||||
}
|
||||
""");
|
||||
assertThat(persons.toString()).isEqualToIgnoringWhitespace("""
|
||||
{
|
||||
7=person(personType='UNKNOWN', tradeName='', familyName='Mellies', givenName='Michael'),
|
||||
10=person(personType='UNKNOWN', tradeName='JM e.K.', familyName='Meyer', givenName='Jenny'),
|
||||
12=person(personType='UNKNOWN', tradeName='Test PS', familyName='Schmidt', givenName='Paule')
|
||||
12=person(personType='UNKNOWN', tradeName='Test PS', familyName='Schmidt', givenName='Petra')
|
||||
}
|
||||
""");
|
||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||
@ -242,7 +242,6 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
@Test
|
||||
@Order(10)
|
||||
@Commit
|
||||
//@Rollback(false)
|
||||
void persistEntities() {
|
||||
|
||||
context("superuser-alex@hostsharing.net"); // TODO: use real user for actual import
|
||||
@ -390,6 +389,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
final var member = memberships.get(rec.getInteger("bp_id"));
|
||||
|
||||
final var assetTypeMapping = new HashMap<String, HsOfficeCoopAssetsTransactionType>() {
|
||||
|
||||
{
|
||||
put("HANDOVER", HsOfficeCoopAssetsTransactionType.TRANSFER);
|
||||
put("ADOPTION", HsOfficeCoopAssetsTransactionType.ADOPTION);
|
||||
@ -402,7 +402,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
|
||||
public HsOfficeCoopAssetsTransactionType get(final String key) {
|
||||
final var value = super.get(key);
|
||||
if ( value != null ) {
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
throw new IllegalStateException("no mapping value found for: " + key);
|
||||
@ -481,7 +481,12 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
private void initContact(final HsOfficeContactEntity contact, final Record rec) {
|
||||
contacts.put(rec.getInteger("contact_id"), contact);
|
||||
|
||||
contact.setLabel(toLabel(rec.getString("salut"), rec.getString("title"), rec.getString("first_name"), rec.getString("last_name"), rec.getString("firma")));
|
||||
contact.setLabel(toLabel(
|
||||
rec.getString("salut"),
|
||||
rec.getString("title"),
|
||||
rec.getString("first_name"),
|
||||
rec.getString("last_name"),
|
||||
rec.getString("firma")));
|
||||
contact.setEmailAddresses(rec.getString("email"));
|
||||
contact.setPostalAddress(toAddress(rec));
|
||||
contact.setPhoneNumbers(toPhoneNumbers(rec));
|
||||
@ -495,6 +500,7 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
private String toPhoneNumbers(final Record rec) {
|
||||
final var result = new StringBuilder("{\n");
|
||||
if (isNotBlank(rec.getString("phone_private")))
|
||||
@ -510,7 +516,11 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
|
||||
private String toAddress(final Record rec) {
|
||||
final var result = new StringBuilder();
|
||||
final var name = toName(rec.getString("salut"), rec.getString("title"), rec.getString("first_name"), rec.getString("last_name"));
|
||||
final var name = toName(
|
||||
rec.getString("salut"),
|
||||
rec.getString("title"),
|
||||
rec.getString("first_name"),
|
||||
rec.getString("last_name"));
|
||||
if (isNotBlank(name))
|
||||
result.append(name + "\n");
|
||||
if (isNotBlank(rec.getString("firma")))
|
||||
@ -561,7 +571,6 @@ public class ImportOfficeTables extends ContextBasedTest {
|
||||
return toLabel(salut, title, firstname, lastname, null);
|
||||
}
|
||||
|
||||
|
||||
private Reader resourceReader(@NotNull final String resourcePath) {
|
||||
return new InputStreamReader(getClass().getClassLoader().getResourceAsStream(resourcePath));
|
||||
}
|
||||
@ -593,7 +602,7 @@ class Columns {
|
||||
|
||||
int indexOf(final String columnName) {
|
||||
int index = columnNames.indexOf(columnName);
|
||||
if ( index < 0 ) {
|
||||
if (index < 0) {
|
||||
throw new RuntimeException("column name '" + columnName + "' not found in: " + columnNames);
|
||||
}
|
||||
return index;
|
||||
|
Loading…
Reference in New Issue
Block a user