Пример #1
0
  @Test
  public void testNotNull() throws Exception {
    Predicate<Object> notNull = Predicates.notNull();

    assertTrue(notNull.test("Hallo"));
    assertFalse(notNull.test(null));
  }
Пример #2
0
  @Test
  public void testIsNull() throws Exception {
    Predicate<Object> isNull = Predicates.isNull();

    assertTrue(isNull.test(null));
    assertFalse(isNull.test("test"));
  }
Пример #3
0
  @Test
  public void testAlwaysTrue() {
    Predicate<Object> alwaysTrue = Predicates.alwaysTrue();

    assertTrue(alwaysTrue.test(null));
    assertTrue(alwaysTrue.test("Hallo"));
    assertTrue(alwaysTrue.test(55l));
  }
Пример #4
0
  @Test
  public void testAlwaysFalse() {
    Predicate<Object> alwaysFalse = Predicates.alwaysFalse();

    assertFalse(alwaysFalse.test(null));
    assertFalse(alwaysFalse.test("FooBar"));
    assertFalse(alwaysFalse.test(66d));
  }