The following issues were found
android/guava-tests/test/com/google/common/base/SuppliersTest.java
154 issues
Line: 63
static class ThrowingSupplier implements Supplier<Integer> {
@Override
public Integer get() {
throw new NullPointerException();
}
}
static class SerializableCountingSupplier extends CountingSupplier implements Serializable {
private static final long serialVersionUID = 0L;
Reported by PMD.
Line: 43
* @author Harry Heymann
*/
@GwtCompatible(emulated = true)
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
Reported by PMD.
Line: 43
* @author Harry Heymann
*/
@GwtCompatible(emulated = true)
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
Reported by PMD.
Line: 43
* @author Harry Heymann
*/
@GwtCompatible(emulated = true)
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
Reported by PMD.
Line: 46
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
public Integer get() {
calls++;
return calls * 10;
Reported by PMD.
Line: 46
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
public Integer get() {
calls++;
return calls * 10;
Reported by PMD.
Line: 77
static void checkMemoize(CountingSupplier countingSupplier, Supplier<Integer> memoizedSupplier) {
// the underlying supplier hasn't executed yet
assertEquals(0, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
// now it has
assertEquals(1, countingSupplier.calls);
Reported by PMD.
Line: 79
// the underlying supplier hasn't executed yet
assertEquals(0, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
// now it has
assertEquals(1, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
Reported by PMD.
Line: 82
assertEquals(10, (int) memoizedSupplier.get());
// now it has
assertEquals(1, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
// it still should only have executed once due to memoization
assertEquals(1, countingSupplier.calls);
Reported by PMD.
Line: 84
// now it has
assertEquals(1, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
// it still should only have executed once due to memoization
assertEquals(1, countingSupplier.calls);
}
Reported by PMD.
guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java
152 issues
Line: 38
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class TreeMultimapExplicitTest extends TestCase {
/**
* Compare strings lengths, and if the lengths are equal compare the strings. A {@code null} is
* less than any non-null value.
*/
Reported by PMD.
Line: 49
@Override
public int compare(String first, String second) {
if (first == second) {
return 0;
} else if (first == null) {
return -1;
} else if (second == null) {
return 1;
Reported by PMD.
Line: 49
@Override
public int compare(String first, String second) {
if (first == second) {
return 0;
} else if (first == null) {
return -1;
} else if (second == null) {
return 1;
Reported by PMD.
Line: 55
return -1;
} else if (second == null) {
return 1;
} else if (first.length() != second.length()) {
return first.length() - second.length();
} else {
return first.compareTo(second);
}
}
Reported by PMD.
Line: 55
return -1;
} else if (second == null) {
return 1;
} else if (first.length() != second.length()) {
return first.length() - second.length();
} else {
return first.compareTo(second);
}
}
Reported by PMD.
Line: 75
private TreeMultimap<String, Integer> createPopulate() {
TreeMultimap<String, Integer> multimap =
TreeMultimap.create(StringLength.COMPARATOR, DECREASING_INT_COMPARATOR);
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
Reported by PMD.
Line: 75
private TreeMultimap<String, Integer> createPopulate() {
TreeMultimap<String, Integer> multimap =
TreeMultimap.create(StringLength.COMPARATOR, DECREASING_INT_COMPARATOR);
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
Reported by PMD.
Line: 76
TreeMultimap<String, Integer> multimap =
TreeMultimap.create(StringLength.COMPARATOR, DECREASING_INT_COMPARATOR);
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
multimap.put("tree", null);
Reported by PMD.
Line: 77
TreeMultimap.create(StringLength.COMPARATOR, DECREASING_INT_COMPARATOR);
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
multimap.put("tree", null);
return multimap;
Reported by PMD.
Line: 78
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
multimap.put("tree", null);
return multimap;
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java
152 issues
Line: 38
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class TreeMultimapExplicitTest extends TestCase {
/**
* Compare strings lengths, and if the lengths are equal compare the strings. A {@code null} is
* less than any non-null value.
*/
Reported by PMD.
Line: 49
@Override
public int compare(String first, String second) {
if (first == second) {
return 0;
} else if (first == null) {
return -1;
} else if (second == null) {
return 1;
Reported by PMD.
Line: 49
@Override
public int compare(String first, String second) {
if (first == second) {
return 0;
} else if (first == null) {
return -1;
} else if (second == null) {
return 1;
Reported by PMD.
Line: 55
return -1;
} else if (second == null) {
return 1;
} else if (first.length() != second.length()) {
return first.length() - second.length();
} else {
return first.compareTo(second);
}
}
Reported by PMD.
Line: 55
return -1;
} else if (second == null) {
return 1;
} else if (first.length() != second.length()) {
return first.length() - second.length();
} else {
return first.compareTo(second);
}
}
Reported by PMD.
Line: 75
private TreeMultimap<String, Integer> createPopulate() {
TreeMultimap<String, Integer> multimap =
TreeMultimap.create(StringLength.COMPARATOR, DECREASING_INT_COMPARATOR);
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
Reported by PMD.
Line: 75
private TreeMultimap<String, Integer> createPopulate() {
TreeMultimap<String, Integer> multimap =
TreeMultimap.create(StringLength.COMPARATOR, DECREASING_INT_COMPARATOR);
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
Reported by PMD.
Line: 76
TreeMultimap<String, Integer> multimap =
TreeMultimap.create(StringLength.COMPARATOR, DECREASING_INT_COMPARATOR);
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
multimap.put("tree", null);
Reported by PMD.
Line: 77
TreeMultimap.create(StringLength.COMPARATOR, DECREASING_INT_COMPARATOR);
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
multimap.put("tree", null);
return multimap;
Reported by PMD.
Line: 78
multimap.put("google", 2);
multimap.put("google", 6);
multimap.put(null, 3);
multimap.put(null, 1);
multimap.put(null, 7);
multimap.put("tree", 0);
multimap.put("tree", null);
return multimap;
}
Reported by PMD.
android/guava-tests/test/com/google/common/base/StringsTest.java
152 issues
Line: 32
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
Reported by PMD.
Line: 33
*/
@GwtCompatible(emulated = true)
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
Reported by PMD.
Line: 33
*/
@GwtCompatible(emulated = true)
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
Reported by PMD.
Line: 34
@GwtCompatible(emulated = true)
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
Reported by PMD.
Line: 35
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
Reported by PMD.
Line: 36
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
Reported by PMD.
Line: 39
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
assertEquals("a", Strings.emptyToNull("a"));
}
Reported by PMD.
Line: 39
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
assertEquals("a", Strings.emptyToNull("a"));
}
Reported by PMD.
Line: 40
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
assertEquals("a", Strings.emptyToNull("a"));
}
public void testIsNullOrEmpty() {
Reported by PMD.
Line: 41
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
assertEquals("a", Strings.emptyToNull("a"));
}
public void testIsNullOrEmpty() {
assertTrue(Strings.isNullOrEmpty(null));
Reported by PMD.
guava-tests/test/com/google/common/base/StringsTest.java
152 issues
Line: 32
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
Reported by PMD.
Line: 33
*/
@GwtCompatible(emulated = true)
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
Reported by PMD.
Line: 33
*/
@GwtCompatible(emulated = true)
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
Reported by PMD.
Line: 34
@GwtCompatible(emulated = true)
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
Reported by PMD.
Line: 35
public class StringsTest extends TestCase {
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
Reported by PMD.
Line: 36
public void testNullToEmpty() {
assertEquals("", Strings.nullToEmpty(null));
assertEquals("", Strings.nullToEmpty(""));
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
Reported by PMD.
Line: 39
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
assertEquals("a", Strings.emptyToNull("a"));
}
Reported by PMD.
Line: 39
assertEquals("a", Strings.nullToEmpty("a"));
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
assertEquals("a", Strings.emptyToNull("a"));
}
Reported by PMD.
Line: 40
}
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
assertEquals("a", Strings.emptyToNull("a"));
}
public void testIsNullOrEmpty() {
Reported by PMD.
Line: 41
public void testEmptyToNull() {
assertNull(Strings.emptyToNull(null));
assertNull(Strings.emptyToNull(""));
assertEquals("a", Strings.emptyToNull("a"));
}
public void testIsNullOrEmpty() {
assertTrue(Strings.isNullOrEmpty(null));
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java
151 issues
Line: 42
import junit.framework.TestCase;
/** Tests for {@link ExecutionSequencer} */
public class ExecutionSequencerTest extends TestCase {
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
Reported by PMD.
Line: 42
import junit.framework.TestCase;
/** Tests for {@link ExecutionSequencer} */
public class ExecutionSequencerTest extends TestCase {
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
Reported by PMD.
Line: 42
import junit.framework.TestCase;
/** Tests for {@link ExecutionSequencer} */
public class ExecutionSequencerTest extends TestCase {
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
Reported by PMD.
Line: 44
/** Tests for {@link ExecutionSequencer} */
public class ExecutionSequencerTest extends TestCase {
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
Reported by PMD.
Line: 46
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 47
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
@Override
public void setUp() throws Exception {
executor = Executors.newCachedThreadPool();
Reported by PMD.
Line: 48
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
@Override
public void setUp() throws Exception {
executor = Executors.newCachedThreadPool();
serializer = ExecutionSequencer.create();
Reported by PMD.
Line: 50
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
@Override
public void setUp() throws Exception {
executor = Executors.newCachedThreadPool();
serializer = ExecutionSequencer.create();
firstFuture = SettableFuture.create();
firstCallable = new TestCallable(firstFuture);
Reported by PMD.
Line: 58
firstCallable = new TestCallable(firstFuture);
}
@Override
public void tearDown() throws Exception {
executor.shutdown();
}
public void testCallableStartsAfterFirstFutureCompletes() {
Reported by PMD.
Line: 63
executor.shutdown();
}
public void testCallableStartsAfterFirstFutureCompletes() {
@SuppressWarnings({"unused", "nullness"})
Future<?> possiblyIgnoredError = serializer.submitAsync(firstCallable, directExecutor());
TestCallable secondCallable = new TestCallable(Futures.<Void>immediateFuture(null));
@SuppressWarnings({"unused", "nullness"})
Future<?> possiblyIgnoredError1 = serializer.submitAsync(secondCallable, directExecutor());
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/ListSubListTester.java
151 issues
Line: 51
@SuppressWarnings("unchecked") // too many "unchecked generic array creations"
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListSubListTester<E> extends AbstractListTester<E> {
public void testSubList_startNegative() {
try {
getList().subList(-1, 0);
fail("subList(-1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
Reported by PMD.
Line: 52
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListSubListTester<E> extends AbstractListTester<E> {
public void testSubList_startNegative() {
try {
getList().subList(-1, 0);
fail("subList(-1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
}
Reported by PMD.
Line: 54
public class ListSubListTester<E> extends AbstractListTester<E> {
public void testSubList_startNegative() {
try {
getList().subList(-1, 0);
fail("subList(-1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
}
}
Reported by PMD.
Line: 60
}
}
public void testSubList_endTooLarge() {
try {
getList().subList(0, getNumElements() + 1);
fail("subList(0, size + 1) should throw");
} catch (IndexOutOfBoundsException expected) {
}
Reported by PMD.
Line: 62
public void testSubList_endTooLarge() {
try {
getList().subList(0, getNumElements() + 1);
fail("subList(0, size + 1) should throw");
} catch (IndexOutOfBoundsException expected) {
}
}
Reported by PMD.
Line: 68
}
}
public void testSubList_startGreaterThanEnd() {
try {
getList().subList(1, 0);
fail("subList(1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
} catch (IllegalArgumentException expected) {
Reported by PMD.
Line: 70
public void testSubList_startGreaterThanEnd() {
try {
getList().subList(1, 0);
fail("subList(1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
} catch (IllegalArgumentException expected) {
/*
* The subList() docs claim that this should be an
Reported by PMD.
Line: 83
}
}
public void testSubList_empty() {
assertEquals("subList(0, 0) should be empty", emptyList(), getList().subList(0, 0));
}
public void testSubList_entireList() {
assertEquals(
Reported by PMD.
Line: 84
}
public void testSubList_empty() {
assertEquals("subList(0, 0) should be empty", emptyList(), getList().subList(0, 0));
}
public void testSubList_entireList() {
assertEquals(
"subList(0, size) should be equal to the original list",
Reported by PMD.
Line: 87
assertEquals("subList(0, 0) should be empty", emptyList(), getList().subList(0, 0));
}
public void testSubList_entireList() {
assertEquals(
"subList(0, size) should be equal to the original list",
getList(),
getList().subList(0, getNumElements()));
}
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java
151 issues
Line: 42
import junit.framework.TestCase;
/** Tests for {@link ExecutionSequencer} */
public class ExecutionSequencerTest extends TestCase {
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
Reported by PMD.
Line: 42
import junit.framework.TestCase;
/** Tests for {@link ExecutionSequencer} */
public class ExecutionSequencerTest extends TestCase {
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
Reported by PMD.
Line: 42
import junit.framework.TestCase;
/** Tests for {@link ExecutionSequencer} */
public class ExecutionSequencerTest extends TestCase {
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
Reported by PMD.
Line: 44
/** Tests for {@link ExecutionSequencer} */
public class ExecutionSequencerTest extends TestCase {
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
Reported by PMD.
Line: 46
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
@Override
public void setUp() throws Exception {
Reported by PMD.
Line: 47
ExecutorService executor;
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
@Override
public void setUp() throws Exception {
executor = Executors.newCachedThreadPool();
Reported by PMD.
Line: 48
private ExecutionSequencer serializer;
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
@Override
public void setUp() throws Exception {
executor = Executors.newCachedThreadPool();
serializer = ExecutionSequencer.create();
Reported by PMD.
Line: 50
private SettableFuture<Void> firstFuture;
private TestCallable firstCallable;
@Override
public void setUp() throws Exception {
executor = Executors.newCachedThreadPool();
serializer = ExecutionSequencer.create();
firstFuture = SettableFuture.create();
firstCallable = new TestCallable(firstFuture);
Reported by PMD.
Line: 58
firstCallable = new TestCallable(firstFuture);
}
@Override
public void tearDown() throws Exception {
executor.shutdown();
}
public void testCallableStartsAfterFirstFutureCompletes() {
Reported by PMD.
Line: 63
executor.shutdown();
}
public void testCallableStartsAfterFirstFutureCompletes() {
@SuppressWarnings({"unused", "nullness"})
Future<?> possiblyIgnoredError = serializer.submitAsync(firstCallable, directExecutor());
TestCallable secondCallable = new TestCallable(Futures.<Void>immediateFuture(null));
@SuppressWarnings({"unused", "nullness"})
Future<?> possiblyIgnoredError1 = serializer.submitAsync(secondCallable, directExecutor());
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/testers/ListSubListTester.java
151 issues
Line: 51
@SuppressWarnings("unchecked") // too many "unchecked generic array creations"
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListSubListTester<E> extends AbstractListTester<E> {
public void testSubList_startNegative() {
try {
getList().subList(-1, 0);
fail("subList(-1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
Reported by PMD.
Line: 52
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListSubListTester<E> extends AbstractListTester<E> {
public void testSubList_startNegative() {
try {
getList().subList(-1, 0);
fail("subList(-1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
}
Reported by PMD.
Line: 54
public class ListSubListTester<E> extends AbstractListTester<E> {
public void testSubList_startNegative() {
try {
getList().subList(-1, 0);
fail("subList(-1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
}
}
Reported by PMD.
Line: 60
}
}
public void testSubList_endTooLarge() {
try {
getList().subList(0, getNumElements() + 1);
fail("subList(0, size + 1) should throw");
} catch (IndexOutOfBoundsException expected) {
}
Reported by PMD.
Line: 62
public void testSubList_endTooLarge() {
try {
getList().subList(0, getNumElements() + 1);
fail("subList(0, size + 1) should throw");
} catch (IndexOutOfBoundsException expected) {
}
}
Reported by PMD.
Line: 68
}
}
public void testSubList_startGreaterThanEnd() {
try {
getList().subList(1, 0);
fail("subList(1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
} catch (IllegalArgumentException expected) {
Reported by PMD.
Line: 70
public void testSubList_startGreaterThanEnd() {
try {
getList().subList(1, 0);
fail("subList(1, 0) should throw");
} catch (IndexOutOfBoundsException expected) {
} catch (IllegalArgumentException expected) {
/*
* The subList() docs claim that this should be an
Reported by PMD.
Line: 83
}
}
public void testSubList_empty() {
assertEquals("subList(0, 0) should be empty", emptyList(), getList().subList(0, 0));
}
public void testSubList_entireList() {
assertEquals(
Reported by PMD.
Line: 84
}
public void testSubList_empty() {
assertEquals("subList(0, 0) should be empty", emptyList(), getList().subList(0, 0));
}
public void testSubList_entireList() {
assertEquals(
"subList(0, size) should be equal to the original list",
Reported by PMD.
Line: 87
assertEquals("subList(0, 0) should be empty", emptyList(), getList().subList(0, 0));
}
public void testSubList_entireList() {
assertEquals(
"subList(0, size) should be equal to the original list",
getList(),
getList().subList(0, getNumElements()));
}
Reported by PMD.
guava-tests/test/com/google/common/primitives/BytesTest.java
150 issues
Line: 250
testReverse(new byte[] {-1, 1, -2, 2}, new byte[] {2, -2, 1, -1});
}
private static void testReverse(byte[] input, byte[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Bytes.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 256
assertTrue(Arrays.equals(expectedOutput, input));
}
private static void testReverse(byte[] input, int fromIndex, int toIndex, byte[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Bytes.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 35
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class BytesTest extends TestCase {
private static final byte[] EMPTY = {};
private static final byte[] ARRAY1 = {(byte) 1};
private static final byte[] ARRAY234 = {(byte) 2, (byte) 3, (byte) 4};
private static final byte[] VALUES = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
Reported by PMD.
Line: 42
private static final byte[] VALUES = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
public void testHashCode() {
for (byte value : VALUES) {
assertEquals(((Byte) value).hashCode(), Bytes.hashCode(value));
}
}
Reported by PMD.
Line: 44
public void testHashCode() {
for (byte value : VALUES) {
assertEquals(((Byte) value).hashCode(), Bytes.hashCode(value));
}
}
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
Reported by PMD.
Line: 48
}
}
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
Reported by PMD.
Line: 48
}
}
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
Reported by PMD.
Line: 49
}
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
assertTrue(Bytes.contains(ARRAY234, (byte) 3));
Reported by PMD.
Line: 50
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
assertTrue(Bytes.contains(ARRAY234, (byte) 3));
assertTrue(Bytes.contains(ARRAY234, (byte) 4));
Reported by PMD.
Line: 51
public void testContains() {
assertFalse(Bytes.contains(EMPTY, (byte) 1));
assertFalse(Bytes.contains(ARRAY1, (byte) 2));
assertFalse(Bytes.contains(ARRAY234, (byte) 1));
assertTrue(Bytes.contains(new byte[] {(byte) -1}, (byte) -1));
assertTrue(Bytes.contains(ARRAY234, (byte) 2));
assertTrue(Bytes.contains(ARRAY234, (byte) 3));
assertTrue(Bytes.contains(ARRAY234, (byte) 4));
}
Reported by PMD.