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


Java CollectionFeature.Require方法代码示例

本文整理汇总了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) {
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:AbstractMultisetSetCountTester.java

示例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()));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:9,代码来源:MultisetNavigationTester.java

示例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());
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:8,代码来源:MultisetRemoveTester.java

示例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());
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:11,代码来源:CollectionAddTester.java

示例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) {
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:9,代码来源:AbstractMultisetSetCountTester.java

示例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) {
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:9,代码来源:MultisetAddTester.java

示例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);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:12,代码来源:ListRetainAllTester.java

示例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()));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:9,代码来源:SetRemoveTester.java

示例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) {
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:9,代码来源:AbstractMultisetSetCountTester.java

示例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()));
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:MultisetElementSetTester.java

示例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();
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:15,代码来源:MultisetIteratorTester.java

示例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) {
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:8,代码来源:MultisetSetCountConditionallyTester.java

示例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());
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:7,代码来源:SetAddAllTester.java

示例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());
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:7,代码来源:ListAddTester.java

示例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);
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:6,代码来源:AbstractMultisetSetCountTester.java


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