本文整理汇总了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()));
}
示例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"));
}
示例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);
}
示例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));
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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());
}
示例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));
}
示例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);
}
示例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());
}
示例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();
}
示例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));
}
示例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"));
}