The following issues were found
guava-testlib/src/com/google/common/collect/testing/testers/QueueOfferTester.java
8 issues
Line: 36
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class QueueOfferTester<E> extends AbstractQueueTester<E> {
@CollectionFeature.Require(SUPPORTS_ADD)
public void testOffer_supportedNotPresent() {
assertTrue("offer(notPresent) should return true", getQueue().offer(e3()));
expectAdded(e3());
}
Reported by PMD.
Line: 38
public class QueueOfferTester<E> extends AbstractQueueTester<E> {
@CollectionFeature.Require(SUPPORTS_ADD)
public void testOffer_supportedNotPresent() {
assertTrue("offer(notPresent) should return true", getQueue().offer(e3()));
expectAdded(e3());
}
@CollectionFeature.Require({SUPPORTS_ADD, ALLOWS_NULL_VALUES})
public void testOffer_nullSupported() {
Reported by PMD.
Line: 42
expectAdded(e3());
}
@CollectionFeature.Require({SUPPORTS_ADD, ALLOWS_NULL_VALUES})
public void testOffer_nullSupported() {
assertTrue("offer(null) should return true", getQueue().offer(null));
expectAdded((E) null);
}
Reported by PMD.
Line: 44
@CollectionFeature.Require({SUPPORTS_ADD, ALLOWS_NULL_VALUES})
public void testOffer_nullSupported() {
assertTrue("offer(null) should return true", getQueue().offer(null));
expectAdded((E) null);
}
@CollectionFeature.Require(value = SUPPORTS_ADD, absent = ALLOWS_NULL_VALUES)
public void testOffer_nullUnsupported() {
Reported by PMD.
Line: 48
expectAdded((E) null);
}
@CollectionFeature.Require(value = SUPPORTS_ADD, absent = ALLOWS_NULL_VALUES)
public void testOffer_nullUnsupported() {
try {
getQueue().offer(null);
fail("offer(null) should throw");
} catch (NullPointerException expected) {
Reported by PMD.
Line: 51
@CollectionFeature.Require(value = SUPPORTS_ADD, absent = ALLOWS_NULL_VALUES)
public void testOffer_nullUnsupported() {
try {
getQueue().offer(null);
fail("offer(null) should throw");
} catch (NullPointerException expected) {
}
expectUnchanged();
expectNullMissingWhenNullUnsupported("Should not contain null after unsupported offer(null)");
Reported by PMD.
Line: 53
try {
getQueue().offer(null);
fail("offer(null) should throw");
} catch (NullPointerException expected) {
}
expectUnchanged();
expectNullMissingWhenNullUnsupported("Should not contain null after unsupported offer(null)");
}
}
Reported by PMD.
Line: 53
try {
getQueue().offer(null);
fail("offer(null) should throw");
} catch (NullPointerException expected) {
}
expectUnchanged();
expectNullMissingWhenNullUnsupported("Should not contain null after unsupported offer(null)");
}
}
Reported by PMD.
guava-tests/benchmark/com/google/common/math/QuantilesBenchmark.java
8 issues
Line: 35
ContiguousSet.create(Range.closed(0, 10), DiscreteDomain.integers());
@Param({"10", "100", "1000", "10000", "100000"})
int datasetSize;
@Param QuantilesAlgorithm algorithm;
private double[][] datasets = new double[0x100][];
Reported by PMD.
Line: 37
@Param({"10", "100", "1000", "10000", "100000"})
int datasetSize;
@Param QuantilesAlgorithm algorithm;
private double[][] datasets = new double[0x100][];
@BeforeExperiment
void setUp() {
Reported by PMD.
Line: 39
@Param QuantilesAlgorithm algorithm;
private double[][] datasets = new double[0x100][];
@BeforeExperiment
void setUp() {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
Reported by PMD.
Line: 41
private double[][] datasets = new double[0x100][];
@BeforeExperiment
void setUp() {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
datasets[i] = new double[datasetSize];
for (int j = 0; j < datasetSize; j++) {
Reported by PMD.
Line: 89
double percentiles90And99(int reps) {
double dummy = 0.0;
for (int i = 0; i < reps; i++) {
dummy += algorithm.multipleQuantiles(ImmutableSet.of(90, 99), 100, dataset(i)).get(90);
}
return dummy;
}
@Benchmark
Reported by PMD.
Line: 98
double threePercentiles(int reps) {
double dummy = 0.0;
for (int i = 0; i < reps; i++) {
dummy += algorithm.multipleQuantiles(ImmutableSet.of(90, 95, 99), 100, dataset(i)).get(90);
}
return dummy;
}
@Benchmark
Reported by PMD.
Line: 107
double allDeciles(int reps) {
double dummy = 0.0;
for (int i = 0; i < reps; i++) {
dummy += algorithm.multipleQuantiles(ALL_DECILE_INDEXES, 10, dataset(i)).get(9);
}
return dummy;
}
}
Reported by PMD.
Line: 43
@BeforeExperiment
void setUp() {
Random rng = new Random();
for (int i = 0; i < 0x100; i++) {
datasets[i] = new double[datasetSize];
for (int j = 0; j < datasetSize; j++) {
datasets[i][j] = rng.nextDouble();
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/ListAddTester.java
8 issues
Line: 42
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListAddTester<E> extends AbstractListTester<E> {
@CollectionFeature.Require(SUPPORTS_ADD)
@CollectionSize.Require(absent = ZERO)
public void testAdd_supportedPresent() {
assertTrue("add(present) should return true", getList().add(e0()));
expectAdded(e0());
}
Reported by PMD.
Line: 45
@CollectionFeature.Require(SUPPORTS_ADD)
@CollectionSize.Require(absent = ZERO)
public void testAdd_supportedPresent() {
assertTrue("add(present) should return true", getList().add(e0()));
expectAdded(e0());
}
@CollectionFeature.Require(absent = SUPPORTS_ADD)
@CollectionSize.Require(absent = ZERO)
Reported by PMD.
Line: 49
expectAdded(e0());
}
@CollectionFeature.Require(absent = SUPPORTS_ADD)
@CollectionSize.Require(absent = ZERO)
/*
* absent = ZERO isn't required, since unmodList.add() must
* throw regardless, but it keeps the method name accurate.
*/
Reported by PMD.
Line: 57
*/
public void testAdd_unsupportedPresent() {
try {
getList().add(e0());
fail("add(present) should throw");
} catch (UnsupportedOperationException expected) {
}
}
Reported by PMD.
Line: 63
}
}
@CollectionFeature.Require(value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES})
@CollectionSize.Require(absent = ZERO)
public void testAdd_supportedNullPresent() {
E[] array = createArrayWithNullElement();
collection = getSubjectGenerator().create(array);
assertTrue("add(nullPresent) should return true", getList().add(null));
Reported by PMD.
Line: 67
@CollectionSize.Require(absent = ZERO)
public void testAdd_supportedNullPresent() {
E[] array = createArrayWithNullElement();
collection = getSubjectGenerator().create(array);
assertTrue("add(nullPresent) should return true", getList().add(null));
List<E> expected = Helpers.copyToList(array);
expected.add(null);
expectContents(expected);
Reported by PMD.
Line: 68
public void testAdd_supportedNullPresent() {
E[] array = createArrayWithNullElement();
collection = getSubjectGenerator().create(array);
assertTrue("add(nullPresent) should return true", getList().add(null));
List<E> expected = Helpers.copyToList(array);
expected.add(null);
expectContents(expected);
}
Reported by PMD.
Line: 71
assertTrue("add(nullPresent) should return true", getList().add(null));
List<E> expected = Helpers.copyToList(array);
expected.add(null);
expectContents(expected);
}
/**
* Returns the {@link Method} instance for {@link #testAdd_supportedNullPresent()} so that tests
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/CollectionContainsTester.java
8 issues
Line: 40
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionContainsTester<E> extends AbstractCollectionTester<E> {
@CollectionSize.Require(absent = ZERO)
public void testContains_yes() {
assertTrue("contains(present) should return true", collection.contains(e0()));
}
public void testContains_no() {
Reported by PMD.
Line: 45
assertTrue("contains(present) should return true", collection.contains(e0()));
}
public void testContains_no() {
assertFalse("contains(notPresent) should return false", collection.contains(e3()));
}
@CollectionFeature.Require(ALLOWS_NULL_QUERIES)
public void testContains_nullNotContainedButQueriesSupported() {
Reported by PMD.
Line: 49
assertFalse("contains(notPresent) should return false", collection.contains(e3()));
}
@CollectionFeature.Require(ALLOWS_NULL_QUERIES)
public void testContains_nullNotContainedButQueriesSupported() {
assertFalse("contains(null) should return false", collection.contains(null));
}
@CollectionFeature.Require(absent = ALLOWS_NULL_QUERIES)
Reported by PMD.
Line: 54
assertFalse("contains(null) should return false", collection.contains(null));
}
@CollectionFeature.Require(absent = ALLOWS_NULL_QUERIES)
public void testContains_nullNotContainedAndUnsupported() {
expectNullMissingWhenNullUnsupported("contains(null) should return false or throw");
}
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
Reported by PMD.
Line: 59
expectNullMissingWhenNullUnsupported("contains(null) should return false or throw");
}
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
@CollectionSize.Require(absent = ZERO)
public void testContains_nonNullWhenNullContained() {
initCollectionWithNullElement();
assertFalse("contains(notPresent) should return false", collection.contains(e3()));
}
Reported by PMD.
Line: 66
assertFalse("contains(notPresent) should return false", collection.contains(e3()));
}
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
@CollectionSize.Require(absent = ZERO)
public void testContains_nullContained() {
initCollectionWithNullElement();
assertTrue("contains(null) should return true", collection.contains(null));
}
Reported by PMD.
Line: 73
assertTrue("contains(null) should return true", collection.contains(null));
}
public void testContains_wrongType() {
try {
assertFalse(
"contains(wrongType) should return false or throw", collection.contains(WrongType.VALUE));
} catch (ClassCastException tolerated) {
}
Reported by PMD.
Line: 77
try {
assertFalse(
"contains(wrongType) should return false or throw", collection.contains(WrongType.VALUE));
} catch (ClassCastException tolerated) {
}
}
}
Reported by PMD.
guava-tests/benchmark/com/google/common/collect/MinMaxPriorityQueueBenchmark.java
8 issues
Line: 35
* @author Sverre Sundsdal
*/
public class MinMaxPriorityQueueBenchmark {
@Param private ComparatorType comparator;
// TODO(kevinb): add 1000000 back when we have the ability to throw
// NotApplicableException in the expensive comparator case.
@Param({"100", "10000"})
private int size;
Reported by PMD.
Line: 40
// TODO(kevinb): add 1000000 back when we have the ability to throw
// NotApplicableException in the expensive comparator case.
@Param({"100", "10000"})
private int size;
@Param private HeapType heap;
private Queue<Integer> queue;
Reported by PMD.
Line: 42
@Param({"100", "10000"})
private int size;
@Param private HeapType heap;
private Queue<Integer> queue;
private final Random random = new Random();
Reported by PMD.
Line: 44
@Param private HeapType heap;
private Queue<Integer> queue;
private final Random random = new Random();
@BeforeExperiment
void setUp() {
Reported by PMD.
Line: 46
private Queue<Integer> queue;
private final Random random = new Random();
@BeforeExperiment
void setUp() {
queue = heap.create(comparator.get());
for (int i = 0; i < size; i++) {
Reported by PMD.
Line: 48
private final Random random = new Random();
@BeforeExperiment
void setUp() {
queue = heap.create(comparator.get());
for (int i = 0; i < size; i++) {
queue.add(random.nextInt());
}
Reported by PMD.
Line: 81
* pollMax using the same code that benchmarks poll.
*/
static final class InvertedMinMaxPriorityQueue<T> extends ForwardingQueue<T> {
MinMaxPriorityQueue<T> mmHeap;
public InvertedMinMaxPriorityQueue(Comparator<T> comparator) {
mmHeap = MinMaxPriorityQueue.orderedBy(comparator).create();
}
Reported by PMD.
Line: 102
MIN_MAX {
@Override
public Queue<Integer> create(Comparator<Integer> comparator) {
return MinMaxPriorityQueue.orderedBy(comparator).create();
}
},
PRIORITY_QUEUE {
@Override
public Queue<Integer> create(Comparator<Integer> comparator) {
Reported by PMD.
guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java
8 issues
Line: 49
}
@Override
protected String getKeyNotInPopulatedMap() throws UnsupportedOperationException {
return "zero";
}
@Override
protected Collection<Integer> getValueNotInPopulatedMap() throws UnsupportedOperationException {
Reported by PMD.
Line: 54
}
@Override
protected Collection<Integer> getValueNotInPopulatedMap() throws UnsupportedOperationException {
return Lists.newArrayList(0);
}
/**
* The version of this test supplied by {@link MapInterfaceTest} fails for this particular Map
Reported by PMD.
Line: 64
* of a call to {@code remove()}. Thus, the expectation doesn't hold that {@code map.remove(x)}
* returns the same value which {@code map.get(x)} did immediately beforehand.
*/
@Override
public void testRemove() {
final Map<String, Collection<Integer>> map;
final String keyToRemove;
try {
map = makePopulatedMap();
Reported by PMD.
Line: 65
* returns the same value which {@code map.get(x)} did immediately beforehand.
*/
@Override
public void testRemove() {
final Map<String, Collection<Integer>> map;
final String keyToRemove;
try {
map = makePopulatedMap();
} catch (UnsupportedOperationException e) {
Reported by PMD.
Line: 73
} catch (UnsupportedOperationException e) {
return;
}
keyToRemove = map.keySet().iterator().next();
if (supportsRemove) {
int initialSize = map.size();
map.get(keyToRemove);
map.remove(keyToRemove);
// This line doesn't hold - see the Javadoc comments above.
Reported by PMD.
Line: 73
} catch (UnsupportedOperationException e) {
return;
}
keyToRemove = map.keySet().iterator().next();
if (supportsRemove) {
int initialSize = map.size();
map.get(keyToRemove);
map.remove(keyToRemove);
// This line doesn't hold - see the Javadoc comments above.
Reported by PMD.
Line: 73
} catch (UnsupportedOperationException e) {
return;
}
keyToRemove = map.keySet().iterator().next();
if (supportsRemove) {
int initialSize = map.size();
map.get(keyToRemove);
map.remove(keyToRemove);
// This line doesn't hold - see the Javadoc comments above.
Reported by PMD.
Line: 69
final Map<String, Collection<Integer>> map;
final String keyToRemove;
try {
map = makePopulatedMap();
} catch (UnsupportedOperationException e) {
return;
}
keyToRemove = map.keySet().iterator().next();
if (supportsRemove) {
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java
8 issues
Line: 90
return new Ordering<Entry<String, Integer>>() {
@Override
public int compare(Entry<String, Integer> left, Entry<String, Integer> right) {
return left.getKey().compareTo(right.getKey());
}
}.sortedCopy(insertionOrder);
}
@Override
Reported by PMD.
Line: 103
Entry<String, Integer> entry = (Entry<String, Integer>) o;
builder.put(entry);
}
return builder.build().entrySet().asList();
}
}
public static class ImmutableSortedMapKeyListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 103
Entry<String, Integer> entry = (Entry<String, Integer>) o;
builder.put(entry);
}
return builder.build().entrySet().asList();
}
}
public static class ImmutableSortedMapKeyListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 114
for (int i = 0; i < elements.length; i++) {
builder.put(elements[i], i);
}
return builder.build().keySet().asList();
}
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
Reported by PMD.
Line: 114
for (int i = 0; i < elements.length; i++) {
builder.put(elements[i], i);
}
return builder.build().keySet().asList();
}
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
Reported by PMD.
Line: 119
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
}
public static class ImmutableSortedMapValueListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 130
for (int i = 0; i < elements.length; i++) {
builder.put(i, elements[i]);
}
return builder.build().values().asList();
}
}
}
Reported by PMD.
Line: 130
for (int i = 0; i < elements.length; i++) {
builder.put(i, elements[i]);
}
return builder.build().values().asList();
}
}
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/MultisetForEachEntryTester.java
8 issues
Line: 42
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetForEachEntryTester<E> extends AbstractMultisetTester<E> {
public void testForEachEntry() {
List<Entry<E>> expected = new ArrayList<>(getMultiset().entrySet());
List<Entry<E>> actual = new ArrayList<>();
getMultiset()
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
Helpers.assertEqualIgnoringOrder(expected, actual);
Reported by PMD.
Line: 43
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetForEachEntryTester<E> extends AbstractMultisetTester<E> {
public void testForEachEntry() {
List<Entry<E>> expected = new ArrayList<>(getMultiset().entrySet());
List<Entry<E>> actual = new ArrayList<>();
getMultiset()
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
Helpers.assertEqualIgnoringOrder(expected, actual);
}
Reported by PMD.
Line: 45
public void testForEachEntry() {
List<Entry<E>> expected = new ArrayList<>(getMultiset().entrySet());
List<Entry<E>> actual = new ArrayList<>();
getMultiset()
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
Helpers.assertEqualIgnoringOrder(expected, actual);
}
@CollectionFeature.Require(KNOWN_ORDER)
Reported by PMD.
Line: 50
Helpers.assertEqualIgnoringOrder(expected, actual);
}
@CollectionFeature.Require(KNOWN_ORDER)
public void testForEachEntryOrdered() {
List<Entry<E>> expected = new ArrayList<>(getMultiset().entrySet());
List<Entry<E>> actual = new ArrayList<>();
getMultiset()
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
Reported by PMD.
Line: 52
@CollectionFeature.Require(KNOWN_ORDER)
public void testForEachEntryOrdered() {
List<Entry<E>> expected = new ArrayList<>(getMultiset().entrySet());
List<Entry<E>> actual = new ArrayList<>();
getMultiset()
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
assertEquals(expected, actual);
}
Reported by PMD.
Line: 54
public void testForEachEntryOrdered() {
List<Entry<E>> expected = new ArrayList<>(getMultiset().entrySet());
List<Entry<E>> actual = new ArrayList<>();
getMultiset()
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
assertEquals(expected, actual);
}
public void testForEachEntryDuplicates() {
Reported by PMD.
Line: 59
assertEquals(expected, actual);
}
public void testForEachEntryDuplicates() {
initThreeCopies();
List<Entry<E>> expected = Collections.singletonList(Multisets.immutableEntry(e0(), 3));
List<Entry<E>> actual = new ArrayList<>();
getMultiset()
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
Reported by PMD.
Line: 63
initThreeCopies();
List<Entry<E>> expected = Collections.singletonList(Multisets.immutableEntry(e0(), 3));
List<Entry<E>> actual = new ArrayList<>();
getMultiset()
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
assertEquals(expected, actual);
}
/**
Reported by PMD.
guava-tests/test/com/google/common/collect/ForwardingNavigableSetTest.java
8 issues
Line: 44
* @author Louis Wasserman
*/
public class ForwardingNavigableSetTest extends TestCase {
static class StandardImplForwardingNavigableSet<T> extends ForwardingNavigableSet<T> {
private final NavigableSet<T> backingSet;
StandardImplForwardingNavigableSet(NavigableSet<T> backingSet) {
this.backingSet = backingSet;
}
Reported by PMD.
Line: 45
*/
public class ForwardingNavigableSetTest extends TestCase {
static class StandardImplForwardingNavigableSet<T> extends ForwardingNavigableSet<T> {
private final NavigableSet<T> backingSet;
StandardImplForwardingNavigableSet(NavigableSet<T> backingSet) {
this.backingSet = backingSet;
}
Reported by PMD.
Line: 162
}
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ForwardingNavigableSetTest.class);
suite.addTest(
SetTestSuiteBuilder.using(
Reported by PMD.
Line: 191
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
SafeTreeSet<String> set = new SafeTreeSet<>(Ordering.natural().nullsFirst());
Collections.addAll(set, elements);
return new StandardImplForwardingNavigableSet<>(set);
}
@Override
Reported by PMD.
Line: 214
return suite;
}
@SuppressWarnings({"rawtypes", "unchecked"})
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
NavigableSet.class,
new Function<NavigableSet, NavigableSet>() {
Reported by PMD.
Line: 215
}
@SuppressWarnings({"rawtypes", "unchecked"})
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
NavigableSet.class,
new Function<NavigableSet, NavigableSet>() {
@Override
Reported by PMD.
Line: 227
});
}
public void testEquals() {
NavigableSet<String> set1 = ImmutableSortedSet.of("one");
NavigableSet<String> set2 = ImmutableSortedSet.of("two");
new EqualsTester()
.addEqualityGroup(set1, wrap(set1), wrap(set1))
.addEqualityGroup(set2, wrap(set2))
Reported by PMD.
Line: 227
});
}
public void testEquals() {
NavigableSet<String> set1 = ImmutableSortedSet.of("one");
NavigableSet<String> set2 = ImmutableSortedSet.of("two");
new EqualsTester()
.addEqualityGroup(set1, wrap(set1), wrap(set1))
.addEqualityGroup(set2, wrap(set2))
Reported by PMD.
android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java
8 issues
Line: 49
}
@Override
protected String getKeyNotInPopulatedMap() throws UnsupportedOperationException {
return "zero";
}
@Override
protected Collection<Integer> getValueNotInPopulatedMap() throws UnsupportedOperationException {
Reported by PMD.
Line: 54
}
@Override
protected Collection<Integer> getValueNotInPopulatedMap() throws UnsupportedOperationException {
return Lists.newArrayList(0);
}
/**
* The version of this test supplied by {@link MapInterfaceTest} fails for this particular Map
Reported by PMD.
Line: 64
* of a call to {@code remove()}. Thus, the expectation doesn't hold that {@code map.remove(x)}
* returns the same value which {@code map.get(x)} did immediately beforehand.
*/
@Override
public void testRemove() {
final Map<String, Collection<Integer>> map;
final String keyToRemove;
try {
map = makePopulatedMap();
Reported by PMD.
Line: 65
* returns the same value which {@code map.get(x)} did immediately beforehand.
*/
@Override
public void testRemove() {
final Map<String, Collection<Integer>> map;
final String keyToRemove;
try {
map = makePopulatedMap();
} catch (UnsupportedOperationException e) {
Reported by PMD.
Line: 73
} catch (UnsupportedOperationException e) {
return;
}
keyToRemove = map.keySet().iterator().next();
if (supportsRemove) {
int initialSize = map.size();
map.get(keyToRemove);
map.remove(keyToRemove);
// This line doesn't hold - see the Javadoc comments above.
Reported by PMD.
Line: 73
} catch (UnsupportedOperationException e) {
return;
}
keyToRemove = map.keySet().iterator().next();
if (supportsRemove) {
int initialSize = map.size();
map.get(keyToRemove);
map.remove(keyToRemove);
// This line doesn't hold - see the Javadoc comments above.
Reported by PMD.
Line: 73
} catch (UnsupportedOperationException e) {
return;
}
keyToRemove = map.keySet().iterator().next();
if (supportsRemove) {
int initialSize = map.size();
map.get(keyToRemove);
map.remove(keyToRemove);
// This line doesn't hold - see the Javadoc comments above.
Reported by PMD.
Line: 69
final Map<String, Collection<Integer>> map;
final String keyToRemove;
try {
map = makePopulatedMap();
} catch (UnsupportedOperationException e) {
return;
}
keyToRemove = map.keySet().iterator().next();
if (supportsRemove) {
Reported by PMD.