The following issues were found
android/guava-tests/benchmark/com/google/common/util/concurrent/AbstractFutureFootprintBenchmark.java
14 issues
Line: 32
import java.util.concurrent.Executor;
/** Measures the size of AbstractFuture implementations. */
public class AbstractFutureFootprintBenchmark {
enum State {
NOT_DONE,
FINISHED,
CANCELLED,
Reported by PMD.
Line: 41
FAILED
}
@Param State state;
@Param Impl impl;
@Param({"0", "1", "5", "10"})
int numListeners;
Reported by PMD.
Line: 42
}
@Param State state;
@Param Impl impl;
@Param({"0", "1", "5", "10"})
int numListeners;
@Param({"0", "1", "5", "10"})
Reported by PMD.
Line: 45
@Param Impl impl;
@Param({"0", "1", "5", "10"})
int numListeners;
@Param({"0", "1", "5", "10"})
int numThreads;
private final Set<Thread> blockedThreads = new HashSet<>();
Reported by PMD.
Line: 48
int numListeners;
@Param({"0", "1", "5", "10"})
int numThreads;
private final Set<Thread> blockedThreads = new HashSet<>();
@BeforeExperiment
void setUp() throws Exception {
Reported by PMD.
Line: 50
@Param({"0", "1", "5", "10"})
int numThreads;
private final Set<Thread> blockedThreads = new HashSet<>();
@BeforeExperiment
void setUp() throws Exception {
if (state != State.NOT_DONE && (numListeners != 0 || numThreads != 0)) {
throw new SkipThisScenarioException();
Reported by PMD.
Line: 52
private final Set<Thread> blockedThreads = new HashSet<>();
@BeforeExperiment
void setUp() throws Exception {
if (state != State.NOT_DONE && (numListeners != 0 || numThreads != 0)) {
throw new SkipThisScenarioException();
}
}
Reported by PMD.
Line: 53
private final Set<Thread> blockedThreads = new HashSet<>();
@BeforeExperiment
void setUp() throws Exception {
if (state != State.NOT_DONE && (numListeners != 0 || numThreads != 0)) {
throw new SkipThisScenarioException();
}
}
Reported by PMD.
Line: 63
// larger than they are.
@SuppressWarnings("FutureReturnValueIgnored")
@Footprint(exclude = {Runnable.class, Executor.class, Thread.class, Exception.class})
public Object measureSize() {
for (Thread thread : blockedThreads) {
thread.interrupt();
}
blockedThreads.clear();
final Facade<Object> f = impl.newFacade();
Reported by PMD.
Line: 63
// larger than they are.
@SuppressWarnings("FutureReturnValueIgnored")
@Footprint(exclude = {Runnable.class, Executor.class, Thread.class, Exception.class})
public Object measureSize() {
for (Thread thread : blockedThreads) {
thread.interrupt();
}
blockedThreads.clear();
final Facade<Object> f = impl.newFacade();
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsKeyTester.java
14 issues
Line: 39
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapContainsKeyTester<K, V> extends AbstractMapTester<K, V> {
@CollectionSize.Require(absent = ZERO)
public void testContains_yes() {
assertTrue("containsKey(present) should return true", getMap().containsKey(k0()));
}
public void testContains_no() {
Reported by PMD.
Line: 41
public class MapContainsKeyTester<K, V> extends AbstractMapTester<K, V> {
@CollectionSize.Require(absent = ZERO)
public void testContains_yes() {
assertTrue("containsKey(present) should return true", getMap().containsKey(k0()));
}
public void testContains_no() {
assertFalse("containsKey(notPresent) should return false", getMap().containsKey(k3()));
}
Reported by PMD.
Line: 44
assertTrue("containsKey(present) should return true", getMap().containsKey(k0()));
}
public void testContains_no() {
assertFalse("containsKey(notPresent) should return false", getMap().containsKey(k3()));
}
@MapFeature.Require(ALLOWS_NULL_KEY_QUERIES)
public void testContains_nullNotContainedButAllowed() {
Reported by PMD.
Line: 45
}
public void testContains_no() {
assertFalse("containsKey(notPresent) should return false", getMap().containsKey(k3()));
}
@MapFeature.Require(ALLOWS_NULL_KEY_QUERIES)
public void testContains_nullNotContainedButAllowed() {
assertFalse("containsKey(null) should return false", getMap().containsKey(null));
Reported by PMD.
Line: 48
assertFalse("containsKey(notPresent) should return false", getMap().containsKey(k3()));
}
@MapFeature.Require(ALLOWS_NULL_KEY_QUERIES)
public void testContains_nullNotContainedButAllowed() {
assertFalse("containsKey(null) should return false", getMap().containsKey(null));
}
@MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES)
Reported by PMD.
Line: 50
@MapFeature.Require(ALLOWS_NULL_KEY_QUERIES)
public void testContains_nullNotContainedButAllowed() {
assertFalse("containsKey(null) should return false", getMap().containsKey(null));
}
@MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES)
public void testContains_nullNotContainedAndUnsupported() {
expectNullKeyMissingWhenNullKeysUnsupported("containsKey(null) should return false or throw");
Reported by PMD.
Line: 53
assertFalse("containsKey(null) should return false", getMap().containsKey(null));
}
@MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES)
public void testContains_nullNotContainedAndUnsupported() {
expectNullKeyMissingWhenNullKeysUnsupported("containsKey(null) should return false or throw");
}
@MapFeature.Require(ALLOWS_NULL_KEYS)
Reported by PMD.
Line: 58
expectNullKeyMissingWhenNullKeysUnsupported("containsKey(null) should return false or throw");
}
@MapFeature.Require(ALLOWS_NULL_KEYS)
@CollectionSize.Require(absent = ZERO)
public void testContains_nonNullWhenNullContained() {
initMapWithNullKey();
assertFalse("containsKey(notPresent) should return false", getMap().containsKey(k3()));
}
Reported by PMD.
Line: 62
@CollectionSize.Require(absent = ZERO)
public void testContains_nonNullWhenNullContained() {
initMapWithNullKey();
assertFalse("containsKey(notPresent) should return false", getMap().containsKey(k3()));
}
@MapFeature.Require(ALLOWS_NULL_KEYS)
@CollectionSize.Require(absent = ZERO)
public void testContains_nullContained() {
Reported by PMD.
Line: 65
assertFalse("containsKey(notPresent) should return false", getMap().containsKey(k3()));
}
@MapFeature.Require(ALLOWS_NULL_KEYS)
@CollectionSize.Require(absent = ZERO)
public void testContains_nullContained() {
initMapWithNullKey();
assertTrue("containsKey(null) should return true", getMap().containsKey(null));
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java
14 issues
Line: 89
for (UnhashableObject value : elements) {
builder.put(key++, value);
}
return builder.build().values();
}
}
public static class ImmutableMapKeyListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 100
for (int i = 0; i < elements.length; i++) {
builder.put(elements[i], i);
}
return builder.build().keySet().asList();
}
}
public static class ImmutableMapValueListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 100
for (int i = 0; i < elements.length; i++) {
builder.put(elements[i], i);
}
return builder.build().keySet().asList();
}
}
public static class ImmutableMapValueListGenerator extends TestStringListGenerator {
@Override
Reported by PMD.
Line: 111
for (int i = 0; i < elements.length; i++) {
builder.put(i, elements[i]);
}
return builder.build().values().asList();
}
}
public static class ImmutableMapEntryListGenerator
implements TestListGenerator<Entry<String, Integer>> {
Reported by PMD.
Line: 111
for (int i = 0; i < elements.length; i++) {
builder.put(i, elements[i]);
}
return builder.build().values().asList();
}
}
public static class ImmutableMapEntryListGenerator
implements TestListGenerator<Entry<String, Integer>> {
Reported by PMD.
Line: 128
mapEntry("toaster", -2));
}
@SuppressWarnings("unchecked")
@Override
public Entry<String, Integer>[] createArray(int length) {
return new Entry[length];
}
Reported by PMD.
Line: 147
Entry<String, Integer> entry = (Entry<String, Integer>) o;
builder.put(entry);
}
return builder.build().entrySet().asList();
}
}
public static class ImmutableEnumMapGenerator extends TestEnumMapGenerator {
@Override
Reported by PMD.
Line: 147
Entry<String, Integer> entry = (Entry<String, Integer>) o;
builder.put(entry);
}
return builder.build().entrySet().asList();
}
}
public static class ImmutableEnumMapGenerator extends TestEnumMapGenerator {
@Override
Reported by PMD.
Line: 179
@Override
public int compare(Entry<AnEnum, String> left, Entry<AnEnum, String> right) {
return left.getKey().compareTo(right.getKey());
}
}.sortedCopy(insertionOrder);
}
}
Reported by PMD.
Line: 210
for (Object elem : elements) {
@SuppressWarnings("unchecked") // safe by generator contract
Entry<String, Collection<Integer>> entry = (Entry<String, Collection<Integer>>) elem;
Integer value = Iterables.getOnlyElement(entry.getValue());
builder.put(entry.getKey(), value);
}
return builder.build().asMultimap().asMap();
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/testers/ListEqualsTester.java
14 issues
Line: 38
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListEqualsTester<E> extends AbstractListTester<E> {
public void testEquals_otherListWithSameElements() {
assertTrue(
"A List should equal any other List containing the same elements.",
getList().equals(new ArrayList<E>(getOrderedElements())));
}
Reported by PMD.
Line: 44
getList().equals(new ArrayList<E>(getOrderedElements())));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherListWithDifferentElements() {
ArrayList<E> other = new ArrayList<>(getSampleElements());
other.set(other.size() / 2, getSubjectGenerator().samples().e3());
assertFalse(
"A List should not equal another List containing different elements.",
Reported by PMD.
Line: 47
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherListWithDifferentElements() {
ArrayList<E> other = new ArrayList<>(getSampleElements());
other.set(other.size() / 2, getSubjectGenerator().samples().e3());
assertFalse(
"A List should not equal another List containing different elements.",
getList().equals(other));
}
Reported by PMD.
Line: 47
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherListWithDifferentElements() {
ArrayList<E> other = new ArrayList<>(getSampleElements());
other.set(other.size() / 2, getSubjectGenerator().samples().e3());
assertFalse(
"A List should not equal another List containing different elements.",
getList().equals(other));
}
Reported by PMD.
Line: 50
other.set(other.size() / 2, getSubjectGenerator().samples().e3());
assertFalse(
"A List should not equal another List containing different elements.",
getList().equals(other));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherListContainingNull() {
List<E> other = new ArrayList<>(getSampleElements());
Reported by PMD.
Line: 53
getList().equals(other));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_otherListContainingNull() {
List<E> other = new ArrayList<>(getSampleElements());
other.set(other.size() / 2, null);
assertFalse(
"Two Lists should not be equal if exactly one of them has null at a given index.",
Reported by PMD.
Line: 59
other.set(other.size() / 2, null);
assertFalse(
"Two Lists should not be equal if exactly one of them has null at a given index.",
getList().equals(other));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
public void testEquals_containingNull() {
Reported by PMD.
Line: 62
getList().equals(other));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
public void testEquals_containingNull() {
ArrayList<E> elements = new ArrayList<>(getSampleElements());
elements.set(elements.size() / 2, null);
collection = getSubjectGenerator().create(elements.toArray());
Reported by PMD.
Line: 67
public void testEquals_containingNull() {
ArrayList<E> elements = new ArrayList<>(getSampleElements());
elements.set(elements.size() / 2, null);
collection = getSubjectGenerator().create(elements.toArray());
List<E> other = new ArrayList<>(getSampleElements());
assertFalse(
"Two Lists should not be equal if exactly one of them has null at a given index.",
getList().equals(other));
}
Reported by PMD.
Line: 71
List<E> other = new ArrayList<>(getSampleElements());
assertFalse(
"Two Lists should not be equal if exactly one of them has null at a given index.",
getList().equals(other));
}
@CollectionSize.Require(absent = CollectionSize.ZERO)
public void testEquals_shorterList() {
Collection<E> fewerElements = getSampleElements(getNumElements() - 1);
Reported by PMD.
android/guava-tests/test/com/google/common/collect/CountTest.java
14 issues
Line: 27
*/
@GwtCompatible
public class CountTest extends TestCase {
public void testGet() {
assertEquals(20, new Count(20).get());
}
public void testGetAndAdd() {
Count holder = new Count(20);
Reported by PMD.
Line: 28
@GwtCompatible
public class CountTest extends TestCase {
public void testGet() {
assertEquals(20, new Count(20).get());
}
public void testGetAndAdd() {
Count holder = new Count(20);
assertEquals(20, holder.get());
Reported by PMD.
Line: 31
assertEquals(20, new Count(20).get());
}
public void testGetAndAdd() {
Count holder = new Count(20);
assertEquals(20, holder.get());
holder.add(1);
assertEquals(21, holder.get());
}
Reported by PMD.
Line: 31
assertEquals(20, new Count(20).get());
}
public void testGetAndAdd() {
Count holder = new Count(20);
assertEquals(20, holder.get());
holder.add(1);
assertEquals(21, holder.get());
}
Reported by PMD.
Line: 33
public void testGetAndAdd() {
Count holder = new Count(20);
assertEquals(20, holder.get());
holder.add(1);
assertEquals(21, holder.get());
}
public void testAddAndGet() {
Reported by PMD.
Line: 35
Count holder = new Count(20);
assertEquals(20, holder.get());
holder.add(1);
assertEquals(21, holder.get());
}
public void testAddAndGet() {
Count holder = new Count(20);
assertEquals(21, holder.addAndGet(1));
Reported by PMD.
Line: 38
assertEquals(21, holder.get());
}
public void testAddAndGet() {
Count holder = new Count(20);
assertEquals(21, holder.addAndGet(1));
}
public void testGetAndSet() {
Reported by PMD.
Line: 40
public void testAddAndGet() {
Count holder = new Count(20);
assertEquals(21, holder.addAndGet(1));
}
public void testGetAndSet() {
Count holder = new Count(10);
assertEquals(10, holder.getAndSet(20));
Reported by PMD.
Line: 43
assertEquals(21, holder.addAndGet(1));
}
public void testGetAndSet() {
Count holder = new Count(10);
assertEquals(10, holder.getAndSet(20));
assertEquals(20, holder.get());
}
Reported by PMD.
Line: 43
assertEquals(21, holder.addAndGet(1));
}
public void testGetAndSet() {
Count holder = new Count(10);
assertEquals(10, holder.getAndSet(20));
assertEquals(20, holder.get());
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveAllTester.java
14 issues
Line: 44
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapRemoveAllTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllAbsentKey() {
assertEmpty(multimap().removeAll(k3()));
expectUnchanged();
}
Reported by PMD.
Line: 46
public class MultimapRemoveAllTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllAbsentKey() {
assertEmpty(multimap().removeAll(k3()));
expectUnchanged();
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 50
expectUnchanged();
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllPresentKey() {
assertContentsAnyOrder(multimap().removeAll(k0()), v0());
expectMissing(e0());
}
Reported by PMD.
Line: 53
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllPresentKey() {
assertContentsAnyOrder(multimap().removeAll(k0()), v0());
expectMissing(e0());
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 57
expectMissing(e0());
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllPropagatesToGet() {
Collection<V> getResult = multimap().get(k0());
multimap().removeAll(k0());
Reported by PMD.
Line: 60
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllPropagatesToGet() {
Collection<V> getResult = multimap().get(k0());
multimap().removeAll(k0());
assertEmpty(getResult);
expectMissing(e0());
Reported by PMD.
Line: 62
public void testRemoveAllPropagatesToGet() {
Collection<V> getResult = multimap().get(k0());
multimap().removeAll(k0());
assertEmpty(getResult);
expectMissing(e0());
}
Reported by PMD.
Line: 68
expectMissing(e0());
}
@CollectionSize.Require(SEVERAL)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllMultipleValues() {
resetContainer(
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k0(), v2()));
Reported by PMD.
Line: 70
@CollectionSize.Require(SEVERAL)
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemoveAllMultipleValues() {
resetContainer(
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k0(), v2()));
assertContentsAnyOrder(multimap().removeAll(k0()), v0(), v1(), v2());
assertEmpty(multimap());
Reported by PMD.
Line: 74
resetContainer(
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k0(), v2()));
assertContentsAnyOrder(multimap().removeAll(k0()), v0(), v1(), v2());
assertEmpty(multimap());
}
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
Reported by PMD.
android/guava-tests/test/com/google/common/io/CharSinkTester.java
13 issues
Line: 54
String name, CharSinkFactory factory, String string, String desc) {
TestSuite stringSuite = new TestSuite(name + " [" + desc + "]");
for (final Method method : testMethods) {
stringSuite.addTest(new CharSinkTester(factory, string, name, desc, method));
}
return stringSuite;
}
private final ImmutableList<String> lines;
Reported by PMD.
Line: 59
return stringSuite;
}
private final ImmutableList<String> lines;
private final ImmutableList<String> expectedLines;
private CharSink sink;
public CharSinkTester(
Reported by PMD.
Line: 60
}
private final ImmutableList<String> lines;
private final ImmutableList<String> expectedLines;
private CharSink sink;
public CharSinkTester(
CharSinkFactory factory, String string, String suiteName, String caseDesc, Method method) {
Reported by PMD.
Line: 62
private final ImmutableList<String> lines;
private final ImmutableList<String> expectedLines;
private CharSink sink;
public CharSinkTester(
CharSinkFactory factory, String string, String suiteName, String caseDesc, Method method) {
super(factory, string, suiteName, caseDesc, method);
this.lines = getLines(string);
Reported by PMD.
Line: 71
this.expectedLines = getLines(expected);
}
@Override
protected void setUp() throws Exception {
this.sink = factory.createSink();
}
public void testOpenStream() throws IOException {
Reported by PMD.
Line: 76
this.sink = factory.createSink();
}
public void testOpenStream() throws IOException {
Writer writer = sink.openStream();
try {
writer.write(data);
} finally {
writer.close();
Reported by PMD.
Line: 78
public void testOpenStream() throws IOException {
Writer writer = sink.openStream();
try {
writer.write(data);
} finally {
writer.close();
}
Reported by PMD.
Line: 87
assertContainsExpectedString();
}
public void testOpenBufferedStream() throws IOException {
Writer writer = sink.openBufferedStream();
try {
writer.write(data);
} finally {
writer.close();
Reported by PMD.
Line: 89
public void testOpenBufferedStream() throws IOException {
Writer writer = sink.openBufferedStream();
try {
writer.write(data);
} finally {
writer.close();
}
Reported by PMD.
Line: 98
assertContainsExpectedString();
}
public void testWrite() throws IOException {
sink.write(data);
assertContainsExpectedString();
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/SafeTreeMap.java
13 issues
Line: 70
private SafeTreeMap(NavigableMap<K, V> delegate) {
this.delegate = delegate;
if (delegate == null) {
throw new NullPointerException();
}
for (K k : keySet()) {
checkValid(k);
}
}
Reported by PMD.
Line: 39
* @author Louis Wasserman
*/
@GwtIncompatible
public final class SafeTreeMap<K, V> implements Serializable, NavigableMap<K, V> {
@SuppressWarnings("unchecked")
private static final Comparator<Object> NATURAL_ORDER =
new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
Reported by PMD.
Line: 49
}
};
private final NavigableMap<K, V> delegate;
public SafeTreeMap() {
this(new TreeMap<K, V>());
}
Reported by PMD.
Line: 106
public boolean containsKey(Object key) {
try {
return delegate.containsKey(checkValid(key));
} catch (NullPointerException | ClassCastException e) {
return false;
}
}
@Override
Reported by PMD.
Line: 106
public boolean containsKey(Object key) {
try {
return delegate.containsKey(checkValid(key));
} catch (NullPointerException | ClassCastException e) {
return false;
}
}
@Override
Reported by PMD.
Line: 136
@Override
public boolean contains(Object object) {
try {
return delegate().contains(object);
} catch (NullPointerException | ClassCastException e) {
return false;
}
}
Reported by PMD.
Line: 137
public boolean contains(Object object) {
try {
return delegate().contains(object);
} catch (NullPointerException | ClassCastException e) {
return false;
}
}
@Override
Reported by PMD.
Line: 137
public boolean contains(Object object) {
try {
return delegate().contains(object);
} catch (NullPointerException | ClassCastException e) {
return false;
}
}
@Override
Reported by PMD.
Line: 144
@Override
public Iterator<Entry<K, V>> iterator() {
return delegate().iterator();
}
@Override
public int size() {
return delegate().size();
Reported by PMD.
Line: 149
@Override
public int size() {
return delegate().size();
}
@Override
public boolean remove(Object o) {
return delegate().remove(o);
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/BiMapEntrySetTester.java
13 issues
Line: 34
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapEntrySetTester<K, V> extends AbstractBiMapTester<K, V> {
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testSetValue_valueAbsent() {
for (Entry<K, V> entry : getMap().entrySet()) {
if (entry.getKey().equals(k0())) {
assertEquals("entry.setValue() should return the old value", v0(), entry.setValue(v3()));
Reported by PMD.
Line: 37
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(absent = ZERO)
public void testSetValue_valueAbsent() {
for (Entry<K, V> entry : getMap().entrySet()) {
if (entry.getKey().equals(k0())) {
assertEquals("entry.setValue() should return the old value", v0(), entry.setValue(v3()));
}
}
expectReplacement(entry(k0(), v3()));
Reported by PMD.
Line: 38
@CollectionSize.Require(absent = ZERO)
public void testSetValue_valueAbsent() {
for (Entry<K, V> entry : getMap().entrySet()) {
if (entry.getKey().equals(k0())) {
assertEquals("entry.setValue() should return the old value", v0(), entry.setValue(v3()));
}
}
expectReplacement(entry(k0(), v3()));
}
Reported by PMD.
Line: 45
expectReplacement(entry(k0(), v3()));
}
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(SEVERAL)
public void testSetValue_valuePresent() {
for (Entry<K, V> entry : getMap().entrySet()) {
if (entry.getKey().equals(k0())) {
try {
Reported by PMD.
Line: 48
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(SEVERAL)
public void testSetValue_valuePresent() {
for (Entry<K, V> entry : getMap().entrySet()) {
if (entry.getKey().equals(k0())) {
try {
entry.setValue(v1());
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
Reported by PMD.
Line: 49
@CollectionSize.Require(SEVERAL)
public void testSetValue_valuePresent() {
for (Entry<K, V> entry : getMap().entrySet()) {
if (entry.getKey().equals(k0())) {
try {
entry.setValue(v1());
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
Reported by PMD.
Line: 60
expectUnchanged();
}
@MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
@CollectionSize.Require(absent = ZERO)
public void testSetValueNullUnsupported() {
for (Entry<K, V> entry : getMap().entrySet()) {
try {
entry.setValue(null);
Reported by PMD.
Line: 63
@MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
@CollectionSize.Require(absent = ZERO)
public void testSetValueNullUnsupported() {
for (Entry<K, V> entry : getMap().entrySet()) {
try {
entry.setValue(null);
fail("Expected NullPointerException");
} catch (NullPointerException expected) {
}
Reported by PMD.
Line: 67
try {
entry.setValue(null);
fail("Expected NullPointerException");
} catch (NullPointerException expected) {
}
expectUnchanged();
}
}
Reported by PMD.
Line: 67
try {
entry.setValue(null);
fail("Expected NullPointerException");
} catch (NullPointerException expected) {
}
expectUnchanged();
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/TablesTest.java
13 issues
Line: 34
@GwtCompatible(emulated = true)
public class TablesTest extends TestCase {
@GwtIncompatible // SerializableTester
public void testImmutableEntrySerialization() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
SerializableTester.reserializeAndAssert(entry);
}
Reported by PMD.
Line: 35
public class TablesTest extends TestCase {
@GwtIncompatible // SerializableTester
public void testImmutableEntrySerialization() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
SerializableTester.reserializeAndAssert(entry);
}
public void testImmutableEntryToString() {
Reported by PMD.
Line: 36
@GwtIncompatible // SerializableTester
public void testImmutableEntrySerialization() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
SerializableTester.reserializeAndAssert(entry);
}
public void testImmutableEntryToString() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
Reported by PMD.
Line: 40
SerializableTester.reserializeAndAssert(entry);
}
public void testImmutableEntryToString() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
assertEquals("(foo,1)=a", entry.toString());
Cell<String, Integer, Character> nullEntry = Tables.immutableCell(null, null, null);
assertEquals("(null,null)=null", nullEntry.toString());
Reported by PMD.
Line: 40
SerializableTester.reserializeAndAssert(entry);
}
public void testImmutableEntryToString() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
assertEquals("(foo,1)=a", entry.toString());
Cell<String, Integer, Character> nullEntry = Tables.immutableCell(null, null, null);
assertEquals("(null,null)=null", nullEntry.toString());
Reported by PMD.
Line: 42
public void testImmutableEntryToString() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
assertEquals("(foo,1)=a", entry.toString());
Cell<String, Integer, Character> nullEntry = Tables.immutableCell(null, null, null);
assertEquals("(null,null)=null", nullEntry.toString());
}
Reported by PMD.
Line: 42
public void testImmutableEntryToString() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
assertEquals("(foo,1)=a", entry.toString());
Cell<String, Integer, Character> nullEntry = Tables.immutableCell(null, null, null);
assertEquals("(null,null)=null", nullEntry.toString());
}
Reported by PMD.
Line: 45
assertEquals("(foo,1)=a", entry.toString());
Cell<String, Integer, Character> nullEntry = Tables.immutableCell(null, null, null);
assertEquals("(null,null)=null", nullEntry.toString());
}
public void testEntryEquals() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
Reported by PMD.
Line: 45
assertEquals("(foo,1)=a", entry.toString());
Cell<String, Integer, Character> nullEntry = Tables.immutableCell(null, null, null);
assertEquals("(null,null)=null", nullEntry.toString());
}
public void testEntryEquals() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
Reported by PMD.
Line: 48
assertEquals("(null,null)=null", nullEntry.toString());
}
public void testEntryEquals() {
Cell<String, Integer, Character> entry = Tables.immutableCell("foo", 1, 'a');
new EqualsTester()
.addEqualityGroup(entry, Tables.immutableCell("foo", 1, 'a'))
.addEqualityGroup(Tables.immutableCell("bar", 1, 'a'))
Reported by PMD.