LTFilter extends ArithmeticFilter { @SuppressWarnings({"rawtypes", "unchecked"}) public List<Object> filter(final List<Object> objects) { final List<Object> result = new ArrayList<Object>(objects.size()); for (Object object : objects) { final Comparable objectValue = (Comparable) getAttributeValue(object); if (objectValue.compareTo(value) < 0) { result.add(object); } } return result; } LTFilter(String attributeName, Object value); @SuppressWarnings({"rawtypes", "unchecked"}) List<Object> filter(final List<Object> objects);  }
@Test public void filter() { List<Object> objects = new ArrayList<Object>(); objects.add(comparable); objects.add(comparable); doReturn(0).doReturn(-1).when(comparable).compareTo(any()); doReturn(comparable).when(ltFilter).getAttributeValue(comparable); List<Object> actualObjects = ltFilter.filter(objects); assertEquals(comparable, actualObjects.get(0)); }