StringService extends AbstractService { public boolean isSecondLongestValue(Object var, String column, boolean ignoreBlanks) { if (secondLongestValueMap.get(column) == null || secondLongestValueMap.get(column).size() == 0) { if (longestValueMap.get(column) == null) { putAttributeValues(column, ignoreBlanks); } else { return longestValueMap.get(column).contains(var); } } return secondLongestValueMap.get(column).contains(var); } 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 testIsSecondLongestValue() { 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("Ashley should be second longtest value on the column firstName", true, ss.isSecondLongestValue("Ashley", "firstName", false)); Assert.assertEquals("cook should be second longtest value on the column lastName", true, ss.isSecondLongestValue("cook", "lastName", false)); Assert.assertEquals("1111 should not be second longtest value on the column lastName", false, ss.isSecondLongestValue("1111", "lastName", false)); ss.init(); }