@Test public void testExtractDataFromLineWithBrackets() throws Exception { InfoFieldParser parser = new InfoFieldParser(PATTERN); List<String> resultRemoveBrackets = parser.extractDataFromLine(EXTENDED_INFO_VALUE_BRACKETS); Assert.assertEquals(4, resultRemoveBrackets.size()); Assert.assertTrue(resultRemoveBrackets.get(0).startsWith("K")); Assert.assertTrue(resultRemoveBrackets.get(3).isEmpty()); List<String> resultNoBrackets = parser.extractDataFromLine(EXTENDED_INFO_VALUE_BRACKETS.substring(0, EXTENDED_INFO_VALUE_BRACKETS.length() - 1)); Assert.assertEquals(4, resultNoBrackets.size()); Assert.assertTrue(resultNoBrackets.get(0).startsWith("(")); Assert.assertTrue(resultNoBrackets.get(3).isEmpty()); }
public List<String> extractDataFromLine(String line) { for (InfoPattern pattern : patterns) { List<String> data = pattern.extractDataFromLine(line); if (!data.isEmpty()) { return data; } } return Collections.emptyList(); }
InfoFieldParser { public List<String> extractDataFromLine(String line) { for (InfoPattern pattern : patterns) { List<String> data = pattern.extractDataFromLine(line); if (!data.isEmpty()) { return data; } } return Collections.emptyList(); } }
InfoFieldParser { public List<String> extractDataFromLine(String line) { for (InfoPattern pattern : patterns) { List<String> data = pattern.extractDataFromLine(line); if (!data.isEmpty()) { return data; } } return Collections.emptyList(); } InfoFieldParser(final String templates); }
InfoFieldParser { public List<String> extractDataFromLine(String line) { for (InfoPattern pattern : patterns) { List<String> data = pattern.extractDataFromLine(line); if (!data.isEmpty()) { return data; } } return Collections.emptyList(); } InfoFieldParser(final String templates); boolean isExtendedInfoField(String line); List<String> extractHeaderFromLine(String line); List<String> extractDataFromLine(String line); }
InfoFieldParser { public List<String> extractDataFromLine(String line) { for (InfoPattern pattern : patterns) { List<String> data = pattern.extractDataFromLine(line); if (!data.isEmpty()) { return data; } } return Collections.emptyList(); } InfoFieldParser(final String templates); boolean isExtendedInfoField(String line); List<String> extractHeaderFromLine(String line); List<String> extractDataFromLine(String line);  }