当前位置: 首页>>代码示例>>Java>>正文


Java SerializableTester.reserializeAndAssert方法代码示例

本文整理汇总了Java中com.google.common.testing.SerializableTester.reserializeAndAssert方法的典型用法代码示例。如果您正苦于以下问题:Java SerializableTester.reserializeAndAssert方法的具体用法?Java SerializableTester.reserializeAndAssert怎么用?Java SerializableTester.reserializeAndAssert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.testing.SerializableTester的用法示例。


在下文中一共展示了SerializableTester.reserializeAndAssert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serializable

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@Test
public void serializable() {
    JMSEndpoint expected = createEndpoint();

    JMSEndpoint actual = SerializableTester.reserializeAndAssert(expected);

    assertThat(actual.getHost(), is(expected.getHost()));
    assertThat(actual.getPort(), is(expected.getPort()));
}
 
开发者ID:florentw,项目名称:bench,代码行数:10,代码来源:JMSEndpointTest.java

示例2: testAsList

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
public void testAsList() {
  ImmutableSortedMultiset<String> multiset = ImmutableSortedMultiset.of("a", "a", "b", "b", "b");
  ImmutableList<String> list = multiset.asList();
  assertEquals(ImmutableList.of("a", "a", "b", "b", "b"), list);
  SerializableTester.reserializeAndAssert(list);
  assertEquals(2, list.indexOf("b"));
  assertEquals(4, list.lastIndexOf("b"));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:9,代码来源:ImmutableSortedMultisetTest.java

示例3: testSerializingUnmodifiableSynchronizedHashMultimap

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testSerializingUnmodifiableSynchronizedHashMultimap() {
  Multimap<String, Integer> unmodifiable =
      prepareUnmodifiableTests(Multimaps.synchronizedSetMultimap(
      HashMultimap.<String, Integer>create()), false, null, null);
  SerializableTester.reserializeAndAssert(unmodifiable);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:MultimapsTest.java

示例4: testIsNull_serialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testIsNull_serialization() {
  Predicate<String> pre = Predicates.isNull();
  Predicate<String> post = SerializableTester.reserializeAndAssert(pre);
  assertEquals(pre.apply("foo"), post.apply("foo"));
  assertEquals(pre.apply(null), post.apply(null));
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:PredicatesTest.java

示例5: testAsListReturnTypeAndSerialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester, ImmutableSortedAsList
public void testAsListReturnTypeAndSerialization() {
  ImmutableSet<String> set = ImmutableSortedSet.of("a", "e", "i", "o", "u");
  ImmutableList<String> list = set.asList();
  assertTrue(list instanceof ImmutableSortedAsList);
  ImmutableList<String> copy = SerializableTester.reserializeAndAssert(list);
  assertTrue(copy instanceof ImmutableSortedAsList);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:9,代码来源:ImmutableSortedSetTest.java

示例6: testExplicitEmpty_serialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testExplicitEmpty_serialization() {
  SortedSet<String> set = ImmutableSortedSet.orderedBy(STRING_LENGTH).build();
  SortedSet<String> copy = SerializableTester.reserializeAndAssert(set);
  assertTrue(set.isEmpty());
  assertTrue(copy.isEmpty());
  assertSame(set.comparator(), copy.comparator());
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:9,代码来源:ImmutableSortedSetTest.java

示例7: testNewSetMultimapSerialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testNewSetMultimapSerialization() {
  CountingSupplier<Set<Integer>> factory = new SetSupplier();
  Map<Color, Collection<Integer>> map = Maps.newHashMap();
  SetMultimap<Color, Integer> multimap = Multimaps.newSetMultimap(map, factory);
  multimap.putAll(Color.BLUE, asList(3, 1, 4));
  multimap.putAll(Color.RED, asList(2, 7, 1, 8));
  SerializableTester.reserializeAndAssert(multimap);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:10,代码来源:MultimapsTest.java

示例8: testNewListMultimapSerialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testNewListMultimapSerialization() {
  CountingSupplier<LinkedList<Integer>> factory = new ListSupplier();
  Map<Color, Collection<Integer>> map = Maps.newTreeMap();
  ListMultimap<Color, Integer> multimap = Multimaps.newListMultimap(map, factory);
  multimap.putAll(Color.BLUE, asList(3, 1, 4, 1));
  multimap.putAll(Color.RED, asList(2, 7, 1, 8));
  SerializableTester.reserializeAndAssert(multimap);
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:MultimapsTest.java

示例9: testSingle_serialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testSingle_serialization() {
  SortedSet<String> set = new SafeTreeSet<String>();
  set.add("e");
  SortedSet<String> copy = SerializableTester.reserializeAndAssert(set);
  assertEquals(set.comparator(), copy.comparator());
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:SafeTreeSetTest.java

示例10: testOr_serializationIterable

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
@SuppressWarnings("unchecked") // varargs
public void testOr_serializationIterable() {
  Predicate<Integer> pre = Predicates.or(Arrays.asList(TRUE, FALSE));
  Predicate<Integer> post = SerializableTester.reserializeAndAssert(pre);
  assertEquals(pre.apply(0), post.apply(0));
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:PredicatesTest.java

示例11: testSerialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testSerialization() {
  RangeSet<Integer> rangeSet = TreeRangeSet.create();
  rangeSet.add(Range.closed(3, 10));
  rangeSet.remove(Range.open(5, 7));
  SerializableTester.reserializeAndAssert(rangeSet);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:TreeRangeSetTest.java

示例12: testExplicitComparatorSerialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testExplicitComparatorSerialization() {
  TreeMultimap<String, Integer> multimap = createPopulate();
  TreeMultimap<String, Integer> copy
      = SerializableTester.reserializeAndAssert(multimap);
  assertThat(copy.values()).containsExactly(7, 3, 1, null, 0, 6, 2).inOrder();
  assertThat(copy.keySet()).containsExactly(null, "tree", "google").inOrder();
  assertEquals(multimap.keyComparator(), copy.keyComparator());
  assertEquals(multimap.valueComparator(), copy.valueComparator());
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:11,代码来源:TreeMultimapExplicitTest.java

示例13: testSerialization_multiple

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
public void testSerialization_multiple() {
  Collection<String> c = ImmutableSortedMultiset.of("a", "b", "a");
  Collection<String> copy = SerializableTester.reserializeAndAssert(c);
  assertThat(copy).containsExactly("a", "a", "b").inOrder();
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:6,代码来源:ImmutableSortedMultisetTest.java

示例14: testReserializeSubList

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@CollectionFeature.Require(SERIALIZABLE_INCLUDING_VIEWS)
@CollectionSize.Require(absent = {ZERO, ONE})
public void testReserializeSubList() {
  SerializableTester.reserializeAndAssert(getList().subList(0, 2));
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:6,代码来源:ListSubListTester.java

示例15: testOf_subSetSerialization

import com.google.common.testing.SerializableTester; //导入方法依赖的package包/类
@GwtIncompatible // SerializableTester
public void testOf_subSetSerialization() {
  SortedSet<String> set = of("e", "f", "b", "d", "c");
  SerializableTester.reserializeAndAssert(set.subSet("c", "e"));
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:6,代码来源:ImmutableSortedSetTest.java


注:本文中的com.google.common.testing.SerializableTester.reserializeAndAssert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。