本文整理汇总了Java中com.google.common.collect.testing.features.CollectionFeature.Require方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionFeature.Require方法的具体用法?Java CollectionFeature.Require怎么用?Java CollectionFeature.Require使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.testing.features.CollectionFeature
的用法示例。
在下文中一共展示了CollectionFeature.Require方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetCount_zeroToZero_unsupported
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(absent = {SUPPORTS_ADD, SUPPORTS_REMOVE})
public void testSetCount_zeroToZero_unsupported() {
try {
assertZeroToZero();
} catch (UnsupportedOperationException tolerated) {
}
}
示例2: testClearTailClosed
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionSize.Require(SEVERAL)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testClearTailClosed() {
List<Entry<E>> expected =
copyToList(sortedMultiset.headMultiset(b.getElement(), OPEN).entrySet());
sortedMultiset.tailMultiset(b.getElement(), CLOSED).clear();
assertEquals(expected, copyToList(sortedMultiset.entrySet()));
}
示例3: testRemoveAllIgnoresCount
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionSize.Require(SEVERAL)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllIgnoresCount() {
initThreeCopies();
assertTrue(getMultiset().removeAll(Collections.singleton(e0())));
assertEmpty(getMultiset());
}
示例4: testAdd_unsupportedNotPresent
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(absent = SUPPORTS_ADD)
public void testAdd_unsupportedNotPresent() {
try {
collection.add(e3());
fail("add(notPresent) should throw");
} catch (UnsupportedOperationException expected) {
}
expectUnchanged();
expectMissing(e3());
}
示例5: testSetCount_threeToThree_unsupported
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionSize.Require(SEVERAL)
@CollectionFeature.Require(absent = {SUPPORTS_ADD, SUPPORTS_REMOVE})
public void testSetCount_threeToThree_unsupported() {
try {
assertThreeToThree();
} catch (UnsupportedOperationException tolerated) {
}
}
示例6: testAddOccurrences_unsupported
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(absent = SUPPORTS_ADD)
public void testAddOccurrences_unsupported() {
try {
getMultiset().add(e0(), 2);
fail("unsupported multiset.add(E, int) didn't throw exception");
} catch (UnsupportedOperationException required) {
}
}
示例7: testRetainAll_duplicatesKept
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = {ZERO, ONE})
public void testRetainAll_duplicatesKept() {
E[] array = createSamplesArray();
array[1] = e0();
collection = getSubjectGenerator().create(array);
assertFalse(
"containsDuplicates.retainAll(superset) should return false",
collection.retainAll(MinimalCollection.of(createSamplesArray())));
expectContents(array);
}
示例8: testRemove_present
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemove_present() {
getSet().remove(e0());
assertFalse(
"After remove(present) a set should not contain the removed element.",
getSet().contains(e0()));
}
示例9: testSetCount_negative_removeSupported
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testSetCount_negative_removeSupported() {
try {
setCountNoCheckReturnValue(e3(), -1);
fail("calling setCount() with a negative count should throw IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
示例10: testElementSetReflectsAddAbsent
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(SUPPORTS_ADD)
public void testElementSetReflectsAddAbsent() {
Set<E> elementSet = getMultiset().elementSet();
assertFalse(elementSet.contains(e3()));
getMultiset().add(e3(), 4);
assertTrue(elementSet.contains(e3()));
}
示例11: testRemovingIteratorKnownOrder
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@CollectionFeature.Require({SUPPORTS_ITERATOR_REMOVE, KNOWN_ORDER})
public void testRemovingIteratorKnownOrder() {
new IteratorTester<E>(
4,
MODIFIABLE,
getSubjectGenerator().order(Arrays.asList(e0(), e1(), e1(), e2())),
IteratorTester.KnownOrder.KNOWN_ORDER) {
@Override
protected Iterator<E> newTargetIterator() {
return getSubjectGenerator().create(e0(), e1(), e1(), e2()).iterator();
}
}.test();
}
示例12: testSetCountConditional_negativeOldCount_addUnsupported
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(absent = SUPPORTS_ADD)
public void testSetCountConditional_negativeOldCount_addUnsupported() {
try {
assertSetCountNegativeOldCount();
} catch (UnsupportedOperationException tolerated) {
}
}
示例13: testAddAll_withDuplicates
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(SUPPORTS_ADD)
public void testAddAll_withDuplicates() {
MinimalCollection<E> elementsToAdd = MinimalCollection.of(e3(), e4(), e3(), e4());
assertTrue("add(hasDuplicates) should return true", getSet().addAll(elementsToAdd));
expectAdded(e3(), e4());
}
示例14: testAdd_supportedPresent
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionFeature.Require(SUPPORTS_ADD)
@CollectionSize.Require(absent = ZERO)
public void testAdd_supportedPresent() {
assertTrue("add(present) should return true", getList().add(e0()));
expectAdded(e0());
}
示例15: testSetCount_oneToZero_unsupported
import com.google.common.collect.testing.features.CollectionFeature; //导入方法依赖的package包/类
@CollectionSize.Require(absent = ZERO)
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
public void testSetCount_oneToZero_unsupported() {
assertSetCountDecreasingFailure(e0(), 0);
}