@Test(expected = IllegalArgumentException.class) public void testWriteFileWithUknownFIleType() { mex.writeFile("non-existing-type", null, null); }
public void writeFile(String outputType, Map<String, Integer> metrics, String filepath) { if (outputType.equals("csv")) { writeCsv(metrics, filepath); } else if (outputType.equals("json")) { writeJson(metrics, filepath); } else { throw new IllegalArgumentException("Unknown type : " + outputType); } }
MetricsExporter { public void writeFile(String outputType, Map<String, Integer> metrics, String filepath) { if (outputType.equals("csv")) { writeCsv(metrics, filepath); } else if (outputType.equals("json")) { writeJson(metrics, filepath); } else { throw new IllegalArgumentException("Unknown type : " + outputType); } } }
MetricsExporter { public void writeFile(String outputType, Map<String, Integer> metrics, String filepath) { if (outputType.equals("csv")) { writeCsv(metrics, filepath); } else if (outputType.equals("json")) { writeJson(metrics, filepath); } else { throw new IllegalArgumentException("Unknown type : " + outputType); } }  }
MetricsExporter { public void writeFile(String outputType, Map<String, Integer> metrics, String filepath) { if (outputType.equals("csv")) { writeCsv(metrics, filepath); } else if (outputType.equals("json")) { writeJson(metrics, filepath); } else { throw new IllegalArgumentException("Unknown type : " + outputType); } }  void writeFile(String outputType, Map<String, Integer> metrics, String filepath); }
MetricsExporter { public void writeFile(String outputType, Map<String, Integer> metrics, String filepath) { if (outputType.equals("csv")) { writeCsv(metrics, filepath); } else if (outputType.equals("json")) { writeJson(metrics, filepath); } else { throw new IllegalArgumentException("Unknown type : " + outputType); } }  void writeFile(String outputType, Map<String, Integer> metrics, String filepath);  }