Java 类com.google.common.collect.testing.DerivedComparable 实例源码

项目:guava-mock    文件:TreeMultimapNaturalTest.java   
@GwtIncompatible // SerializableTester
public void testTreeMultimapDerived() {
  TreeMultimap<DerivedComparable, DerivedComparable> multimap = TreeMultimap.create();
  assertEquals(ImmutableMultimap.of(), multimap);
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("f"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("b"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("a"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("r"));
  assertThat(multimap.keySet()).containsExactly(
      new DerivedComparable("bar"), new DerivedComparable("foo")).inOrder();
  assertThat(multimap.values()).containsExactly(
      new DerivedComparable("a"), new DerivedComparable("b"), new DerivedComparable("r"),
      new DerivedComparable("f"), new DerivedComparable("o")).inOrder();
  assertEquals(Ordering.natural(), multimap.keyComparator());
  assertEquals(Ordering.natural(), multimap.valueComparator());
  SerializableTester.reserializeAndAssert(multimap);
}
项目:googles-monorepo-demo    文件:TreeMultimapNaturalTest.java   
@GwtIncompatible // SerializableTester
public void testTreeMultimapDerived() {
  TreeMultimap<DerivedComparable, DerivedComparable> multimap = TreeMultimap.create();
  assertEquals(ImmutableMultimap.of(), multimap);
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("f"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("b"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("a"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("r"));
  assertThat(multimap.keySet()).containsExactly(
      new DerivedComparable("bar"), new DerivedComparable("foo")).inOrder();
  assertThat(multimap.values()).containsExactly(
      new DerivedComparable("a"), new DerivedComparable("b"), new DerivedComparable("r"),
      new DerivedComparable("f"), new DerivedComparable("o")).inOrder();
  assertEquals(Ordering.natural(), multimap.keyComparator());
  assertEquals(Ordering.natural(), multimap.valueComparator());
  SerializableTester.reserializeAndAssert(multimap);
}
项目:guava-libraries    文件:TreeMultimapNaturalTest.java   
@GwtIncompatible("SerializableTester")
public void testTreeMultimapDerived() {
  TreeMultimap<DerivedComparable, DerivedComparable> multimap = TreeMultimap.create();
  assertEquals(ImmutableMultimap.of(), multimap);
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("f"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("b"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("a"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("r"));
  assertThat(multimap.keySet()).containsExactly(
      new DerivedComparable("bar"), new DerivedComparable("foo")).inOrder();
  assertThat(multimap.values()).containsExactly(
      new DerivedComparable("a"), new DerivedComparable("b"), new DerivedComparable("r"),
      new DerivedComparable("f"), new DerivedComparable("o")).inOrder();
  assertEquals(Ordering.natural(), multimap.keyComparator());
  assertEquals(Ordering.natural(), multimap.valueComparator());
  SerializableTester.reserializeAndAssert(multimap);
}
项目:guava    文件:TreeMultimapNaturalTest.java   
@GwtIncompatible // SerializableTester
public void testTreeMultimapDerived() {
  TreeMultimap<DerivedComparable, DerivedComparable> multimap = TreeMultimap.create();
  assertEquals(ImmutableMultimap.of(), multimap);
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("f"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("b"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("a"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("r"));
  assertThat(multimap.keySet())
      .containsExactly(new DerivedComparable("bar"), new DerivedComparable("foo"))
      .inOrder();
  assertThat(multimap.values())
      .containsExactly(
          new DerivedComparable("a"),
          new DerivedComparable("b"),
          new DerivedComparable("r"),
          new DerivedComparable("f"),
          new DerivedComparable("o"))
      .inOrder();
  assertEquals(Ordering.natural(), multimap.keyComparator());
  assertEquals(Ordering.natural(), multimap.valueComparator());
  SerializableTester.reserializeAndAssert(multimap);
}
项目:guava    文件:TreeMultimapNaturalTest.java   
@GwtIncompatible // SerializableTester
public void testTreeMultimapDerived() {
  TreeMultimap<DerivedComparable, DerivedComparable> multimap = TreeMultimap.create();
  assertEquals(ImmutableMultimap.of(), multimap);
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("f"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("foo"), new DerivedComparable("o"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("b"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("a"));
  multimap.put(new DerivedComparable("bar"), new DerivedComparable("r"));
  assertThat(multimap.keySet())
      .containsExactly(new DerivedComparable("bar"), new DerivedComparable("foo"))
      .inOrder();
  assertThat(multimap.values())
      .containsExactly(
          new DerivedComparable("a"),
          new DerivedComparable("b"),
          new DerivedComparable("r"),
          new DerivedComparable("f"),
          new DerivedComparable("o"))
      .inOrder();
  assertEquals(Ordering.natural(), multimap.keyComparator());
  assertEquals(Ordering.natural(), multimap.valueComparator());
  SerializableTester.reserializeAndAssert(multimap);
}
项目:guava-mock    文件:MultisetsTest.java   
public void testNewTreeMultisetDerived() {
  TreeMultiset<DerivedComparable> set = TreeMultiset.create();
  assertTrue(set.isEmpty());
  set.add(new DerivedComparable("foo"), 2);
  set.add(new DerivedComparable("bar"), 3);
  assertThat(set).containsExactly(
      new DerivedComparable("bar"), new DerivedComparable("bar"), new DerivedComparable("bar"),
      new DerivedComparable("foo"), new DerivedComparable("foo")).inOrder();
}
项目:googles-monorepo-demo    文件:MultisetsTest.java   
public void testNewTreeMultisetDerived() {
  TreeMultiset<DerivedComparable> set = TreeMultiset.create();
  assertTrue(set.isEmpty());
  set.add(new DerivedComparable("foo"), 2);
  set.add(new DerivedComparable("bar"), 3);
  assertThat(set).containsExactly(
      new DerivedComparable("bar"), new DerivedComparable("bar"), new DerivedComparable("bar"),
      new DerivedComparable("foo"), new DerivedComparable("foo")).inOrder();
}
项目:guava-libraries    文件:MultisetsTest.java   
public void testNewTreeMultisetDerived() {
  TreeMultiset<DerivedComparable> set = TreeMultiset.create();
  assertTrue(set.isEmpty());
  set.add(new DerivedComparable("foo"), 2);
  set.add(new DerivedComparable("bar"), 3);
  assertThat(set).containsExactly(
      new DerivedComparable("bar"), new DerivedComparable("bar"), new DerivedComparable("bar"),
      new DerivedComparable("foo"), new DerivedComparable("foo")).inOrder();
}
项目:guava-libraries    文件:MultisetsTest.java   
public void testNewTreeMultisetDerived() {
  TreeMultiset<DerivedComparable> set = TreeMultiset.create();
  assertTrue(set.isEmpty());
  set.add(new DerivedComparable("foo"), 2);
  set.add(new DerivedComparable("bar"), 3);
  assertThat(set).containsExactly(
      new DerivedComparable("bar"), new DerivedComparable("bar"), new DerivedComparable("bar"),
      new DerivedComparable("foo"), new DerivedComparable("foo")).inOrder();
}
项目:guava    文件:MultisetsTest.java   
public void testNewTreeMultisetDerived() {
  TreeMultiset<DerivedComparable> set = TreeMultiset.create();
  assertTrue(set.isEmpty());
  set.add(new DerivedComparable("foo"), 2);
  set.add(new DerivedComparable("bar"), 3);
  assertThat(set)
      .containsExactly(
          new DerivedComparable("bar"),
          new DerivedComparable("bar"),
          new DerivedComparable("bar"),
          new DerivedComparable("foo"),
          new DerivedComparable("foo"))
      .inOrder();
}
项目:guava    文件:MultisetsTest.java   
public void testNewTreeMultisetDerived() {
  TreeMultiset<DerivedComparable> set = TreeMultiset.create();
  assertTrue(set.isEmpty());
  set.add(new DerivedComparable("foo"), 2);
  set.add(new DerivedComparable("bar"), 3);
  assertThat(set)
      .containsExactly(
          new DerivedComparable("bar"),
          new DerivedComparable("bar"),
          new DerivedComparable("bar"),
          new DerivedComparable("foo"),
          new DerivedComparable("foo"))
      .inOrder();
}