added new tests for decoding
This commit is contained in:
parent
fae01ef464
commit
1c71e9efbf
|
@ -0,0 +1,6 @@
|
||||||
|
Bank;BLZ;Kontonummer;PIN;Kontostand;Kontoart;Zins %;Ueberziehungsbetrag;Kundennummer;Name;Vorname;Kunde Straße;Kunde PLZ;Kunde Ort
|
||||||
|
VR Bank Rhein-Neckar;MA2424;4711;1234; -50,14 €;Sparkonto;3%;;123456;Mustermann;Max;Bahnhofstraße 1;68159;Mannheim
|
||||||
|
VR Bank Rhein-Neckar;MA2424;-8321;1234; 500, €;Girokonto;;1.000,27 €; 123456;Mustermann;Max; Bahnhof straße 1;68159;Mannheim
|
||||||
|
Berliner Bank;19087;1717;1234; 500,1400;Sparkonto; 1,003 ;;717171;Mustermann;Max;Bahnhofstraße 1;68159;Mannheim
|
||||||
|
Berliner Bank;19087;1919;1234;540,2 € ;Sparkonto; ,001;;717171;Mustermann Hans-Peter;Max;Bahnhofstraße 1;68159;Mannheim
|
||||||
|
Zocker Bank;Zock7777;4444;7777; -8000,5 €;Girokonto;;50000,5;31124;Hogo;Gruber;Berlinestraß 33 / 1;7899;Berlin
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
Bank;BLZ;Kontonummer;PIN;Kontostand;Kontoart;Zins %;Ueberziehungsbetrag;Kundennummer;Name;Vorname;Kunde Straße;Kunde PLZ;Kunde Ort
|
||||||
|
VR Bank Rhein-Neckar;MA2424;4711;1234; -50,14 €;Sparkonto;3%;;123456;Mustermann;Max;Bahnhofstraße 1;68159;Mannheim
|
||||||
|
VR Bank Rhein-Neckar;MA2424;8321;1234; 500, €;Girokonto;;1.000,27 €; 123456;Mustermann;Max; Bahnhof straße 1;68159;Mannheim
|
||||||
|
Berliner Bank;19087;1717;1234; 500,1400;Sparkonto; 1,003 ;;717171;Mustermann;Max;Bahnhofstraße 1;68159;Mannheim
|
||||||
|
Berliner Bank;19087;1919;1234;540,2 € ;Sparkonto; ,001;;717171;Mustermann Hans-Peter;Max;Bahnhofstraße 1;68159;Mannheim
|
||||||
|
Zocker Bank;Zock7777;4444;7777; -8000,5 €;Girokonto;;50000,5;31124;Hogo;Gruber;Berlinestraß 33 / 1;7899;Berlin
|
|
|
@ -8,6 +8,12 @@ public class Testing {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
BankingManagementSystem.loadFromCsv(Paths.get("res/BankCSV_etwurf.csv"));
|
BankingManagementSystem.loadFromCsv(Paths.get("res/banking_valid.csv"));
|
||||||
|
BankingManagementSystem.loadFromCsv(Paths.get("res/banking_valid_other_formats.csv"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
public void testInvalid() {
|
||||||
|
BankingManagementSystem.loadFromCsv(Paths.get("res/banking_invalid.csv"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,10 @@ public class Decoder {
|
||||||
LOCAL_NUMBER_FORMAT.setParseIntegerOnly(true);
|
LOCAL_NUMBER_FORMAT.setParseIntegerOnly(true);
|
||||||
var serialNumber = LOCAL_NUMBER_FORMAT.parse(number.trim());
|
var serialNumber = LOCAL_NUMBER_FORMAT.parse(number.trim());
|
||||||
LOCAL_NUMBER_FORMAT.setParseIntegerOnly(false);
|
LOCAL_NUMBER_FORMAT.setParseIntegerOnly(false);
|
||||||
|
|
||||||
|
if (serialNumber.intValue() < 0)
|
||||||
|
throw new IllegalArgumentException("Not a valid unique identification number: " + number);
|
||||||
|
|
||||||
return serialNumber.intValue();
|
return serialNumber.intValue();
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
throw new IllegalArgumentException("Not a valid serial number: " + number, ex);
|
throw new IllegalArgumentException("Not a valid serial number: " + number, ex);
|
||||||
|
|
Loading…
Reference in New Issue