StringService extends AbstractService { @Override public void init() { longestValueMap.clear(); shortestValueMap.clear(); secondShortestValueMap.clear(); secondLongestValueMap.clear(); } StringService(DataSet dataset); void putAttributeValues(String column, boolean ignoreBlanks); boolean isLongestValue(Object var, String column, boolean ignoreBlanks); boolean isSecondLongestValue(Object var, String column, boolean ignoreBlanks); boolean isShortestValue(Object var, String column, boolean ignoreBlanks); boolean isSecondShortestValue(Object var, String column, boolean ignoreBlanks); @Override void init();  }
@Test public void testInit() { List<Column> columnList = generateColumnList(); DataSet dataSet = new DataSet(columnList); dataSet.initData(generateInputData()); StringService ss = new StringService(dataSet); ss.putAttributeValues("firstName", false); ss.putAttributeValues("lastName", false); Assert.assertEquals("longestValueMap size should be 2", 2, ss.longestValueMap.size()); Assert.assertEquals("secondLongestValueMap size should be 2", 2, ss.secondLongestValueMap.size()); Assert.assertEquals("secondShortestValueMap size should be 2", 2, ss.secondShortestValueMap.size()); Assert.assertEquals("shortestValueMap size should be 2", 2, ss.shortestValueMap.size()); ss.init(); Assert.assertEquals("longestValueMap size should be 0", 0, ss.longestValueMap.size()); Assert.assertEquals("secondLongestValueMap size should be 0", 0, ss.secondLongestValueMap.size()); Assert.assertEquals("secondShortestValueMap size should be 0", 0, ss.secondShortestValueMap.size()); Assert.assertEquals("shortestValueMap size should be 0", 0, ss.shortestValueMap.size()); }