NumberService extends AbstractService { @Override public void init() { largestValueMap.clear(); smallestValueMap.clear(); secondLargestValueMap.clear(); secondSmallestValueMap.clear(); } NumberService(DataSet dataset); void putAttributeValues(String column); boolean isLargestValue(Object var, String column); boolean isSmallestValue(Object var, String column); boolean isSecondLargestValue(Object var, String column); boolean isSecondSmallestValue(Object var, String column); @Override void init();  }
@Test public void testInit() { List<Column> columnList = generateColumnList(); DataSet dataSet = new DataSet(columnList); dataSet.initData(generateInputData()); NumberService ns = new NumberService(dataSet); ns.putAttributeValues("id1"); ns.putAttributeValues("id2"); ns.putAttributeValues("id3"); ns.putAttributeValues("id4"); Assert.assertEquals("longestValueMap size should be 4", 4, ns.largestValueMap.size()); Assert.assertEquals("secondLongestValueMap size should be 4", 4, ns.smallestValueMap.size()); Assert.assertEquals("secondShortestValueMap size should be 4", 4, ns.secondLargestValueMap.size()); Assert.assertEquals("shortestValueMap size should be 4", 4, ns.secondSmallestValueMap.size()); ns.init(); Assert.assertEquals("longestValueMap size should be 0", 0, ns.largestValueMap.size()); Assert.assertEquals("secondLongestValueMap size should be 0", 0, ns.smallestValueMap.size()); Assert.assertEquals("secondShortestValueMap size should be 0", 0, ns.secondLargestValueMap.size()); Assert.assertEquals("shortestValueMap size should be 0", 0, ns.secondSmallestValueMap.size()); }