@Test public void extractFirstTagContent_NoTagFound() { String idValue1 = "sds232ewdx22sc"; String idValue2 = "sds232ewdxsc"; String idValue3 = "sds232ewdxsc2"; String message = "fdfdffdgvgdrvv<id>" + idValue1 + "</id>\n"; message += "<id>" + idValue2 + " </id>"; message += "<id>" + idValue3 + " </id>d sd sd s d sd s ds d"; assertNull(extractor.extractFirstTagContent(message, "nonexistenttag")); }
public String extractFirstTagContent(String message, String tagName) { Matcher m = createMatcher(message, tagName); String value = null; if (m.find()) { String tagWithValue = m.group(); value = extractValue(tagWithValue, tagName); } return value; }
XmlTagContentExtractor { public String extractFirstTagContent(String message, String tagName) { Matcher m = createMatcher(message, tagName); String value = null; if (m.find()) { String tagWithValue = m.group(); value = extractValue(tagWithValue, tagName); } return value; } }
XmlTagContentExtractor { public String extractFirstTagContent(String message, String tagName) { Matcher m = createMatcher(message, tagName); String value = null; if (m.find()) { String tagWithValue = m.group(); value = extractValue(tagWithValue, tagName); } return value; }  }
XmlTagContentExtractor { public String extractFirstTagContent(String message, String tagName) { Matcher m = createMatcher(message, tagName); String value = null; if (m.find()) { String tagWithValue = m.group(); value = extractValue(tagWithValue, tagName); } return value; }  List<String> extractTagContents(String message, String tagName); String extractFirstTagContent(String message, String tagName); }
XmlTagContentExtractor { public String extractFirstTagContent(String message, String tagName) { Matcher m = createMatcher(message, tagName); String value = null; if (m.find()) { String tagWithValue = m.group(); value = extractValue(tagWithValue, tagName); } return value; }  List<String> extractTagContents(String message, String tagName); String extractFirstTagContent(String message, String tagName);  }