Ejemplo n.º 1
0
  @Test
  public void testFirstOfType() {
    Collection<A> collection = new HashSet<A>();
    collection.add(new B());
    collection.add(new B());

    assertTrue(Groups.firstOfType(C.class, collection) == null);
    assertTrue(collection.contains(Groups.firstOfType(A.class, collection)));
    assertTrue(collection.contains(Groups.firstOfType(B.class, collection)));
  }
Ejemplo n.º 2
0
  @Test
  public void testFirstEmpty() {
    Collection<String> collection = new HashSet<String>();

    assertTrue(Groups.first(collection) == null);

    collection.add("Hello World");
    assertTrue(Groups.first(collection).equals("Hello World"));

    collection.add("Goodbye World");
    assertTrue(collection.contains(Groups.first(collection)));
  }