@Test public void testParseOutput() { Map<String, String> resultsMap = new WindowsPingCommand().parseOutput(WINDOWS_COMMAND_OUTPUT); assertEquals("4", resultsMap.get(PACKETS_SENT)); assertEquals("4", resultsMap.get(PACKETS_RECEIVED)); assertEquals("0", resultsMap.get(PERCENTAGE_PACKETS_LOST)); assertEquals("185", resultsMap.get(TRANSMISSION_TIME_MIN)); assertEquals("185", resultsMap.get(TRANSMISSION_TIME_AVG)); assertEquals("186", resultsMap.get(TRANSMISSION_TIME_MAX)); }
@Override public Map<String, String> parseOutput(String output) { Map<String, String> resultMap = new HashMap<>(); resultMap.put(RETURN_RESULT, output); resultMap.put(PACKETS_SENT, extractValue(output, "Sent = ", COMMA)); resultMap.put(PACKETS_RECEIVED, extractValue(output, "Received = ", COMMA)); resultMap.put(PERCENTAGE_PACKETS_LOST, extractValue(output, " (", "% loss)")); resultMap.put(TRANSMISSION_TIME_MIN, extractValue(output, "Minimum = ", "ms")); resultMap.put(TRANSMISSION_TIME_MAX, extractValue(output, "Maximum = ", "ms")); resultMap.put(TRANSMISSION_TIME_AVG, extractValue(output, "Average = ", "ms")); return resultMap; }
WindowsPingCommand implements LocalPingCommand { @Override public Map<String, String> parseOutput(String output) { Map<String, String> resultMap = new HashMap<>(); resultMap.put(RETURN_RESULT, output); resultMap.put(PACKETS_SENT, extractValue(output, "Sent = ", COMMA)); resultMap.put(PACKETS_RECEIVED, extractValue(output, "Received = ", COMMA)); resultMap.put(PERCENTAGE_PACKETS_LOST, extractValue(output, " (", "% loss)")); resultMap.put(TRANSMISSION_TIME_MIN, extractValue(output, "Minimum = ", "ms")); resultMap.put(TRANSMISSION_TIME_MAX, extractValue(output, "Maximum = ", "ms")); resultMap.put(TRANSMISSION_TIME_AVG, extractValue(output, "Average = ", "ms")); return resultMap; } }
WindowsPingCommand implements LocalPingCommand { @Override public Map<String, String> parseOutput(String output) { Map<String, String> resultMap = new HashMap<>(); resultMap.put(RETURN_RESULT, output); resultMap.put(PACKETS_SENT, extractValue(output, "Sent = ", COMMA)); resultMap.put(PACKETS_RECEIVED, extractValue(output, "Received = ", COMMA)); resultMap.put(PERCENTAGE_PACKETS_LOST, extractValue(output, " (", "% loss)")); resultMap.put(TRANSMISSION_TIME_MIN, extractValue(output, "Minimum = ", "ms")); resultMap.put(TRANSMISSION_TIME_MAX, extractValue(output, "Maximum = ", "ms")); resultMap.put(TRANSMISSION_TIME_AVG, extractValue(output, "Average = ", "ms")); return resultMap; }  }
WindowsPingCommand implements LocalPingCommand { @Override public Map<String, String> parseOutput(String output) { Map<String, String> resultMap = new HashMap<>(); resultMap.put(RETURN_RESULT, output); resultMap.put(PACKETS_SENT, extractValue(output, "Sent = ", COMMA)); resultMap.put(PACKETS_RECEIVED, extractValue(output, "Received = ", COMMA)); resultMap.put(PERCENTAGE_PACKETS_LOST, extractValue(output, " (", "% loss)")); resultMap.put(TRANSMISSION_TIME_MIN, extractValue(output, "Minimum = ", "ms")); resultMap.put(TRANSMISSION_TIME_MAX, extractValue(output, "Maximum = ", "ms")); resultMap.put(TRANSMISSION_TIME_AVG, extractValue(output, "Average = ", "ms")); return resultMap; }  @Override String createCommand(LocalPingInputs localPingInputs); @Override Map<String, String> parseOutput(String output); }
WindowsPingCommand implements LocalPingCommand { @Override public Map<String, String> parseOutput(String output) { Map<String, String> resultMap = new HashMap<>(); resultMap.put(RETURN_RESULT, output); resultMap.put(PACKETS_SENT, extractValue(output, "Sent = ", COMMA)); resultMap.put(PACKETS_RECEIVED, extractValue(output, "Received = ", COMMA)); resultMap.put(PERCENTAGE_PACKETS_LOST, extractValue(output, " (", "% loss)")); resultMap.put(TRANSMISSION_TIME_MIN, extractValue(output, "Minimum = ", "ms")); resultMap.put(TRANSMISSION_TIME_MAX, extractValue(output, "Maximum = ", "ms")); resultMap.put(TRANSMISSION_TIME_AVG, extractValue(output, "Average = ", "ms")); return resultMap; }  @Override String createCommand(LocalPingInputs localPingInputs); @Override Map<String, String> parseOutput(String output);  }