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

项目:guava-mock    文件:MultimapsTest.java   
/**
 * The supplied multimap will be mutated and an unmodifiable instance used
 * in its stead. If the multimap does not support null keys or values,
 * alternatives may be specified for tests involving nulls.
 */
private static void checkUnmodifiableMultimap(
    Multimap<String, Integer> multimap, boolean permitsDuplicates,
    @Nullable String nullKey, @Nullable Integer nullValue) {
  Multimap<String, Integer> unmodifiable =
      prepareUnmodifiableTests(multimap, permitsDuplicates, nullKey, nullValue);

  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      unmodifiable, "test", 123);

  assertUnmodifiableIterableInTandem(
      unmodifiable.keys(), multimap.keys());

  assertUnmodifiableIterableInTandem(
      unmodifiable.keySet(), multimap.keySet());

  assertUnmodifiableIterableInTandem(
      unmodifiable.entries(), multimap.entries());

  assertUnmodifiableIterableInTandem(
      unmodifiable.asMap().entrySet(), multimap.asMap().entrySet());

  assertEquals(multimap.toString(), unmodifiable.toString());
  assertEquals(multimap.hashCode(), unmodifiable.hashCode());
  assertEquals(multimap, unmodifiable);

  assertThat(unmodifiable.asMap().get("bar")).containsExactly(5, -1);
  assertNull(unmodifiable.asMap().get("missing"));

  assertFalse(unmodifiable.entries() instanceof Serializable);
}
项目:guava-mock    文件:MultimapsTest.java   
private static <T> void assertUnmodifiableIterableInTandem(
    Iterable<T> unmodifiable, Iterable<T> modifiable) {
  UnmodifiableCollectionTests.assertIteratorIsUnmodifiable(
      unmodifiable.iterator());
  UnmodifiableCollectionTests.assertIteratorsInOrder(
      unmodifiable.iterator(), modifiable.iterator());
}
项目:googles-monorepo-demo    文件:MultimapsTest.java   
/**
 * The supplied multimap will be mutated and an unmodifiable instance used
 * in its stead. If the multimap does not support null keys or values,
 * alternatives may be specified for tests involving nulls.
 */
private static void checkUnmodifiableMultimap(
    Multimap<String, Integer> multimap, boolean permitsDuplicates,
    @Nullable String nullKey, @Nullable Integer nullValue) {
  Multimap<String, Integer> unmodifiable =
      prepareUnmodifiableTests(multimap, permitsDuplicates, nullKey, nullValue);

  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      unmodifiable, "test", 123);

  assertUnmodifiableIterableInTandem(
      unmodifiable.keys(), multimap.keys());

  assertUnmodifiableIterableInTandem(
      unmodifiable.keySet(), multimap.keySet());

  assertUnmodifiableIterableInTandem(
      unmodifiable.entries(), multimap.entries());

  assertUnmodifiableIterableInTandem(
      unmodifiable.asMap().entrySet(), multimap.asMap().entrySet());

  assertEquals(multimap.toString(), unmodifiable.toString());
  assertEquals(multimap.hashCode(), unmodifiable.hashCode());
  assertEquals(multimap, unmodifiable);

  assertThat(unmodifiable.asMap().get("bar")).containsExactly(5, -1);
  assertNull(unmodifiable.asMap().get("missing"));

  assertFalse(unmodifiable.entries() instanceof Serializable);
}
项目:googles-monorepo-demo    文件:MultimapsTest.java   
private static <T> void assertUnmodifiableIterableInTandem(
    Iterable<T> unmodifiable, Iterable<T> modifiable) {
  UnmodifiableCollectionTests.assertIteratorIsUnmodifiable(
      unmodifiable.iterator());
  UnmodifiableCollectionTests.assertIteratorsInOrder(
      unmodifiable.iterator(), modifiable.iterator());
}
项目:guava-libraries    文件:MultimapsTest.java   
/**
 * The supplied multimap will be mutated and an unmodifiable instance used
 * in its stead. If the multimap does not support null keys or values,
 * alternatives may be specified for tests involving nulls.
 */
private static void checkUnmodifiableMultimap(
    Multimap<String, Integer> multimap, boolean permitsDuplicates,
    @Nullable String nullKey, @Nullable Integer nullValue) {
  Multimap<String, Integer> unmodifiable =
      prepareUnmodifiableTests(multimap, permitsDuplicates, nullKey, nullValue);

  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      unmodifiable, "test", 123);

  assertUnmodifiableIterableInTandem(
      unmodifiable.keys(), multimap.keys());

  assertUnmodifiableIterableInTandem(
      unmodifiable.keySet(), multimap.keySet());

  assertUnmodifiableIterableInTandem(
      unmodifiable.entries(), multimap.entries());

  assertUnmodifiableIterableInTandem(
      unmodifiable.asMap().entrySet(), multimap.asMap().entrySet());

  assertEquals(multimap.toString(), unmodifiable.toString());
  assertEquals(multimap.hashCode(), unmodifiable.hashCode());
  assertEquals(multimap, unmodifiable);

  assertThat(unmodifiable.asMap().get("bar")).containsExactly(5, -1);
  assertNull(unmodifiable.asMap().get("missing"));

  assertFalse(unmodifiable.entries() instanceof Serializable);
}
项目:guava-libraries    文件:MultimapsTest.java   
private static <T> void assertUnmodifiableIterableInTandem(
    Iterable<T> unmodifiable, Iterable<T> modifiable) {
  UnmodifiableCollectionTests.assertIteratorIsUnmodifiable(
      unmodifiable.iterator());
  UnmodifiableCollectionTests.assertIteratorsInOrder(
      unmodifiable.iterator(), modifiable.iterator());
}
项目:guava-libraries    文件:MultimapsTest.java   
/**
 * The supplied multimap will be mutated and an unmodifiable instance used
 * in its stead. If the multimap does not support null keys or values,
 * alternatives may be specified for tests involving nulls.
 */
private static void checkUnmodifiableMultimap(
    Multimap<String, Integer> multimap, boolean permitsDuplicates,
    @Nullable String nullKey, @Nullable Integer nullValue) {
  Multimap<String, Integer> unmodifiable =
      prepareUnmodifiableTests(multimap, permitsDuplicates, nullKey, nullValue);

  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      unmodifiable, "test", 123);

  assertUnmodifiableIterableInTandem(
      unmodifiable.keys(), multimap.keys());

  assertUnmodifiableIterableInTandem(
      unmodifiable.keySet(), multimap.keySet());

  assertUnmodifiableIterableInTandem(
      unmodifiable.entries(), multimap.entries());

  assertUnmodifiableIterableInTandem(
      unmodifiable.asMap().entrySet(), multimap.asMap().entrySet());

  assertEquals(multimap.toString(), unmodifiable.toString());
  assertEquals(multimap.hashCode(), unmodifiable.hashCode());
  assertEquals(multimap, unmodifiable);

  assertThat(unmodifiable.asMap().get("bar")).containsExactly(5, -1);
  assertNull(unmodifiable.asMap().get("missing"));

  assertFalse(unmodifiable.entries() instanceof Serializable);
}
项目:guava-libraries    文件:MultimapsTest.java   
private static <T> void assertUnmodifiableIterableInTandem(
    Iterable<T> unmodifiable, Iterable<T> modifiable) {
  UnmodifiableCollectionTests.assertIteratorIsUnmodifiable(
      unmodifiable.iterator());
  UnmodifiableCollectionTests.assertIteratorsInOrder(
      unmodifiable.iterator(), modifiable.iterator());
}
项目:guava    文件:MultimapsTest.java   
/**
 * The supplied multimap will be mutated and an unmodifiable instance used in its stead. If the
 * multimap does not support null keys or values, alternatives may be specified for tests
 * involving nulls.
 */
private static void checkUnmodifiableMultimap(
    Multimap<String, Integer> multimap,
    boolean permitsDuplicates,
    @NullableDecl String nullKey,
    @NullableDecl Integer nullValue) {
  Multimap<String, Integer> unmodifiable =
      prepareUnmodifiableTests(multimap, permitsDuplicates, nullKey, nullValue);

  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(unmodifiable, "test", 123);

  assertUnmodifiableIterableInTandem(unmodifiable.keys(), multimap.keys());

  assertUnmodifiableIterableInTandem(unmodifiable.keySet(), multimap.keySet());

  assertUnmodifiableIterableInTandem(unmodifiable.entries(), multimap.entries());

  assertUnmodifiableIterableInTandem(
      unmodifiable.asMap().entrySet(), multimap.asMap().entrySet());

  assertEquals(multimap.toString(), unmodifiable.toString());
  assertEquals(multimap.hashCode(), unmodifiable.hashCode());
  assertEquals(multimap, unmodifiable);

  assertThat(unmodifiable.asMap().get("bar")).containsExactly(5, -1);
  assertNull(unmodifiable.asMap().get("missing"));

  assertFalse(unmodifiable.entries() instanceof Serializable);
}
项目:guava    文件:MultimapsTest.java   
/**
 * The supplied multimap will be mutated and an unmodifiable instance used in its stead. If the
 * multimap does not support null keys or values, alternatives may be specified for tests
 * involving nulls.
 */
private static void checkUnmodifiableMultimap(
    Multimap<String, Integer> multimap,
    boolean permitsDuplicates,
    @NullableDecl String nullKey,
    @NullableDecl Integer nullValue) {
  Multimap<String, Integer> unmodifiable =
      prepareUnmodifiableTests(multimap, permitsDuplicates, nullKey, nullValue);

  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(unmodifiable, "test", 123);

  assertUnmodifiableIterableInTandem(unmodifiable.keys(), multimap.keys());

  assertUnmodifiableIterableInTandem(unmodifiable.keySet(), multimap.keySet());

  assertUnmodifiableIterableInTandem(unmodifiable.entries(), multimap.entries());

  assertUnmodifiableIterableInTandem(
      unmodifiable.asMap().entrySet(), multimap.asMap().entrySet());

  assertEquals(multimap.toString(), unmodifiable.toString());
  assertEquals(multimap.hashCode(), unmodifiable.hashCode());
  assertEquals(multimap, unmodifiable);

  assertThat(unmodifiable.asMap().get("bar")).containsExactly(5, -1);
  assertNull(unmodifiable.asMap().get("missing"));

  assertFalse(unmodifiable.entries() instanceof Serializable);
}
项目:guava-mock    文件:ImmutableMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:guava-mock    文件:ImmutableListMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableListMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "foo", 1);
}
项目:guava-mock    文件:ImmutableListMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "bar", 2);
}
项目:guava-mock    文件:ImmutableSetMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableSetMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "foo", 1);
}
项目:guava-mock    文件:ImmutableSetMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "bar", 2);
}
项目:guava-mock    文件:ImmutableSortedMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:googles-monorepo-demo    文件:ImmutableMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:googles-monorepo-demo    文件:ImmutableListMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableListMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "foo", 1);
}
项目:googles-monorepo-demo    文件:ImmutableListMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "bar", 2);
}
项目:googles-monorepo-demo    文件:ImmutableSetMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableSetMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "foo", 1);
}
项目:googles-monorepo-demo    文件:ImmutableSetMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "bar", 2);
}
项目:googles-monorepo-demo    文件:ImmutableSortedMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:guava-libraries    文件:ImmutableMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:guava-libraries    文件:ImmutableListMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableListMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "foo", 1);
}
项目:guava-libraries    文件:ImmutableListMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "bar", 2);
}
项目:guava-libraries    文件:ImmutableSetMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableSetMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "foo", 1);
}
项目:guava-libraries    文件:ImmutableSetMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "bar", 2);
}
项目:guava-libraries    文件:ImmutableMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:guava-libraries    文件:ImmutableListMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableListMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "foo", 1);
}
项目:guava-libraries    文件:ImmutableListMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "bar", 2);
}
项目:guava-libraries    文件:ImmutableSetMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableSetMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "foo", 1);
}
项目:guava-libraries    文件:ImmutableSetMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(
      multimap, "bar", 2);
}
项目:guava-libraries    文件:ImmutableSortedMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:guava    文件:ImmutableMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:guava    文件:ImmutableListMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableListMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(multimap, "foo", 1);
}
项目:guava    文件:ImmutableListMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(multimap, "bar", 2);
}
项目:guava    文件:ImmutableSetMultimapTest.java   
public void testEmptyMultimapWrites() {
  Multimap<String, Integer> multimap = ImmutableSetMultimap.of();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(multimap, "foo", 1);
}
项目:guava    文件:ImmutableSetMultimapTest.java   
public void testMultimapWrites() {
  Multimap<String, Integer> multimap = createMultimap();
  UnmodifiableCollectionTests.assertMultimapIsUnmodifiable(multimap, "bar", 2);
}
项目:guava    文件:ImmutableSortedMultisetTest.java   
public void testMultisetWrites() {
  Multiset<String> multiset = ImmutableSortedMultiset.of("a", "b", "a");
  UnmodifiableCollectionTests.assertMultisetIsUnmodifiable(multiset, "test");
}
项目:guava    文件:MultimapsTest.java   
private static <T> void assertUnmodifiableIterableInTandem(
    Iterable<T> unmodifiable, Iterable<T> modifiable) {
  UnmodifiableCollectionTests.assertIteratorIsUnmodifiable(unmodifiable.iterator());
  UnmodifiableCollectionTests.assertIteratorsInOrder(
      unmodifiable.iterator(), modifiable.iterator());
}