ScenarioCsvImportExport { protected void generateHeader(List<FactMapping> factMappings, CSVPrinter printer) throws IOException { List<String> firstLineHeader = new ArrayList<>(); List<String> secondLineHeader = new ArrayList<>(); List<String> thirdLineHeader = new ArrayList<>(); for (FactMapping factMapping : factMappings) { if (FactMappingType.OTHER.equals(factMapping.getExpressionIdentifier().getType())) { String factAlias = factMapping.getFactAlias(); firstLineHeader.add(factAlias); secondLineHeader.add(factAlias); thirdLineHeader.add(factAlias); } else { firstLineHeader.add(factMapping.getExpressionIdentifier().getType().name()); secondLineHeader.add("#".equals(factMapping.getFactAlias()) ? "" : factMapping.getFactAlias()); thirdLineHeader.add(factMapping.getExpressionAlias()); } } printer.printRecord(firstLineHeader.toArray()); printer.printRecord(secondLineHeader.toArray()); printer.printRecord(thirdLineHeader.toArray()); }  String exportData(AbstractScesimModel<? extends AbstractScesimData> scesimModel); AbstractScesimModel<T> importData(String raw, AbstractScesimModel<T> originalScesimModel); static final int HEADER_SIZE; }
@Test public void generateHeader() throws IOException { ScesimModelDescriptor simulationDescriptor = new ScesimModelDescriptor(); FactMapping test1FactMapping = createFactMapping(simulationDescriptor, 1); FactMapping test2FactMapping = createFactMapping(simulationDescriptor, 2); scenarioCsvImportExport.generateHeader(Arrays.asList(test1FactMapping, test2FactMapping), printer); System.out.println("output.toString() = " + output.toString()); String[] result = output.toString().split("\r\n"); assertEquals(3, result.length); assertEquals("GIVEN,GIVEN", result[0]); assertEquals(instanceName + 1 + "," + instanceName + 2, result[1]); assertEquals(propertyName + 1 + "," + propertyName + 2, result[2]); }