Package com.google.common.testing

Examples of com.google.common.testing.EqualsTester


    Table<String, Integer, Character> swapOuter
        = create("bar", 1, 'a', "foo", 1, 'b', "bar", 3, 'c');
    Table<String, Integer, Character> swapValues
        = create("foo", 1, 'c', "bar", 1, 'b', "foo", 3, 'a');

    new EqualsTester()
        .addEqualityGroup(table, reordered)
        .addEqualityGroup(hashCopy)
        .addEqualityGroup(smaller)
        .addEqualityGroup(swapOuter)
        .addEqualityGroup(swapValues)
View Full Code Here


    assertEquals(findClass(ClassPath.from(sub1).getTopLevelClasses(), ClassPathTest.class),
        findClass(ClassPath.from(sub2).getTopLevelClasses(), ClassPathTest.class));
  }

  public void testEquals() {
    new EqualsTester()
        .addEqualityGroup(classInfo(ClassPathTest.class), classInfo(ClassPathTest.class))
        .addEqualityGroup(classInfo(Test.class), classInfo(Test.class, getClass().getClassLoader()))
        .addEqualityGroup(
            new ResourceInfo("a/b/c.txt", getClass().getClassLoader()),
            new ResourceInfo("a/b/c.txt", getClass().getClassLoader()))
View Full Code Here

  public void testAlwaysTrue_apply() {
    assertEvalsToTrue(Predicates.alwaysTrue());
  }

  public void testAlwaysTrue_equality() throws Exception {
    new EqualsTester()
        .addEqualityGroup(TRUE, Predicates.alwaysTrue())
        .addEqualityGroup(isOdd())
        .addEqualityGroup(Predicates.alwaysFalse())
        .testEquals();
  }
View Full Code Here

  public void testAlwaysFalse_apply() throws Exception {
    assertEvalsToFalse(Predicates.alwaysFalse());
  }

  public void testAlwaysFalse_equality() throws Exception {
    new EqualsTester()
        .addEqualityGroup(FALSE, Predicates.alwaysFalse())
        .addEqualityGroup(isOdd())
        .addEqualityGroup(Predicates.alwaysTrue())
        .testEquals();
  }
View Full Code Here

    assertEvalsToFalse(Predicates.not(TRUE));
    assertEvalsLikeOdd(Predicates.not(Predicates.not(isOdd())));
  }

  public void testNot_equality() {
    new EqualsTester()
        .addEqualityGroup(Predicates.not(isOdd()), Predicates.not(isOdd()))
        .addEqualityGroup(Predicates.not(TRUE))
        .addEqualityGroup(isOdd())
        .testEquals();
  }
View Full Code Here

        .addEqualityGroup(isOdd())
        .testEquals();
  }

  public void testNot_equalityForNotOfKnownValues() {
    new EqualsTester()
        .addEqualityGroup(TRUE, Predicates.alwaysTrue())
        .addEqualityGroup(FALSE)
        .addEqualityGroup(Predicates.not(TRUE))
        .testEquals();

    new EqualsTester()
        .addEqualityGroup(FALSE, Predicates.alwaysFalse())
        .addEqualityGroup(TRUE)
        .addEqualityGroup(Predicates.not(FALSE))
        .testEquals();

    new EqualsTester()
        .addEqualityGroup(Predicates.isNull(), Predicates.isNull())
        .addEqualityGroup(Predicates.notNull())
        .addEqualityGroup(Predicates.not(Predicates.isNull()))
        .testEquals();

    new EqualsTester()
        .addEqualityGroup(Predicates.notNull(), Predicates.notNull())
        .addEqualityGroup(Predicates.isNull())
        .addEqualityGroup(Predicates.not(Predicates.notNull()))
        .testEquals();
  }
View Full Code Here

    assertEvalsToTrue(Predicates.and());
  }

  @SuppressWarnings("unchecked") // varargs
  public void testAnd_equalityNoArgs() {
    new EqualsTester()
        .addEqualityGroup(Predicates.and(), Predicates.and())
        .addEqualityGroup(Predicates.and(FALSE))
        .addEqualityGroup(Predicates.or())
        .testEquals();
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked") // varargs
  public void testAnd_equalityOneArg() {
    Object[] notEqualObjects = {Predicates.and(NEVER_REACHED, FALSE)};
    new EqualsTester()
        .addEqualityGroup(
            Predicates.and(NEVER_REACHED), Predicates.and(NEVER_REACHED))
        .addEqualityGroup(notEqualObjects)
        .addEqualityGroup(Predicates.and(isOdd()))
        .addEqualityGroup(Predicates.and())
View Full Code Here

    assertEvalsToFalse(Predicates.and(FALSE, NEVER_REACHED));
  }

  @SuppressWarnings("unchecked") // varargs
  public void testAnd_equalityBinary() {
    new EqualsTester()
        .addEqualityGroup(
            Predicates.and(TRUE, NEVER_REACHED),
            Predicates.and(TRUE, NEVER_REACHED))
        .addEqualityGroup(Predicates.and(NEVER_REACHED, TRUE))
        .addEqualityGroup(Predicates.and(TRUE))
View Full Code Here

    assertEvalsToFalse(Predicates.and(TRUE, FALSE, NEVER_REACHED));
  }

  @SuppressWarnings("unchecked") // varargs
  public void testAnd_equalityTernary() {
    new EqualsTester()
        .addEqualityGroup(
            Predicates.and(TRUE, isOdd(), NEVER_REACHED),
            Predicates.and(TRUE, isOdd(), NEVER_REACHED))
        .addEqualityGroup(Predicates.and(isOdd(), NEVER_REACHED, TRUE))
        .addEqualityGroup(Predicates.and(TRUE))
View Full Code Here

TOP

Related Classes of com.google.common.testing.EqualsTester

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.