CommunicationSeverityAnalyser { public void evaluateCommunicationSummarySeverity(Collection<CommunicationSummaryStatistics> nodes) { long max = 0; Map<String, CommunicationSummaryStatistics> nodeMap = new HashMap<String, CommunicationSummaryStatistics>(); for (CommunicationSummaryStatistics css : nodes) { if (css.getAverageDuration() > max) { max = css.getAverageDuration(); } nodeMap.put(css.getId(), css); } for (CommunicationSummaryStatistics css : nodes) { deriveSeverity(css, max, nodeMap); } }  void evaluateCommunicationSummarySeverity(Collection<CommunicationSummaryStatistics> nodes);  }
@Test public void testEvaluateCommunicationSummarySeverityTree() { List<CommunicationSummaryStatistics> nodes=new ArrayList<CommunicationSummaryStatistics>(); CommunicationSummaryStatistics css1 = new CommunicationSummaryStatistics(); css1.setId("css1"); css1.setAverageDuration(1789); CommunicationSummaryStatistics.ConnectionStatistics cs1 = new CommunicationSummaryStatistics.ConnectionStatistics(); css1.getOutbound().put("css2", cs1); nodes.add(css1); CommunicationSummaryStatistics css2 = new CommunicationSummaryStatistics(); css2.setId("css2"); css2.setAverageDuration(597); nodes.add(css2); CommunicationSeverityAnalyser analyser = new CommunicationSeverityAnalyser(); analyser.evaluateCommunicationSummarySeverity(nodes); assertEquals(5, css1.getSeverity()); assertEquals(2, css2.getSeverity()); }