The following issues were found
guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java
27 issues
Line: 47
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapAsMapTester<K, V> extends AbstractListMultimapTester<K, V> {
public void testAsMapValuesImplementList() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof List);
}
}
Reported by PMD.
Line: 48
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapAsMapTester<K, V> extends AbstractListMultimapTester<K, V> {
public void testAsMapValuesImplementList() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof List);
}
}
public void testAsMapGetImplementsList() {
Reported by PMD.
Line: 48
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapAsMapTester<K, V> extends AbstractListMultimapTester<K, V> {
public void testAsMapValuesImplementList() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof List);
}
}
public void testAsMapGetImplementsList() {
Reported by PMD.
Line: 53
}
}
public void testAsMapGetImplementsList() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof List);
}
}
Reported by PMD.
Line: 54
}
public void testAsMapGetImplementsList() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof List);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 55
public void testAsMapGetImplementsList() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof List);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsList() {
Reported by PMD.
Line: 55
public void testAsMapGetImplementsList() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof List);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsList() {
Reported by PMD.
Line: 59
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsList() {
List<K> keys = new ArrayList<>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof List);
Reported by PMD.
Line: 61
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsList() {
List<K> keys = new ArrayList<>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof List);
}
}
Reported by PMD.
Line: 64
List<K> keys = new ArrayList<>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof List);
}
}
@CollectionSize.Require(SEVERAL)
public void testEquals() {
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/AtomicsTest.java
27 issues
Line: 32
private static final Object OBJECT = new Object();
public void testNewReference() throws Exception {
assertEquals(null, Atomics.newReference().get());
}
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
Reported by PMD.
Line: 33
private static final Object OBJECT = new Object();
public void testNewReference() throws Exception {
assertEquals(null, Atomics.newReference().get());
}
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
Reported by PMD.
Line: 33
private static final Object OBJECT = new Object();
public void testNewReference() throws Exception {
assertEquals(null, Atomics.newReference().get());
}
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
Reported by PMD.
Line: 36
assertEquals(null, Atomics.newReference().get());
}
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
}
public void testNewReferenceArray_withLength() throws Exception {
Reported by PMD.
Line: 36
assertEquals(null, Atomics.newReference().get());
}
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
}
public void testNewReferenceArray_withLength() throws Exception {
Reported by PMD.
Line: 37
}
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
}
public void testNewReferenceArray_withLength() throws Exception {
int length = 42;
Reported by PMD.
Line: 37
}
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
}
public void testNewReferenceArray_withLength() throws Exception {
int length = 42;
Reported by PMD.
Line: 38
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
}
public void testNewReferenceArray_withLength() throws Exception {
int length = 42;
AtomicReferenceArray<String> refArray = Atomics.newReferenceArray(length);
Reported by PMD.
Line: 38
public void testNewReference_withInitialValue() throws Exception {
assertEquals(null, Atomics.newReference(null).get());
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
}
public void testNewReferenceArray_withLength() throws Exception {
int length = 42;
AtomicReferenceArray<String> refArray = Atomics.newReferenceArray(length);
Reported by PMD.
Line: 41
assertEquals(OBJECT, Atomics.newReference(OBJECT).get());
}
public void testNewReferenceArray_withLength() throws Exception {
int length = 42;
AtomicReferenceArray<String> refArray = Atomics.newReferenceArray(length);
for (int i = 0; i < length; ++i) {
assertEquals(null, refArray.get(i));
}
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/WrappingScheduledExecutorServiceTest.java
27 issues
Line: 45
public void run() {}
};
public void testSchedule() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = testExecutor.schedule(DO_NOTHING, 10, TimeUnit.MINUTES);
Reported by PMD.
Line: 45
public void run() {}
};
public void testSchedule() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = testExecutor.schedule(DO_NOTHING, 10, TimeUnit.MINUTES);
Reported by PMD.
Line: 49
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = testExecutor.schedule(DO_NOTHING, 10, TimeUnit.MINUTES);
mock.assertLastMethodCalled("scheduleRunnable", 10, TimeUnit.MINUTES);
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError1 =
Reported by PMD.
Line: 59
mock.assertLastMethodCalled("scheduleCallable", 5, TimeUnit.SECONDS);
}
public void testSchedule_repeating() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError =
testExecutor.scheduleWithFixedDelay(DO_NOTHING, 100, 10, TimeUnit.MINUTES);
Reported by PMD.
Line: 59
mock.assertLastMethodCalled("scheduleCallable", 5, TimeUnit.SECONDS);
}
public void testSchedule_repeating() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError =
testExecutor.scheduleWithFixedDelay(DO_NOTHING, 100, 10, TimeUnit.MINUTES);
Reported by PMD.
Line: 74
}
private static final class WrappedCallable<T> implements Callable<T> {
private final Callable<T> delegate;
public WrappedCallable(Callable<T> delegate) {
this.delegate = delegate;
}
Reported by PMD.
Line: 87
}
private static final class WrappedRunnable implements Runnable {
private final Runnable delegate;
public WrappedRunnable(Runnable delegate) {
this.delegate = delegate;
}
Reported by PMD.
Line: 115
}
}
private static final class MockExecutor implements ScheduledExecutorService {
String lastMethodCalled = "";
long lastInitialDelay;
long lastDelay;
TimeUnit lastUnit;
Reported by PMD.
Line: 116
}
private static final class MockExecutor implements ScheduledExecutorService {
String lastMethodCalled = "";
long lastInitialDelay;
long lastDelay;
TimeUnit lastUnit;
void assertLastMethodCalled(String method, long delay, TimeUnit unit) {
Reported by PMD.
Line: 117
private static final class MockExecutor implements ScheduledExecutorService {
String lastMethodCalled = "";
long lastInitialDelay;
long lastDelay;
TimeUnit lastUnit;
void assertLastMethodCalled(String method, long delay, TimeUnit unit) {
assertEquals(method, lastMethodCalled);
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/BiMapRemoveTester.java
27 issues
Line: 38
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapRemoveTester<K, V> extends AbstractBiMapTester<K, V> {
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyRemovesFromInverse() {
getMap().remove(k0());
expectMissing(e0());
Reported by PMD.
Line: 38
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapRemoveTester<K, V> extends AbstractBiMapTester<K, V> {
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyRemovesFromInverse() {
getMap().remove(k0());
expectMissing(e0());
Reported by PMD.
Line: 42
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyRemovesFromInverse() {
getMap().remove(k0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 46
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyFromKeySetRemovesFromInverse() {
getMap().keySet().remove(k0());
expectMissing(e0());
Reported by PMD.
Line: 50
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyFromKeySetRemovesFromInverse() {
getMap().keySet().remove(k0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 50
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyFromKeySetRemovesFromInverse() {
getMap().keySet().remove(k0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 54
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveFromValuesRemovesFromInverse() {
getMap().values().remove(v0());
expectMissing(e0());
Reported by PMD.
Line: 58
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveFromValuesRemovesFromInverse() {
getMap().values().remove(v0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 58
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveFromValuesRemovesFromInverse() {
getMap().values().remove(v0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 62
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveFromInverseRemovesFromForward() {
getMap().inverse().remove(v0());
expectMissing(e0());
Reported by PMD.
android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
27 issues
Line: 431
continue;
}
return oldValue;
}
}
/**
* If {@code (key, expectedOldValue)} is currently in the map, this method replaces {@code
Reported by PMD.
Line: 58
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class AtomicLongMap<K> implements Serializable {
private final ConcurrentHashMap<K, AtomicLong> map;
private AtomicLongMap(ConcurrentHashMap<K, AtomicLong> map) {
this.map = checkNotNull(map);
}
Reported by PMD.
Line: 58
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class AtomicLongMap<K> implements Serializable {
private final ConcurrentHashMap<K, AtomicLong> map;
private AtomicLongMap(ConcurrentHashMap<K, AtomicLong> map) {
this.map = checkNotNull(map);
}
Reported by PMD.
Line: 59
@GwtCompatible
@ElementTypesAreNonnullByDefault
public final class AtomicLongMap<K> implements Serializable {
private final ConcurrentHashMap<K, AtomicLong> map;
private AtomicLongMap(ConcurrentHashMap<K, AtomicLong> map) {
this.map = checkNotNull(map);
}
Reported by PMD.
Line: 73
/** Creates an {@code AtomicLongMap} with the same mappings as the specified {@code Map}. */
public static <K> AtomicLongMap<K> create(Map<? extends K, ? extends Long> m) {
AtomicLongMap<K> result = create();
result.putAll(m);
return result;
}
/**
* Returns the value associated with {@code key}, or zero if there is no value associated with
Reported by PMD.
Line: 83
*/
public long get(K key) {
AtomicLong atomic = map.get(key);
return atomic == null ? 0L : atomic.get();
}
/**
* Increments by one the value currently associated with {@code key}, and returns the new value.
*/
Reported by PMD.
Line: 112
while (true) {
AtomicLong atomic = map.get(key);
if (atomic == null) {
atomic = map.putIfAbsent(key, new AtomicLong(delta));
if (atomic == null) {
return delta;
}
// atomic is now non-null; fall through
}
Reported by PMD.
Line: 121
while (true) {
long oldValue = atomic.get();
if (oldValue == 0L) {
// don't compareAndSet a zero
if (map.replace(key, atomic, new AtomicLong(delta))) {
return delta;
}
// atomic replaced
Reported by PMD.
Line: 123
long oldValue = atomic.get();
if (oldValue == 0L) {
// don't compareAndSet a zero
if (map.replace(key, atomic, new AtomicLong(delta))) {
return delta;
}
// atomic replaced
continue outer;
}
Reported by PMD.
Line: 165
while (true) {
AtomicLong atomic = map.get(key);
if (atomic == null) {
atomic = map.putIfAbsent(key, new AtomicLong(delta));
if (atomic == null) {
return 0L;
}
// atomic is now non-null; fall through
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/BiMapRemoveTester.java
27 issues
Line: 38
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapRemoveTester<K, V> extends AbstractBiMapTester<K, V> {
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyRemovesFromInverse() {
getMap().remove(k0());
expectMissing(e0());
Reported by PMD.
Line: 38
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapRemoveTester<K, V> extends AbstractBiMapTester<K, V> {
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyRemovesFromInverse() {
getMap().remove(k0());
expectMissing(e0());
Reported by PMD.
Line: 42
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyRemovesFromInverse() {
getMap().remove(k0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 46
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyFromKeySetRemovesFromInverse() {
getMap().keySet().remove(k0());
expectMissing(e0());
Reported by PMD.
Line: 50
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyFromKeySetRemovesFromInverse() {
getMap().keySet().remove(k0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 50
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveKeyFromKeySetRemovesFromInverse() {
getMap().keySet().remove(k0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 54
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveFromValuesRemovesFromInverse() {
getMap().values().remove(v0());
expectMissing(e0());
Reported by PMD.
Line: 58
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveFromValuesRemovesFromInverse() {
getMap().values().remove(v0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 58
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveFromValuesRemovesFromInverse() {
getMap().values().remove(v0());
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 62
expectMissing(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemoveFromInverseRemovesFromForward() {
getMap().inverse().remove(v0());
expectMissing(e0());
Reported by PMD.
android/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java
27 issues
Line: 151
private static final Chopper TEST_SUFFIX =
suffix("Test").or(suffix("Tests")).or(suffix("TestCase")).or(suffix("TestSuite"));
private final Logger logger = Logger.getLogger(getClass().getName());
private final ClassSanityTester tester = new ClassSanityTester();
private Visibility visibility = Visibility.PACKAGE;
private Predicate<Class<?>> classFilter =
new Predicate<Class<?>>() {
@Override
Reported by PMD.
Line: 386
cls = classInfo.load();
} catch (NoClassDefFoundError e) {
// In case there were linking problems, this is probably not a class we care to test anyway.
logger.log(Level.SEVERE, "Cannot load class " + classInfo + ", skipping...", e);
continue;
}
if (!cls.isInterface()) {
classes.add(cls);
}
Reported by PMD.
Line: 122
new Predicate<Class<?>>() {
@Override
public boolean apply(Class<?> c) {
return c.getSimpleName().contains("_");
}
};
/* The names of the expected method that tests null checks. */
private static final ImmutableList<String> NULL_TEST_METHOD_NAMES =
Reported by PMD.
Line: 151
private static final Chopper TEST_SUFFIX =
suffix("Test").or(suffix("Tests")).or(suffix("TestCase")).or(suffix("TestSuite"));
private final Logger logger = Logger.getLogger(getClass().getName());
private final ClassSanityTester tester = new ClassSanityTester();
private Visibility visibility = Visibility.PACKAGE;
private Predicate<Class<?>> classFilter =
new Predicate<Class<?>>() {
@Override
Reported by PMD.
Line: 152
suffix("Test").or(suffix("Tests")).or(suffix("TestCase")).or(suffix("TestSuite"));
private final Logger logger = Logger.getLogger(getClass().getName());
private final ClassSanityTester tester = new ClassSanityTester();
private Visibility visibility = Visibility.PACKAGE;
private Predicate<Class<?>> classFilter =
new Predicate<Class<?>>() {
@Override
public boolean apply(Class<?> cls) {
Reported by PMD.
Line: 153
private final Logger logger = Logger.getLogger(getClass().getName());
private final ClassSanityTester tester = new ClassSanityTester();
private Visibility visibility = Visibility.PACKAGE;
private Predicate<Class<?>> classFilter =
new Predicate<Class<?>>() {
@Override
public boolean apply(Class<?> cls) {
return visibility.isVisible(cls.getModifiers());
Reported by PMD.
Line: 154
private final Logger logger = Logger.getLogger(getClass().getName());
private final ClassSanityTester tester = new ClassSanityTester();
private Visibility visibility = Visibility.PACKAGE;
private Predicate<Class<?>> classFilter =
new Predicate<Class<?>>() {
@Override
public boolean apply(Class<?> cls) {
return visibility.isVisible(cls.getModifiers());
}
Reported by PMD.
Line: 199
* C} will be excluded from automated serialization test performed by this method.
*/
@Test
public void testSerializable() throws Exception {
// TODO: when we use @BeforeClass, we can pay the cost of class path scanning only once.
for (Class<?> classToTest :
findClassesToTest(loadClassesInPackage(), SERIALIZABLE_TEST_METHOD_NAMES)) {
if (Serializable.class.isAssignableFrom(classToTest)) {
try {
Reported by PMD.
Line: 213
SerializableTester.reserialize(instance);
}
}
} catch (Throwable e) {
throw sanityError(classToTest, SERIALIZABLE_TEST_METHOD_NAMES, "serializable test", e);
}
}
}
}
Reported by PMD.
Line: 244
* excluded from the automated null tests performed by this method.
*/
@Test
public void testNulls() throws Exception {
for (Class<?> classToTest : findClassesToTest(loadClassesInPackage(), NULL_TEST_METHOD_NAMES)) {
try {
tester.doTestNulls(classToTest, visibility);
} catch (Throwable e) {
throw sanityError(classToTest, NULL_TEST_METHOD_NAMES, "nulls test", e);
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java
27 issues
Line: 47
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapAsMapTester<K, V> extends AbstractListMultimapTester<K, V> {
public void testAsMapValuesImplementList() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof List);
}
}
Reported by PMD.
Line: 48
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapAsMapTester<K, V> extends AbstractListMultimapTester<K, V> {
public void testAsMapValuesImplementList() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof List);
}
}
public void testAsMapGetImplementsList() {
Reported by PMD.
Line: 48
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListMultimapAsMapTester<K, V> extends AbstractListMultimapTester<K, V> {
public void testAsMapValuesImplementList() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof List);
}
}
public void testAsMapGetImplementsList() {
Reported by PMD.
Line: 53
}
}
public void testAsMapGetImplementsList() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof List);
}
}
Reported by PMD.
Line: 54
}
public void testAsMapGetImplementsList() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof List);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 55
public void testAsMapGetImplementsList() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof List);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsList() {
Reported by PMD.
Line: 55
public void testAsMapGetImplementsList() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof List);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsList() {
Reported by PMD.
Line: 59
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsList() {
List<K> keys = new ArrayList<>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof List);
Reported by PMD.
Line: 61
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsList() {
List<K> keys = new ArrayList<>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof List);
}
}
Reported by PMD.
Line: 64
List<K> keys = new ArrayList<>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof List);
}
}
@CollectionSize.Require(SEVERAL)
public void testEquals() {
Reported by PMD.
android/guava-tests/test/com/google/common/cache/ForwardingCacheTest.java
27 issues
Line: 34
* @author Charles Fry
*/
public class ForwardingCacheTest extends TestCase {
private Cache<String, Boolean> forward;
private Cache<String, Boolean> mock;
@SuppressWarnings({"unchecked", "DoNotMock"}) // mock
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 35
*/
public class ForwardingCacheTest extends TestCase {
private Cache<String, Boolean> forward;
private Cache<String, Boolean> mock;
@SuppressWarnings({"unchecked", "DoNotMock"}) // mock
@Override
public void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 37
private Cache<String, Boolean> forward;
private Cache<String, Boolean> mock;
@SuppressWarnings({"unchecked", "DoNotMock"}) // mock
@Override
public void setUp() throws Exception {
super.setUp();
/*
* Class parameters must be raw, so we can't create a proxy with generic
Reported by PMD.
Line: 56
};
}
public void testGetIfPresent() throws ExecutionException {
when(mock.getIfPresent("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.getIfPresent("key"));
}
public void testGetAllPresent() throws ExecutionException {
Reported by PMD.
Line: 57
}
public void testGetIfPresent() throws ExecutionException {
when(mock.getIfPresent("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.getIfPresent("key"));
}
public void testGetAllPresent() throws ExecutionException {
when(mock.getAllPresent(ImmutableList.of("key")))
Reported by PMD.
Line: 57
}
public void testGetIfPresent() throws ExecutionException {
when(mock.getIfPresent("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.getIfPresent("key"));
}
public void testGetAllPresent() throws ExecutionException {
when(mock.getAllPresent(ImmutableList.of("key")))
Reported by PMD.
Line: 58
public void testGetIfPresent() throws ExecutionException {
when(mock.getIfPresent("key")).thenReturn(Boolean.TRUE);
assertSame(Boolean.TRUE, forward.getIfPresent("key"));
}
public void testGetAllPresent() throws ExecutionException {
when(mock.getAllPresent(ImmutableList.of("key")))
.thenReturn(ImmutableMap.of("key", Boolean.TRUE));
Reported by PMD.
Line: 61
assertSame(Boolean.TRUE, forward.getIfPresent("key"));
}
public void testGetAllPresent() throws ExecutionException {
when(mock.getAllPresent(ImmutableList.of("key")))
.thenReturn(ImmutableMap.of("key", Boolean.TRUE));
assertEquals(
ImmutableMap.of("key", Boolean.TRUE), forward.getAllPresent(ImmutableList.of("key")));
}
Reported by PMD.
Line: 62
}
public void testGetAllPresent() throws ExecutionException {
when(mock.getAllPresent(ImmutableList.of("key")))
.thenReturn(ImmutableMap.of("key", Boolean.TRUE));
assertEquals(
ImmutableMap.of("key", Boolean.TRUE), forward.getAllPresent(ImmutableList.of("key")));
}
Reported by PMD.
Line: 64
public void testGetAllPresent() throws ExecutionException {
when(mock.getAllPresent(ImmutableList.of("key")))
.thenReturn(ImmutableMap.of("key", Boolean.TRUE));
assertEquals(
ImmutableMap.of("key", Boolean.TRUE), forward.getAllPresent(ImmutableList.of("key")));
}
public void testInvalidate() {
forward.invalidate("key");
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java
27 issues
Line: 47
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class SetMultimapAsMapTester<K, V> extends AbstractMultimapTester<K, V, SetMultimap<K, V>> {
public void testAsMapValuesImplementSet() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof Set);
}
}
Reported by PMD.
Line: 48
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class SetMultimapAsMapTester<K, V> extends AbstractMultimapTester<K, V, SetMultimap<K, V>> {
public void testAsMapValuesImplementSet() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof Set);
}
}
public void testAsMapGetImplementsSet() {
Reported by PMD.
Line: 48
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class SetMultimapAsMapTester<K, V> extends AbstractMultimapTester<K, V, SetMultimap<K, V>> {
public void testAsMapValuesImplementSet() {
for (Collection<V> valueCollection : multimap().asMap().values()) {
assertTrue(valueCollection instanceof Set);
}
}
public void testAsMapGetImplementsSet() {
Reported by PMD.
Line: 53
}
}
public void testAsMapGetImplementsSet() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof Set);
}
}
Reported by PMD.
Line: 54
}
public void testAsMapGetImplementsSet() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof Set);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 55
public void testAsMapGetImplementsSet() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof Set);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsSet() {
Reported by PMD.
Line: 55
public void testAsMapGetImplementsSet() {
for (K key : multimap().keySet()) {
assertTrue(multimap().asMap().get(key) instanceof Set);
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsSet() {
Reported by PMD.
Line: 59
}
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsSet() {
List<K> keys = new ArrayList<K>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof Set);
Reported by PMD.
Line: 61
@MapFeature.Require(SUPPORTS_REMOVE)
public void testAsMapRemoveImplementsSet() {
List<K> keys = new ArrayList<K>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof Set);
}
}
Reported by PMD.
Line: 64
List<K> keys = new ArrayList<K>(multimap().keySet());
for (K key : keys) {
resetCollection();
assertTrue(multimap().asMap().remove(key) instanceof Set);
}
}
@CollectionSize.Require(SEVERAL)
public void testEquals() {
Reported by PMD.