@Test public void getResultMessageFromChildrenFiveLevel() { ApiCommandList level1 = getApiCommandList("name0", "message0", "serviceName0"); ApiCommandList level2 = getApiCommandList("name1", "message1", "serviceName1"); ApiCommandList level3 = getApiCommandList("name2", "message2", "serviceName2"); ApiCommandList level4 = getApiCommandList("name3", "message3", "serviceName3"); ApiCommandList level5 = getApiCommandList("name4", "message4", "serviceName4"); level1.getItems().get(0).setChildren(level2); level2.getItems().get(0).setChildren(level3); level3.getItems().get(0).setChildren(level4); level4.getItems().get(0).setChildren(level5); List<String> actual = ApiCommandUtil.getFailedCommandMessages(level1); Assertions.assertEquals(actual.size(), 5); Assertions.assertEquals(actual.get(0), "name0(serviceName0): message0"); Assertions.assertEquals(actual.get(1), "name1(serviceName1): message1"); Assertions.assertEquals(actual.get(2), "name2(serviceName2): message2"); Assertions.assertEquals(actual.get(3), "name3(serviceName3): message3"); Assertions.assertEquals(actual.get(4), "name4(serviceName4): message4"); }
public static List<String> getFailedCommandMessages(ApiCommandList apiCommandList) { List<ApiCommand> failedCommands = getFailedCommands(apiCommandList); LOGGER.debug("Failed commands: {}", failedCommands); return failedCommands.stream().map(ApiCommandUtil::formatToLine).collect(toList()); }
ApiCommandUtil { public static List<String> getFailedCommandMessages(ApiCommandList apiCommandList) { List<ApiCommand> failedCommands = getFailedCommands(apiCommandList); LOGGER.debug("Failed commands: {}", failedCommands); return failedCommands.stream().map(ApiCommandUtil::formatToLine).collect(toList()); } }
ApiCommandUtil { public static List<String> getFailedCommandMessages(ApiCommandList apiCommandList) { List<ApiCommand> failedCommands = getFailedCommands(apiCommandList); LOGGER.debug("Failed commands: {}", failedCommands); return failedCommands.stream().map(ApiCommandUtil::formatToLine).collect(toList()); } private  ApiCommandUtil(); }
ApiCommandUtil { public static List<String> getFailedCommandMessages(ApiCommandList apiCommandList) { List<ApiCommand> failedCommands = getFailedCommands(apiCommandList); LOGGER.debug("Failed commands: {}", failedCommands); return failedCommands.stream().map(ApiCommandUtil::formatToLine).collect(toList()); } private  ApiCommandUtil(); static List<String> getFailedCommandMessages(ApiCommandList apiCommandList); }
ApiCommandUtil { public static List<String> getFailedCommandMessages(ApiCommandList apiCommandList) { List<ApiCommand> failedCommands = getFailedCommands(apiCommandList); LOGGER.debug("Failed commands: {}", failedCommands); return failedCommands.stream().map(ApiCommandUtil::formatToLine).collect(toList()); } private  ApiCommandUtil(); static List<String> getFailedCommandMessages(ApiCommandList apiCommandList);  }