Java 类com.google.common.collect.Ordering.IncomparableValueException 实例源码

项目:guava-mock    文件:OrderingTest.java   
public void testExplicit_two() {
  Comparator<Integer> c = Ordering.explicit(42, 5);
  assertEquals(0, c.compare(5, 5));
  assertTrue(c.compare(5, 42) > 0);
  assertTrue(c.compare(42, 5) < 0);
  try {
    c.compare(5, 666);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(666, expected.value);
  }
  new EqualsTester()
      .addEqualityGroup(c, Ordering.explicit(42, 5))
      .addEqualityGroup(Ordering.explicit(5, 42))
      .addEqualityGroup(Ordering.explicit(42))
      .testEquals();
  reserializeAndAssert(c);
}
项目:googles-monorepo-demo    文件:OrderingTest.java   
public void testExplicit_two() {
  Comparator<Integer> c = Ordering.explicit(42, 5);
  assertEquals(0, c.compare(5, 5));
  assertTrue(c.compare(5, 42) > 0);
  assertTrue(c.compare(42, 5) < 0);
  try {
    c.compare(5, 666);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(666, expected.value);
  }
  new EqualsTester()
      .addEqualityGroup(c, Ordering.explicit(42, 5))
      .addEqualityGroup(Ordering.explicit(5, 42))
      .addEqualityGroup(Ordering.explicit(42))
      .testEquals();
  reserializeAndAssert(c);
}
项目:guava-libraries    文件:OrderingTest.java   
public void testExplicit_two() {
  Comparator<Integer> c = Ordering.explicit(42, 5);
  assertEquals(0, c.compare(5, 5));
  assertTrue(c.compare(5, 42) > 0);
  assertTrue(c.compare(42, 5) < 0);
  try {
    c.compare(5, 666);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(666, expected.value);
  }
  new EqualsTester()
      .addEqualityGroup(c, Ordering.explicit(42, 5))
      .addEqualityGroup(Ordering.explicit(5, 42))
      .addEqualityGroup(Ordering.explicit(42))
      .testEquals();
  reserializeAndAssert(c);
}
项目:guava-libraries    文件:OrderingTest.java   
public void testExplicit_two() {
  Comparator<Integer> c = Ordering.explicit(42, 5);
  assertEquals(0, c.compare(5, 5));
  assertTrue(c.compare(5, 42) > 0);
  assertTrue(c.compare(42, 5) < 0);
  try {
    c.compare(5, 666);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(666, expected.value);
  }
  new EqualsTester()
      .addEqualityGroup(c, Ordering.explicit(42, 5))
      .addEqualityGroup(Ordering.explicit(5, 42))
      .addEqualityGroup(Ordering.explicit(42))
      .testEquals();
  reserializeAndAssert(c);
}
项目:guava    文件:OrderingTest.java   
public void testExplicit_two() {
  Comparator<Integer> c = Ordering.explicit(42, 5);
  assertEquals(0, c.compare(5, 5));
  assertTrue(c.compare(5, 42) > 0);
  assertTrue(c.compare(42, 5) < 0);
  try {
    c.compare(5, 666);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(666, expected.value);
  }
  new EqualsTester()
      .addEqualityGroup(c, Ordering.explicit(42, 5))
      .addEqualityGroup(Ordering.explicit(5, 42))
      .addEqualityGroup(Ordering.explicit(42))
      .testEquals();
  reserializeAndAssert(c);
}
项目:guava    文件:OrderingTest.java   
public void testExplicit_two() {
  Comparator<Integer> c = Ordering.explicit(42, 5);
  assertEquals(0, c.compare(5, 5));
  assertTrue(c.compare(5, 42) > 0);
  assertTrue(c.compare(42, 5) < 0);
  try {
    c.compare(5, 666);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(666, expected.value);
  }
  new EqualsTester()
      .addEqualityGroup(c, Ordering.explicit(42, 5))
      .addEqualityGroup(Ordering.explicit(5, 42))
      .addEqualityGroup(Ordering.explicit(42))
      .testEquals();
  reserializeAndAssert(c);
}
项目:guava-mock    文件:OrderingTest.java   
public void testExplicit_none() {
  Comparator<Integer> c
      = Ordering.explicit(Collections.<Integer>emptyList());
  try {
    c.compare(0, 0);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(0, expected.value);
  }
  reserializeAndAssert(c);
}
项目:guava-mock    文件:OrderingTest.java   
public void testExplicit_one() {
  Comparator<Integer> c = Ordering.explicit(0);
  assertEquals(0, c.compare(0, 0));
  try {
    c.compare(0, 1);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(1, expected.value);
  }
  reserializeAndAssert(c);
  assertEquals("Ordering.explicit([0])", c.toString());
}
项目:googles-monorepo-demo    文件:OrderingTest.java   
public void testExplicit_none() {
  Comparator<Integer> c
      = Ordering.explicit(Collections.<Integer>emptyList());
  try {
    c.compare(0, 0);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(0, expected.value);
  }
  reserializeAndAssert(c);
}
项目:googles-monorepo-demo    文件:OrderingTest.java   
public void testExplicit_one() {
  Comparator<Integer> c = Ordering.explicit(0);
  assertEquals(0, c.compare(0, 0));
  try {
    c.compare(0, 1);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(1, expected.value);
  }
  reserializeAndAssert(c);
  assertEquals("Ordering.explicit([0])", c.toString());
}
项目:guava-libraries    文件:OrderingTest.java   
public void testExplicit_none() {
  Comparator<Integer> c
      = Ordering.explicit(Collections.<Integer>emptyList());
  try {
    c.compare(0, 0);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(0, expected.value);
  }
  reserializeAndAssert(c);
}
项目:guava-libraries    文件:OrderingTest.java   
public void testExplicit_one() {
  Comparator<Integer> c = Ordering.explicit(0);
  assertEquals(0, c.compare(0, 0));
  try {
    c.compare(0, 1);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(1, expected.value);
  }
  reserializeAndAssert(c);
  assertEquals("Ordering.explicit([0])", c.toString());
}
项目:guava-libraries    文件:OrderingTest.java   
public void testExplicit_none() {
  Comparator<Integer> c
      = Ordering.explicit(Collections.<Integer>emptyList());
  try {
    c.compare(0, 0);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(0, expected.value);
  }
  reserializeAndAssert(c);
}
项目:guava-libraries    文件:OrderingTest.java   
public void testExplicit_one() {
  Comparator<Integer> c = Ordering.explicit(0);
  assertEquals(0, c.compare(0, 0));
  try {
    c.compare(0, 1);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(1, expected.value);
  }
  reserializeAndAssert(c);
  assertEquals("Ordering.explicit([0])", c.toString());
}
项目:guava    文件:OrderingTest.java   
public void testExplicit_none() {
  Comparator<Integer> c = Ordering.explicit(Collections.<Integer>emptyList());
  try {
    c.compare(0, 0);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(0, expected.value);
  }
  reserializeAndAssert(c);
}
项目:guava    文件:OrderingTest.java   
public void testExplicit_one() {
  Comparator<Integer> c = Ordering.explicit(0);
  assertEquals(0, c.compare(0, 0));
  try {
    c.compare(0, 1);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(1, expected.value);
  }
  reserializeAndAssert(c);
  assertEquals("Ordering.explicit([0])", c.toString());
}
项目:guava    文件:OrderingTest.java   
public void testExplicit_none() {
  Comparator<Integer> c = Ordering.explicit(Collections.<Integer>emptyList());
  try {
    c.compare(0, 0);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(0, expected.value);
  }
  reserializeAndAssert(c);
}
项目:guava    文件:OrderingTest.java   
public void testExplicit_one() {
  Comparator<Integer> c = Ordering.explicit(0);
  assertEquals(0, c.compare(0, 0));
  try {
    c.compare(0, 1);
    fail();
  } catch (IncomparableValueException expected) {
    assertEquals(1, expected.value);
  }
  reserializeAndAssert(c);
  assertEquals("Ordering.explicit([0])", c.toString());
}