### Question:
Size implements Function<A, Integer> { public Integer evaluate(Object obj) { Validate.notNull(obj, "Argument must not be null"); if (obj instanceof Collection<?>) { return evaluate((Collection<?>) obj); } if (obj instanceof String) { return evaluate((String) obj); } if (obj.getClass().isArray()) { return evaluateArray(obj); } throw new IllegalArgumentException("Expected Collection, String or Array, found " + obj); } Size(); Integer evaluate(Object obj); @Override boolean equals(Object that); @Override int hashCode(); @Override String toString(); static Size<Object> instance();  }### Answer:
@Test public void testEvaluate() throws Exception { assertEquals(Integer.valueOf(0), Size.instance().evaluate(Collections.EMPTY_LIST)); assertEquals(Integer.valueOf(0), Size.instance().evaluate(Collections.EMPTY_SET)); { List<Integer> list = new ArrayList<Integer>(); assertEquals(Integer.valueOf(0), Size.instance().evaluate(list)); for (int i = 0; i < 2; i++) { assertEquals(Integer.valueOf(i), Size.instance().evaluate(list)); list.add(Integer.valueOf(i)); assertEquals(Integer.valueOf(i + 1), Size.instance().evaluate(list)); } } { Set<Integer> set = new HashSet<Integer>(); assertEquals(Integer.valueOf(0), Size.instance().evaluate(set)); for (int i = 0; i < 2; i++) { assertEquals(Integer.valueOf(i), Size.instance().evaluate(set)); set.add(Integer.valueOf(i)); assertEquals(Integer.valueOf(i + 1), Size.instance().evaluate(set)); } } }