TimeService extends AbstractService { @Override public void init() { latestValueMap.clear(); earliestValueMap.clear(); secondLatestValueMap.clear(); secondEarliestValueMap.clear(); } TimeService(DataSet dataset); void putAttributeValues(String column); boolean isLatestValue(Object var, String column); boolean isSecondEarliestValue(Object var, String column); boolean isSecondLatestValue(Object var, String column); boolean isEarliestValue(Object var, String column); @Override void init();  }
@Test public void testInit() { List<Column> columnList = generateColumnList(); DataSet dataSet = new DataSet(columnList); dataSet.initData(generateInputData()); TimeService ts = new TimeService(dataSet); ts.putAttributeValues("date1"); ts.putAttributeValues("date2"); ts.putAttributeValues("date3"); ts.putAttributeValues("date4"); Assert.assertEquals("longestValueMap size should be 4", 4, ts.earliestValueMap.size()); Assert.assertEquals("secondLongestValueMap size should be 4", 4, ts.latestValueMap.size()); Assert.assertEquals("secondShortestValueMap size should be 4", 4, ts.secondEarliestValueMap.size()); Assert.assertEquals("shortestValueMap size should be 4", 4, ts.secondLatestValueMap.size()); ts.init(); Assert.assertEquals("longestValueMap size should be 0", 0, ts.earliestValueMap.size()); Assert.assertEquals("secondLongestValueMap size should be 0", 0, ts.latestValueMap.size()); Assert.assertEquals("secondShortestValueMap size should be 0", 0, ts.secondEarliestValueMap.size()); Assert.assertEquals("shortestValueMap size should be 0", 0, ts.secondLatestValueMap.size()); }