本文整理汇总了Java中com.google.common.collect.testing.MinimalCollection类的典型用法代码示例。如果您正苦于以下问题:Java MinimalCollection类的具体用法?Java MinimalCollection怎么用?Java MinimalCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MinimalCollection类属于com.google.common.collect.testing包,在下文中一共展示了MinimalCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
empty = new Target(emptyCollection(), "empty");
/*
* We test that nullSingleton.retainAll(disjointList) does NOT throw a
* NullPointerException when disjointList does not, so we can't use
* MinimalCollection, which throws NullPointerException on calls to
* contains(null).
*/
List<E> disjointList = Arrays.asList(e3(), e4());
disjoint = new Target(disjointList, "disjoint");
superset = new Target(MinimalCollection.of(e0(), e1(), e2(), e3(), e4()), "superset");
nonEmptyProperSubset = new Target(MinimalCollection.of(e1()), "subset");
sameElements = new Target(Arrays.asList(createSamplesArray()), "sameElements");
containsDuplicates =
new Target(MinimalCollection.of(e0(), e0(), e3(), e3()), "containsDuplicates");
partialOverlap = new Target(MinimalCollection.of(e2(), e3()), "partialOverlap");
nullSingleton = new Target(Collections.<E>singleton(null), "nullSingleton");
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:22,代码来源:CollectionRetainAllTester.java
示例2: testAddAllAtIndex_unsupportedAllPresent
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@ListFeature.Require(absent = SUPPORTS_ADD_WITH_INDEX)
@CollectionSize.Require(absent = ZERO)
public void testAddAllAtIndex_unsupportedAllPresent() {
try {
getList().addAll(0, MinimalCollection.of(e0()));
fail("addAll(n, allPresent) should throw");
} catch (UnsupportedOperationException expected) {
}
expectUnchanged();
}
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:11,代码来源:ListAddAllAtIndexTester.java
示例3: testAddAllAtIndex_supportedSomePresent
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
@CollectionSize.Require(absent = ZERO)
public void testAddAllAtIndex_supportedSomePresent() {
assertTrue(
"addAll(n, allPresent) should return true",
getList().addAll(0, MinimalCollection.of(e0(), e3())));
expectAdded(0, e0(), e3());
}
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:9,代码来源:ListAddAllAtIndexTester.java
示例4: testContainsAll_nullNotAllowed
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(absent = ALLOWS_NULL_QUERIES)
public void testContainsAll_nullNotAllowed() {
try {
assertFalse(collection.containsAll(MinimalCollection.of((E) null)));
} catch (NullPointerException tolerated) {
}
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:CollectionContainsAllTester.java
示例5: testCopyOf_collectionContainingNull
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
public void testCopyOf_collectionContainingNull() {
Collection<String> c = MinimalCollection.of("a", null, "b");
try {
ImmutableList.copyOf(c);
fail();
} catch (NullPointerException expected) {
}
}
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:9,代码来源:ImmutableListTest.java
示例6: testCopyOf_collection_general
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
public void testCopyOf_collection_general() {
Collection<String> c = MinimalCollection.of("a", "b", "a");
Set<String> set = copyOf(c);
assertEquals(2, set.size());
assertTrue(set.contains("a"));
assertTrue(set.contains("b"));
}
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:AbstractImmutableSetTest.java
示例7: testRemoveAll_duplicate
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = {ZERO, ONE})
public void testRemoveAll_duplicate() {
ArrayWithDuplicate<E> arrayAndDuplicate = createArrayWithDuplicateElement();
collection = getSubjectGenerator().create(arrayAndDuplicate.elements);
E duplicate = arrayAndDuplicate.duplicate;
assertTrue(
"removeAll(intersectingCollection) should return true",
getList().removeAll(MinimalCollection.of(duplicate)));
assertFalse(
"after removeAll(e), a collection should not contain e even "
+ "if it initially contained e more than once.",
getList().contains(duplicate));
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:16,代码来源:ListRemoveAllTester.java
示例8: testRemoveAll_emptyCollection
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAll_emptyCollection() {
assertFalse(
"removeAll(emptyCollection) should return false",
collection.removeAll(MinimalCollection.of()));
expectUnchanged();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:CollectionRemoveAllTester.java
示例9: testRetainAll_duplicatesRemoved
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@CollectionFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(SEVERAL)
public void testRetainAll_duplicatesRemoved() {
E[] array = createSamplesArray();
array[1] = e0();
collection = getSubjectGenerator().create(array);
assertTrue(
"containsDuplicates.retainAll(subset) should return true",
collection.retainAll(MinimalCollection.of(e2())));
expectContents(e2());
}
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:13,代码来源:ListRetainAllTester.java
示例10: testRemoveAll_allPresent
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveAll_allPresent() {
assertTrue(
"removeAll(intersectingCollection) should return true",
collection.removeAll(MinimalCollection.of(e0())));
expectMissing(e0());
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:9,代码来源:CollectionRemoveAllTester.java
示例11: testRemoveAllSomePresentConcurrentWithIteration
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
@CollectionSize.Require(SEVERAL)
public void testRemoveAllSomePresentConcurrentWithIteration() {
try {
Iterator<E> iterator = collection.iterator();
assertTrue(collection.removeAll(MinimalCollection.of(e0(), e3())));
iterator.next();
fail("Expected ConcurrentModificationException");
} catch (ConcurrentModificationException expected) {
// success
}
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:13,代码来源:CollectionRemoveAllTester.java
示例12: testRemoveAll_somePresentLargeCollectionToRemove
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
/** Trigger the {@code other.size() >= this.size()} case in {@link AbstractSet#removeAll()}. */
@CollectionFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveAll_somePresentLargeCollectionToRemove() {
assertTrue(
"removeAll(largeIntersectingCollection) should return true",
collection.removeAll(MinimalCollection.of(e0(), e0(), e0(), e3(), e3(), e3())));
expectMissing(e0());
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:10,代码来源:CollectionRemoveAllTester.java
示例13: testAddAllAtIndex_negative
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
public void testAddAllAtIndex_negative() {
try {
getList().addAll(-1, MinimalCollection.of(e3()));
fail("addAll(-1, e) should throw");
} catch (IndexOutOfBoundsException expected) {
}
expectUnchanged();
expectMissing(e3());
}
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:11,代码来源:ListAddAllAtIndexTester.java
示例14: testRemoveAll_unsupportedNonePresent
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
public void testRemoveAll_unsupportedNonePresent() {
try {
assertFalse(
"removeAll(disjointCollection) should return false or throw "
+ "UnsupportedOperationException",
collection.removeAll(MinimalCollection.of(e3())));
} catch (UnsupportedOperationException tolerated) {
}
expectUnchanged();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:12,代码来源:CollectionRemoveAllTester.java
示例15: testRemoveAll_unsupportedPresent
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveAll_unsupportedPresent() {
try {
collection.removeAll(MinimalCollection.of(e0()));
fail("removeAll(intersectingCollection) should throw UnsupportedOperationException");
} catch (UnsupportedOperationException expected) {
}
expectUnchanged();
assertTrue(collection.contains(e0()));
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:12,代码来源:CollectionRemoveAllTester.java
示例16: testRemoveAll_containsNullNo
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(value = SUPPORTS_REMOVE, absent = ALLOWS_NULL_QUERIES)
public void testRemoveAll_containsNullNo() {
MinimalCollection<?> containsNull = MinimalCollection.of((Object) null);
try {
assertFalse(
"removeAll(containsNull) should return false or throw",
collection.removeAll(containsNull));
} catch (NullPointerException tolerated) {
}
expectUnchanged();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:12,代码来源:CollectionRemoveAllTester.java
示例17: testRemoveAll_containsWrongType
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAll_containsWrongType() {
try {
assertFalse(
"removeAll(containsWrongType) should return false or throw",
collection.removeAll(MinimalCollection.of(WrongType.VALUE)));
} catch (ClassCastException tolerated) {
}
expectUnchanged();
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:11,代码来源:CollectionRemoveAllTester.java
示例18: testAddAll_supportedAllPresent
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@CollectionFeature.Require(SUPPORTS_ADD)
@CollectionSize.Require(absent = ZERO)
public void testAddAll_supportedAllPresent() {
assertTrue(
"addAll(allPresent) should return true", getList().addAll(MinimalCollection.of(e0())));
expectAdded(e0());
}
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:ListAddAllTester.java
示例19: testAddAllAtIndex_unsupportedSomePresent
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@ListFeature.Require(absent = SUPPORTS_ADD_WITH_INDEX)
@CollectionSize.Require(absent = ZERO)
public void testAddAllAtIndex_unsupportedSomePresent() {
try {
getList().addAll(0, MinimalCollection.of(e0(), e3()));
fail("addAll(n, allPresent) should throw");
} catch (UnsupportedOperationException expected) {
}
expectUnchanged();
expectMissing(e3());
}
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:12,代码来源:ListAddAllAtIndexTester.java
示例20: testAddAllAtIndex_supportedAllPresent
import com.google.common.collect.testing.MinimalCollection; //导入依赖的package包/类
@ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
@CollectionSize.Require(absent = ZERO)
public void testAddAllAtIndex_supportedAllPresent() {
assertTrue(
"addAll(n, allPresent) should return true",
getList().addAll(0, MinimalCollection.of(e0())));
expectAdded(0, e0());
}
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:9,代码来源:ListAddAllAtIndexTester.java
注:本文中的com.google.common.collect.testing.MinimalCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论