@Test public void createCsvStringTest() throws AlertException { MessageContentGroup messageContentGroup = new MessageContentGroup(); ProviderMessageContent.Builder providerMessageBuilder = new ProviderMessageContent.Builder(); providerMessageBuilder.applyProvider("Example Provider", 1L, "Example Config"); providerMessageBuilder.applyTopic("Example Topic Name", "Example Topic Value"); ComponentItem.Builder componentItemBuilder = new ComponentItem.Builder(); componentItemBuilder.applyNotificationId(1L); componentItemBuilder.applyOperation(ItemOperation.INFO); componentItemBuilder.applyCategory("Example Category"); componentItemBuilder.applyComponentData("Example Component Name", "Example Component Value", "https: componentItemBuilder.applySubComponent("Example SubComponent Name", "Example SubComponent Value", "https: componentItemBuilder.applyCategoryItem("Example Category Item Name", "Example Category Item Value"); componentItemBuilder.applyCategoryGroupingAttribute("Example Category Grouping Attribute Name", "Example Category Grouping Attribute Value"); providerMessageBuilder.applyComponentItem(componentItemBuilder.build()); messageContentGroup.add(providerMessageBuilder.build()); MessageContentGroupCsvCreator messageContentGroupCsvCreator = new MessageContentGroupCsvCreator(); String csvString = messageContentGroupCsvCreator.createCsvString(messageContentGroup); assertNotNull(csvString); }
public String createCsvString(MessageContentGroup messageContentGroup) { LinkableItem commonProvider = messageContentGroup.getCommonProvider(); LinkableItem commonTopic = messageContentGroup.getCommonTopic(); List<ProviderMessageContent> contents = messageContentGroup.getSubContent(); StringBuilder csvBuilder = new StringBuilder(); List<String> columnNames = createColumnNames(commonTopic, contents); appendLine(csvBuilder, columnNames); List<List<String>> rowValues = createRowValues(commonProvider, commonTopic, contents); for (List<String> row : rowValues) { appendLine(csvBuilder, row); } return csvBuilder.toString(); }
MessageContentGroupCsvCreator { public String createCsvString(MessageContentGroup messageContentGroup) { LinkableItem commonProvider = messageContentGroup.getCommonProvider(); LinkableItem commonTopic = messageContentGroup.getCommonTopic(); List<ProviderMessageContent> contents = messageContentGroup.getSubContent(); StringBuilder csvBuilder = new StringBuilder(); List<String> columnNames = createColumnNames(commonTopic, contents); appendLine(csvBuilder, columnNames); List<List<String>> rowValues = createRowValues(commonProvider, commonTopic, contents); for (List<String> row : rowValues) { appendLine(csvBuilder, row); } return csvBuilder.toString(); } }
MessageContentGroupCsvCreator { public String createCsvString(MessageContentGroup messageContentGroup) { LinkableItem commonProvider = messageContentGroup.getCommonProvider(); LinkableItem commonTopic = messageContentGroup.getCommonTopic(); List<ProviderMessageContent> contents = messageContentGroup.getSubContent(); StringBuilder csvBuilder = new StringBuilder(); List<String> columnNames = createColumnNames(commonTopic, contents); appendLine(csvBuilder, columnNames); List<List<String>> rowValues = createRowValues(commonProvider, commonTopic, contents); for (List<String> row : rowValues) { appendLine(csvBuilder, row); } return csvBuilder.toString(); }  }
MessageContentGroupCsvCreator { public String createCsvString(MessageContentGroup messageContentGroup) { LinkableItem commonProvider = messageContentGroup.getCommonProvider(); LinkableItem commonTopic = messageContentGroup.getCommonTopic(); List<ProviderMessageContent> contents = messageContentGroup.getSubContent(); StringBuilder csvBuilder = new StringBuilder(); List<String> columnNames = createColumnNames(commonTopic, contents); appendLine(csvBuilder, columnNames); List<List<String>> rowValues = createRowValues(commonProvider, commonTopic, contents); for (List<String> row : rowValues) { appendLine(csvBuilder, row); } return csvBuilder.toString(); }  String createCsvString(MessageContentGroup messageContentGroup); }
MessageContentGroupCsvCreator { public String createCsvString(MessageContentGroup messageContentGroup) { LinkableItem commonProvider = messageContentGroup.getCommonProvider(); LinkableItem commonTopic = messageContentGroup.getCommonTopic(); List<ProviderMessageContent> contents = messageContentGroup.getSubContent(); StringBuilder csvBuilder = new StringBuilder(); List<String> columnNames = createColumnNames(commonTopic, contents); appendLine(csvBuilder, columnNames); List<List<String>> rowValues = createRowValues(commonProvider, commonTopic, contents); for (List<String> row : rowValues) { appendLine(csvBuilder, row); } return csvBuilder.toString(); }  String createCsvString(MessageContentGroup messageContentGroup);  }