db-migration #10

Merged
hsh-michaelhoennig merged 74 commits from db-migration into master 2024-01-23 15:11:24 +01:00
Showing only changes of commit e8e898d18d - Show all commits

View File

@ -82,7 +82,7 @@ public class ImportOfficeTables extends ContextBasedTest {
try (Reader reader = resourceReader("migration/business-partners.csv")) { try (Reader reader = resourceReader("migration/business-partners.csv")) {
final var lines = readAllLines(reader); final var lines = readAllLines(reader);
importBusinessPartners(lines.get(0), withoutFirstElement(lines)); importBusinessPartners(justHeader(lines), withoutHeader(lines));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -101,7 +101,7 @@ public class ImportOfficeTables extends ContextBasedTest {
try (Reader reader = resourceReader("migration/contacts.csv")) { try (Reader reader = resourceReader("migration/contacts.csv")) {
final var lines = readAllLines(reader); final var lines = readAllLines(reader);
importContacts(lines.get(0), withoutFirstElement(lines)); importContacts(justHeader(lines), withoutHeader(lines));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -150,7 +150,7 @@ public class ImportOfficeTables extends ContextBasedTest {
try (Reader reader = resourceReader("migration/sepa-mandates.csv")) { try (Reader reader = resourceReader("migration/sepa-mandates.csv")) {
final var lines = readAllLines(reader); final var lines = readAllLines(reader);
importSepaMandates(lines.get(0), withoutFirstElement(lines)); importSepaMandates(justHeader(lines), withoutHeader(lines));
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -431,7 +431,11 @@ public class ImportOfficeTables extends ContextBasedTest {
return Files.newBufferedReader(filePath); return Files.newBufferedReader(filePath);
} }
private List<String[]> withoutFirstElement(final List<String[]> records) { private static String[] justHeader(final List<String[]> lines) {
return lines.get(0);
}
private List<String[]> withoutHeader(final List<String[]> records) {
return records.subList(1, records.size()-1); return records.subList(1, records.size()-1);
} }