header handling for buisoness partners import file
This commit is contained in:
parent
37e867c33d
commit
e8e898d18d
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user