@Test public void extractValueWithEndTag() { assertEquals("4", extractValue(LINUX_COMMAND_OUTPUT, "---\n", " packets transmitted, ")); assertEquals("4", extractValue(LINUX_COMMAND_OUTPUT, "packets transmitted, ", " received, ")); assertEquals("0", extractValue(LINUX_COMMAND_OUTPUT, " received, ", "% packet loss")); }
public static String extractValue(String output, String key) { String value = EMPTY_STRING; int startIndex = output.indexOf(key); if (startIndex >= 0) { value = output.substring(startIndex + key.length()); } return value; }
CommandOutputParser { public static String extractValue(String output, String key) { String value = EMPTY_STRING; int startIndex = output.indexOf(key); if (startIndex >= 0) { value = output.substring(startIndex + key.length()); } return value; } }
CommandOutputParser { public static String extractValue(String output, String key) { String value = EMPTY_STRING; int startIndex = output.indexOf(key); if (startIndex >= 0) { value = output.substring(startIndex + key.length()); } return value; }  }
CommandOutputParser { public static String extractValue(String output, String key) { String value = EMPTY_STRING; int startIndex = output.indexOf(key); if (startIndex >= 0) { value = output.substring(startIndex + key.length()); } return value; }  static String extractValue(String output, String key); static String extractValue(String output, String key, String endTag); }
CommandOutputParser { public static String extractValue(String output, String key) { String value = EMPTY_STRING; int startIndex = output.indexOf(key); if (startIndex >= 0) { value = output.substring(startIndex + key.length()); } return value; }  static String extractValue(String output, String key); static String extractValue(String output, String key, String endTag);  }