NumberService extends AbstractService { public boolean isSmallestValue(Object var, String column) { if (smallestValueMap.get(column) == null) { putAttributeValues(column); } return smallestValueMap.get(column).equals(var); } 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 testIsSmallestValue() { 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()); Assert.assertEquals("The result of firstName column should be 1", 1, ns.smallestValueMap.get("id1")); Assert.assertEquals("The result of firstName column should be 1", 1, ns.smallestValueMap.get("id2")); Assert.assertEquals("The result of firstName column should be 1", 1, ns.smallestValueMap.get("id3")); Assert.assertEquals("The result of firstName column should be 3", 3, ns.smallestValueMap.get("id4")); ns.init(); }