ScenarioResultsWriter { public static void writeShortFormat(List<ScenarioResultModel> allScenarioResults, String fileName) throws IOException { try (Writer writer = new BufferedWriter(new FileWriter(fileName))) { writeShortFormat(allScenarioResults, writer); } } private  ScenarioResultsWriter(); static void writeLongFormat(List<ScenarioResultModel> allScenarioResults, String fileName); static void writeLongFormat(List<ScenarioResultModel> allScenarioResults, Appendable appendable); static void writeShortFormat(List<ScenarioResultModel> allScenarioResults, String fileName); static void writeShortFormat(List<ScenarioResultModel> allScenarioResults, Appendable appendable);  }
@Test public void shortFormat() throws IOException { List<String> expectedList = ImmutableList.of( row("ScenarioName", "ValuationTime", "Type", "Description", "PositionId", "ParamName1", "ParamValue1", "ParamName2", "ParamValue2", _res1Name, _res2Name), row(_scenario1Name, _valuationTime1, "FXForward", "An FX Forward", _id1, _param1Name, _param1Value1, _param2Name, _param2Value1, 1, 2), row(_scenario1Name, _valuationTime1, "FRA", "A FRA", _id2, _param1Name, _param1Value1, _param2Name, _param2Value1, 3, 4), row(_scenario2Name, _valuationTime2, "FXForward", "An FX Forward", _id1, _param1Name, _param1Value2, _param2Name, _param2Value2, 5, 6), row(_scenario2Name, _valuationTime2, "FRA", "A FRA", _id2, _param1Name, _param1Value2, _param2Name, _param2Value2, 7, 8)); String expected = StringUtils.join(expectedList, "\n") + "\n"; StringBuilder builder = new StringBuilder(); ScenarioResultsWriter.writeShortFormat(scenarioResults(), builder); assertEquals(expected, builder.toString()); }