The following issues were found
android/guava-testlib/src/com/google/common/collect/testing/google/MultisetSetCountUnconditionallyTester.java
2 issues
Line: 35
void setCountCheckReturnValue(E element, int count) {
assertEquals(
"multiset.setCount() should return the old count",
getMultiset().count(element),
setCount(element, count));
}
@Override
void setCountNoCheckReturnValue(E element, int count) {
Reported by PMD.
Line: 45
}
private int setCount(E element, int count) {
return getMultiset().setCount(element, count);
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ForwardingListIteratorTest.java
2 issues
Line: 31
*/
public class ForwardingListIteratorTest extends TestCase {
@SuppressWarnings("rawtypes")
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
ListIterator.class,
new Function<ListIterator, ListIterator>() {
Reported by PMD.
Line: 32
public class ForwardingListIteratorTest extends TestCase {
@SuppressWarnings("rawtypes")
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
ListIterator.class,
new Function<ListIterator, ListIterator>() {
@Override
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ForwardingDequeTest.java
2 issues
Line: 31
*/
public class ForwardingDequeTest extends TestCase {
@SuppressWarnings("rawtypes")
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
Deque.class,
new Function<Deque, Deque>() {
Reported by PMD.
Line: 32
public class ForwardingDequeTest extends TestCase {
@SuppressWarnings("rawtypes")
public void testForwarding() {
new ForwardingWrapperTester()
.testForwarding(
Deque.class,
new Function<Deque, Deque>() {
@Override
Reported by PMD.
android/guava-testlib/test/com/google/common/collect/testing/MinimalSetTest.java
2 issues
Line: 30
*
* @author Regina O'Dell
*/
public class MinimalSetTest extends TestCase {
public static Test suite() {
return SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
Reported by PMD.
Line: 31
* @author Regina O'Dell
*/
public class MinimalSetTest extends TestCase {
public static Test suite() {
return SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
return MinimalSet.of(elements);
Reported by PMD.
android/guava-testlib/src/com/google/common/testing/FakeTicker.java
2 issues
Line: 42
@GwtCompatible
public class FakeTicker extends Ticker {
private final AtomicLong nanos = new AtomicLong();
private volatile long autoIncrementStepNanos;
/** Advances the ticker value by {@code time} in {@code timeUnit}. */
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
public FakeTicker advance(long time, TimeUnit timeUnit) {
Reported by PMD.
Line: 43
public class FakeTicker extends Ticker {
private final AtomicLong nanos = new AtomicLong();
private volatile long autoIncrementStepNanos;
/** Advances the ticker value by {@code time} in {@code timeUnit}. */
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
public FakeTicker advance(long time, TimeUnit timeUnit) {
return advance(timeUnit.toNanos(time));
Reported by PMD.
android/guava-tests/test/com/google/common/collect/BenchmarkHelpers.java
2 issues
Line: 256
@Override
public <K extends Comparable<K>, V> SortedMap<K, V> create(Map<K, V> map) {
SortedMap<K, V> result = Maps.newTreeMap();
result.putAll(map);
return result;
}
},
ConcurrentSkipListImpl {
@Override
Reported by PMD.
Line: 356
<R extends Comparable<R>, C extends Comparable<C>, V> Table<R, C, V> create(
Table<R, C, V> contents) {
Table<R, C, V> table = TreeBasedTable.create();
table.putAll(contents);
return table;
}
},
ArrayTableImpl {
@Override
Reported by PMD.
android/guava-tests/test/com/google/common/cache/TestingWeighers.java
2 issues
Line: 22
*
* @author Charles Fry
*/
public class TestingWeighers {
/** Returns a {@link Weigher} that returns the given {@code constant} for every request. */
static Weigher<Object, Object> constantWeigher(int constant) {
return new ConstantWeigher(constant);
}
Reported by PMD.
Line: 40
}
static final class ConstantWeigher implements Weigher<Object, Object> {
private final int constant;
ConstantWeigher(int constant) {
this.constant = constant;
}
Reported by PMD.
android/guava-tests/test/com/google/common/cache/RemovalNotificationTest.java
2 issues
Line: 29
*/
public class RemovalNotificationTest extends TestCase {
public void testEquals() {
new EqualsTester()
.addEqualityGroup(
RemovalNotification.create("one", 1, RemovalCause.EXPLICIT),
RemovalNotification.create("one", 1, RemovalCause.REPLACED))
.addEqualityGroup(RemovalNotification.create("1", 1, RemovalCause.EXPLICIT))
Reported by PMD.
Line: 29
*/
public class RemovalNotificationTest extends TestCase {
public void testEquals() {
new EqualsTester()
.addEqualityGroup(
RemovalNotification.create("one", 1, RemovalCause.EXPLICIT),
RemovalNotification.create("one", 1, RemovalCause.REPLACED))
.addEqualityGroup(RemovalNotification.create("1", 1, RemovalCause.EXPLICIT))
Reported by PMD.
android/guava-tests/test/com/google/common/io/CountingOutputStreamTest.java
2 issues
Line: 28
*/
public class CountingOutputStreamTest extends IoTestCase {
public void testCount() throws Exception {
int written = 0;
ByteArrayOutputStream out = new ByteArrayOutputStream();
CountingOutputStream counter = new CountingOutputStream(out);
assertEquals(written, out.size());
assertEquals(written, counter.getCount());
Reported by PMD.
Line: 28
*/
public class CountingOutputStreamTest extends IoTestCase {
public void testCount() throws Exception {
int written = 0;
ByteArrayOutputStream out = new ByteArrayOutputStream();
CountingOutputStream counter = new CountingOutputStream(out);
assertEquals(written, out.size());
assertEquals(written, counter.getCount());
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/testers/MapSizeTester.java
2 issues
Line: 32
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapSizeTester<K, V> extends AbstractMapTester<K, V> {
public void testSize() {
assertEquals("size():", getNumElements(), getMap().size());
}
}
Reported by PMD.
Line: 33
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapSizeTester<K, V> extends AbstractMapTester<K, V> {
public void testSize() {
assertEquals("size():", getNumElements(), getMap().size());
}
}
Reported by PMD.