@Test public void testExtractCode() { DecodeStrategy decoder = DecodeStrategy.decoderForSheetZero(); BankParticipantCodeStructure pairs; String input = "1385920000"; pairs = decoder.decode(input); assertEquals("8592", pairs.getBankCode()); assertEquals("13", pairs.getParentCode()); input = "4086050000"; pairs = decoder.decode(input); assertEquals("8605", pairs.getBankCode()); assertEquals("40", pairs.getParentCode()); input = "0000000000"; pairs = decoder.decode(input); assertEquals("00", pairs.getBankCode()); assertNull(pairs.getParentCode()); input = "1600000000"; pairs = decoder.decode(input); assertEquals("16", pairs.getBankCode()); assertEquals("00", pairs.getParentCode()); }
@Test public void testMapEntryEquality() { BankParticipantCodeStructure entry = new BankParticipantCodeStructure("1", "2"); BankParticipantCodeStructure entry2 = new BankParticipantCodeStructure("1", "2"); BankParticipantCodeStructure entry3 = new BankParticipantCodeStructure("2", "3"); assertEquals(entry, entry2); assertFalse(entry.equals(entry3)); Set<BankParticipantCodeStructure> set = new HashSet<>(); set.add(entry); set.add(entry2); set.add(entry3); assertEquals(2, set.size()); }
@Test public void testExtractCodeForSheetTwoVariantTwo() { DecodeStrategy decoder = DecodeStrategy.levelTwoDecoderForSheetTwo(); String input = "01390130003"; BankParticipantCodeStructure pairs = decoder.decode(input); assertEquals("00003", pairs.getBankCode()); assertEquals("9013", pairs.getParentCode()); input = "038903801404"; pairs = decoder.decode(input); assertEquals("01404", pairs.getBankCode()); assertEquals("9038", pairs.getParentCode()); }