The following issues were found
android/guava-testlib/src/com/google/common/collect/testing/google/BiMapClearTester.java
40 issues
Line: 34
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapClearTester<K, V> extends AbstractBiMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
Reported by PMD.
Line: 35
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapClearTester<K, V> extends AbstractBiMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
Reported by PMD.
Line: 36
public class BiMapClearTester<K, V> extends AbstractBiMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
Reported by PMD.
Line: 37
@MapFeature.Require(SUPPORTS_REMOVE)
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 38
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
Reported by PMD.
Line: 39
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
Reported by PMD.
Line: 42
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().keySet().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
Reported by PMD.
Line: 43
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().keySet().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
Reported by PMD.
Line: 44
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().keySet().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
Reported by PMD.
Line: 45
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().keySet().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
android/guava-tests/benchmark/com/google/common/collect/ConcurrentHashMultisetBenchmark.java
40 issues
Line: 49
*/
public class ConcurrentHashMultisetBenchmark {
@Param({"1", "2", "4", "8"})
int threads;
@Param({"3", "30", "300"})
int size;
@Param MultisetSupplier implSupplier;
Reported by PMD.
Line: 52
int threads;
@Param({"3", "30", "300"})
int size;
@Param MultisetSupplier implSupplier;
private Multiset<Integer> multiset;
private ImmutableList<Integer> keys;
Reported by PMD.
Line: 54
@Param({"3", "30", "300"})
int size;
@Param MultisetSupplier implSupplier;
private Multiset<Integer> multiset;
private ImmutableList<Integer> keys;
private ExecutorService threadPool;
Reported by PMD.
Line: 56
@Param MultisetSupplier implSupplier;
private Multiset<Integer> multiset;
private ImmutableList<Integer> keys;
private ExecutorService threadPool;
@BeforeExperiment
void setUp() throws Exception {
Reported by PMD.
Line: 57
@Param MultisetSupplier implSupplier;
private Multiset<Integer> multiset;
private ImmutableList<Integer> keys;
private ExecutorService threadPool;
@BeforeExperiment
void setUp() throws Exception {
multiset = implSupplier.get();
Reported by PMD.
Line: 58
private Multiset<Integer> multiset;
private ImmutableList<Integer> keys;
private ExecutorService threadPool;
@BeforeExperiment
void setUp() throws Exception {
multiset = implSupplier.get();
ImmutableList.Builder<Integer> builder = ImmutableList.builder();
Reported by PMD.
Line: 60
private ImmutableList<Integer> keys;
private ExecutorService threadPool;
@BeforeExperiment
void setUp() throws Exception {
multiset = implSupplier.get();
ImmutableList.Builder<Integer> builder = ImmutableList.builder();
for (int i = 0; i < size; i++) {
builder.add(i);
Reported by PMD.
Line: 61
private ExecutorService threadPool;
@BeforeExperiment
void setUp() throws Exception {
multiset = implSupplier.get();
ImmutableList.Builder<Integer> builder = ImmutableList.builder();
for (int i = 0; i < size; i++) {
builder.add(i);
}
Reported by PMD.
Line: 168
* Duplication of the old version of ConcurrentHashMultiset (with some unused stuff removed, like
* serialization code) which used a map with boxed integers for the values.
*/
private static final class OldConcurrentHashMultiset<E> extends AbstractMultiset<E> {
/** The number of occurrences of each element. */
private final transient ConcurrentMap<E, Integer> countMap;
/**
* Creates a new, empty {@code OldConcurrentHashMultiset} using the default initial capacity,
Reported by PMD.
Line: 168
* Duplication of the old version of ConcurrentHashMultiset (with some unused stuff removed, like
* serialization code) which used a map with boxed integers for the values.
*/
private static final class OldConcurrentHashMultiset<E> extends AbstractMultiset<E> {
/** The number of occurrences of each element. */
private final transient ConcurrentMap<E, Integer> countMap;
/**
* Creates a new, empty {@code OldConcurrentHashMultiset} using the default initial capacity,
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultimapClearTester.java
40 issues
Line: 40
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapClearTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(absent = SUPPORTS_REMOVE)
public void testClearUnsupported() {
try {
multimap().clear();
Reported by PMD.
Line: 41
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapClearTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(absent = SUPPORTS_REMOVE)
public void testClearUnsupported() {
try {
multimap().clear();
fail("Expected UnsupportedOperationException");
Reported by PMD.
Line: 45
@MapFeature.Require(absent = SUPPORTS_REMOVE)
public void testClearUnsupported() {
try {
multimap().clear();
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException expected) {
}
}
Reported by PMD.
Line: 52
}
private void assertCleared() {
assertEquals(0, multimap().size());
assertEmpty(multimap());
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
Reported by PMD.
Line: 54
private void assertCleared() {
assertEquals(0, multimap().size());
assertEmpty(multimap());
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
Reported by PMD.
Line: 55
assertEquals(0, multimap().size());
assertEmpty(multimap());
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
Reported by PMD.
Line: 56
assertEmpty(multimap());
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
assertGet(key);
Reported by PMD.
Line: 57
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
assertGet(key);
}
Reported by PMD.
Line: 58
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
assertGet(key);
}
}
Reported by PMD.
Line: 59
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
assertGet(key);
}
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/BiMapClearTester.java
40 issues
Line: 34
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapClearTester<K, V> extends AbstractBiMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
Reported by PMD.
Line: 35
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapClearTester<K, V> extends AbstractBiMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
Reported by PMD.
Line: 36
public class BiMapClearTester<K, V> extends AbstractBiMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
Reported by PMD.
Line: 37
@MapFeature.Require(SUPPORTS_REMOVE)
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 38
public void testClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
Reported by PMD.
Line: 39
BiMap<V, K> inv = getMap().inverse();
getMap().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
Reported by PMD.
Line: 42
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().keySet().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
Reported by PMD.
Line: 43
}
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().keySet().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
Reported by PMD.
Line: 44
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().keySet().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
Reported by PMD.
Line: 45
@MapFeature.Require(SUPPORTS_REMOVE)
public void testKeySetClearClearsInverse() {
BiMap<V, K> inv = getMap().inverse();
getMap().keySet().clear();
assertTrue(getMap().isEmpty());
assertTrue(inv.isEmpty());
}
@MapFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/TestThread.java
40 issues
Line: 51
* @param <L> the type of the lock-like object to be used
* @author Justin T. Sampson
*/
public final class TestThread<L> extends Thread implements TearDown {
private static final long DUE_DILIGENCE_MILLIS = 100;
private static final long TIMEOUT_MILLIS = 5000;
private final L lockLikeObject;
Reported by PMD.
Line: 56
private static final long DUE_DILIGENCE_MILLIS = 100;
private static final long TIMEOUT_MILLIS = 5000;
private final L lockLikeObject;
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
Reported by PMD.
Line: 58
private final L lockLikeObject;
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
public TestThread(L lockLikeObject, String threadName) {
Reported by PMD.
Line: 59
private final L lockLikeObject;
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
public TestThread(L lockLikeObject, String threadName) {
super(threadName);
Reported by PMD.
Line: 61
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
public TestThread(L lockLikeObject, String threadName) {
super(threadName);
this.lockLikeObject = checkNotNull(lockLikeObject);
start();
Reported by PMD.
Line: 61
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
public TestThread(L lockLikeObject, String threadName) {
super(threadName);
this.lockLikeObject = checkNotNull(lockLikeObject);
start();
Reported by PMD.
Line: 73
// so there is no object state put at risk by stopping the threads abruptly. In some cases a test
// may put a thread into an uninterruptible operation intentionally, so there is no other way to
// clean up these threads.
@SuppressWarnings("deprecation")
@Override
public void tearDown() throws Exception {
stop();
join();
Reported by PMD.
Line: 89
/**
* Causes this thread to call the named void method, and asserts that the call returns normally.
*/
public void callAndAssertReturns(String methodName, Object... arguments) throws Exception {
checkNotNull(methodName);
checkNotNull(arguments);
sendRequest(methodName, arguments);
assertSame(null, getResponse(methodName).getResult());
}
Reported by PMD.
Line: 93
checkNotNull(methodName);
checkNotNull(arguments);
sendRequest(methodName, arguments);
assertSame(null, getResponse(methodName).getResult());
}
/**
* Causes this thread to call the named method, and asserts that the call returns the expected
* boolean value.
Reported by PMD.
Line: 101
* boolean value.
*/
public void callAndAssertReturns(boolean expected, String methodName, Object... arguments)
throws Exception {
checkNotNull(methodName);
checkNotNull(arguments);
sendRequest(methodName, arguments);
assertEquals(expected, getResponse(methodName).getResult());
}
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/WrappingExecutorServiceTest.java
40 issues
Line: 46
public class WrappingExecutorServiceTest extends TestCase {
private static final String RESULT_VALUE = "ran";
// Uninteresting delegations
public void testDelegations() throws InterruptedException {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
assertFalse(testExecutor.awaitTermination(10, TimeUnit.MILLISECONDS));
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
Reported by PMD.
Line: 46
public class WrappingExecutorServiceTest extends TestCase {
private static final String RESULT_VALUE = "ran";
// Uninteresting delegations
public void testDelegations() throws InterruptedException {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
assertFalse(testExecutor.awaitTermination(10, TimeUnit.MILLISECONDS));
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
Reported by PMD.
Line: 49
public void testDelegations() throws InterruptedException {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
assertFalse(testExecutor.awaitTermination(10, TimeUnit.MILLISECONDS));
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
mock.assertLastMethodCalled("isTerminated");
assertFalse(testExecutor.isShutdown());
mock.assertLastMethodCalled("isShutdown");
Reported by PMD.
Line: 51
TestExecutor testExecutor = new TestExecutor(mock);
assertFalse(testExecutor.awaitTermination(10, TimeUnit.MILLISECONDS));
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
mock.assertLastMethodCalled("isTerminated");
assertFalse(testExecutor.isShutdown());
mock.assertLastMethodCalled("isShutdown");
testExecutor.shutdown();
mock.assertLastMethodCalled("shutdown");
Reported by PMD.
Line: 53
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
mock.assertLastMethodCalled("isTerminated");
assertFalse(testExecutor.isShutdown());
mock.assertLastMethodCalled("isShutdown");
testExecutor.shutdown();
mock.assertLastMethodCalled("shutdown");
List<Runnable> list = testExecutor.shutdownNow();
mock.assertLastMethodCalled("shutdownNow");
Reported by PMD.
Line: 59
mock.assertLastMethodCalled("shutdown");
List<Runnable> list = testExecutor.shutdownNow();
mock.assertLastMethodCalled("shutdownNow");
assertEquals(ImmutableList.of(), list);
}
public void testExecute() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Reported by PMD.
Line: 62
assertEquals(ImmutableList.of(), list);
}
public void testExecute() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
testExecutor.execute(doNothing());
mock.assertLastMethodCalled("execute");
}
Reported by PMD.
Line: 62
assertEquals(ImmutableList.of(), list);
}
public void testExecute() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
testExecutor.execute(doNothing());
mock.assertLastMethodCalled("execute");
}
Reported by PMD.
Line: 69
mock.assertLastMethodCalled("execute");
}
public void testSubmit() throws InterruptedException, ExecutionException {
{
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Future<?> f = testExecutor.submit(doNothing());
mock.assertLastMethodCalled("submit");
Reported by PMD.
Line: 69
mock.assertLastMethodCalled("execute");
}
public void testSubmit() throws InterruptedException, ExecutionException {
{
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Future<?> f = testExecutor.submit(doNothing());
mock.assertLastMethodCalled("submit");
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/MultimapClearTester.java
40 issues
Line: 40
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapClearTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(absent = SUPPORTS_REMOVE)
public void testClearUnsupported() {
try {
multimap().clear();
Reported by PMD.
Line: 41
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapClearTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@CollectionSize.Require(absent = ZERO)
@MapFeature.Require(absent = SUPPORTS_REMOVE)
public void testClearUnsupported() {
try {
multimap().clear();
fail("Expected UnsupportedOperationException");
Reported by PMD.
Line: 45
@MapFeature.Require(absent = SUPPORTS_REMOVE)
public void testClearUnsupported() {
try {
multimap().clear();
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException expected) {
}
}
Reported by PMD.
Line: 52
}
private void assertCleared() {
assertEquals(0, multimap().size());
assertEmpty(multimap());
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
Reported by PMD.
Line: 54
private void assertCleared() {
assertEquals(0, multimap().size());
assertEmpty(multimap());
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
Reported by PMD.
Line: 55
assertEquals(0, multimap().size());
assertEmpty(multimap());
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
Reported by PMD.
Line: 56
assertEmpty(multimap());
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
assertGet(key);
Reported by PMD.
Line: 57
assertEquals(multimap(), getSubjectGenerator().create());
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
assertGet(key);
}
Reported by PMD.
Line: 58
assertEmpty(multimap().entries());
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
assertGet(key);
}
}
Reported by PMD.
Line: 59
assertEmpty(multimap().asMap());
assertEmpty(multimap().keySet());
assertEmpty(multimap().keys());
assertEmpty(multimap().values());
for (K key : sampleKeys()) {
assertGet(key);
}
}
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/WrappingExecutorServiceTest.java
40 issues
Line: 46
public class WrappingExecutorServiceTest extends TestCase {
private static final String RESULT_VALUE = "ran";
// Uninteresting delegations
public void testDelegations() throws InterruptedException {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
assertFalse(testExecutor.awaitTermination(10, TimeUnit.MILLISECONDS));
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
Reported by PMD.
Line: 46
public class WrappingExecutorServiceTest extends TestCase {
private static final String RESULT_VALUE = "ran";
// Uninteresting delegations
public void testDelegations() throws InterruptedException {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
assertFalse(testExecutor.awaitTermination(10, TimeUnit.MILLISECONDS));
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
Reported by PMD.
Line: 49
public void testDelegations() throws InterruptedException {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
assertFalse(testExecutor.awaitTermination(10, TimeUnit.MILLISECONDS));
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
mock.assertLastMethodCalled("isTerminated");
assertFalse(testExecutor.isShutdown());
mock.assertLastMethodCalled("isShutdown");
Reported by PMD.
Line: 51
TestExecutor testExecutor = new TestExecutor(mock);
assertFalse(testExecutor.awaitTermination(10, TimeUnit.MILLISECONDS));
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
mock.assertLastMethodCalled("isTerminated");
assertFalse(testExecutor.isShutdown());
mock.assertLastMethodCalled("isShutdown");
testExecutor.shutdown();
mock.assertLastMethodCalled("shutdown");
Reported by PMD.
Line: 53
mock.assertLastMethodCalled("awaitTermination");
assertFalse(testExecutor.isTerminated());
mock.assertLastMethodCalled("isTerminated");
assertFalse(testExecutor.isShutdown());
mock.assertLastMethodCalled("isShutdown");
testExecutor.shutdown();
mock.assertLastMethodCalled("shutdown");
List<Runnable> list = testExecutor.shutdownNow();
mock.assertLastMethodCalled("shutdownNow");
Reported by PMD.
Line: 59
mock.assertLastMethodCalled("shutdown");
List<Runnable> list = testExecutor.shutdownNow();
mock.assertLastMethodCalled("shutdownNow");
assertEquals(ImmutableList.of(), list);
}
public void testExecute() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Reported by PMD.
Line: 62
assertEquals(ImmutableList.of(), list);
}
public void testExecute() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
testExecutor.execute(doNothing());
mock.assertLastMethodCalled("execute");
}
Reported by PMD.
Line: 62
assertEquals(ImmutableList.of(), list);
}
public void testExecute() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
testExecutor.execute(doNothing());
mock.assertLastMethodCalled("execute");
}
Reported by PMD.
Line: 69
mock.assertLastMethodCalled("execute");
}
public void testSubmit() throws InterruptedException, ExecutionException {
{
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Future<?> f = testExecutor.submit(doNothing());
mock.assertLastMethodCalled("submit");
Reported by PMD.
Line: 69
mock.assertLastMethodCalled("execute");
}
public void testSubmit() throws InterruptedException, ExecutionException {
{
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Future<?> f = testExecutor.submit(doNothing());
mock.assertLastMethodCalled("submit");
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/TestThread.java
40 issues
Line: 51
* @param <L> the type of the lock-like object to be used
* @author Justin T. Sampson
*/
public final class TestThread<L> extends Thread implements TearDown {
private static final long DUE_DILIGENCE_MILLIS = 100;
private static final long TIMEOUT_MILLIS = 5000;
private final L lockLikeObject;
Reported by PMD.
Line: 56
private static final long DUE_DILIGENCE_MILLIS = 100;
private static final long TIMEOUT_MILLIS = 5000;
private final L lockLikeObject;
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
Reported by PMD.
Line: 58
private final L lockLikeObject;
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
public TestThread(L lockLikeObject, String threadName) {
Reported by PMD.
Line: 59
private final L lockLikeObject;
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
public TestThread(L lockLikeObject, String threadName) {
super(threadName);
Reported by PMD.
Line: 61
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
public TestThread(L lockLikeObject, String threadName) {
super(threadName);
this.lockLikeObject = checkNotNull(lockLikeObject);
start();
Reported by PMD.
Line: 61
private final SynchronousQueue<Request> requestQueue = new SynchronousQueue<>();
private final SynchronousQueue<Response> responseQueue = new SynchronousQueue<>();
private Throwable uncaughtThrowable = null;
public TestThread(L lockLikeObject, String threadName) {
super(threadName);
this.lockLikeObject = checkNotNull(lockLikeObject);
start();
Reported by PMD.
Line: 73
// so there is no object state put at risk by stopping the threads abruptly. In some cases a test
// may put a thread into an uninterruptible operation intentionally, so there is no other way to
// clean up these threads.
@SuppressWarnings("deprecation")
@Override
public void tearDown() throws Exception {
stop();
join();
Reported by PMD.
Line: 89
/**
* Causes this thread to call the named void method, and asserts that the call returns normally.
*/
public void callAndAssertReturns(String methodName, Object... arguments) throws Exception {
checkNotNull(methodName);
checkNotNull(arguments);
sendRequest(methodName, arguments);
assertSame(null, getResponse(methodName).getResult());
}
Reported by PMD.
Line: 93
checkNotNull(methodName);
checkNotNull(arguments);
sendRequest(methodName, arguments);
assertSame(null, getResponse(methodName).getResult());
}
/**
* Causes this thread to call the named method, and asserts that the call returns the expected
* boolean value.
Reported by PMD.
Line: 101
* boolean value.
*/
public void callAndAssertReturns(boolean expected, String methodName, Object... arguments)
throws Exception {
checkNotNull(methodName);
checkNotNull(arguments);
sendRequest(methodName, arguments);
assertEquals(expected, getResponse(methodName).getResult());
}
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveTester.java
40 issues
Line: 46
@SuppressWarnings("unchecked") // too many "unchecked generic array creations"
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemove_present() {
int initialSize = getMap().size();
assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
Reported by PMD.
Line: 47
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemove_present() {
int initialSize = getMap().size();
assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
assertEquals(
Reported by PMD.
Line: 49
public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemove_present() {
int initialSize = getMap().size();
assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
assertEquals(
"remove(present) should decrease a map's size by one.", initialSize - 1, getMap().size());
expectMissing(e0());
Reported by PMD.
Line: 50
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemove_present() {
int initialSize = getMap().size();
assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
assertEquals(
"remove(present) should decrease a map's size by one.", initialSize - 1, getMap().size());
expectMissing(e0());
}
Reported by PMD.
Line: 51
@CollectionSize.Require(absent = ZERO)
public void testRemove_present() {
int initialSize = getMap().size();
assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
assertEquals(
"remove(present) should decrease a map's size by one.", initialSize - 1, getMap().size());
expectMissing(e0());
}
Reported by PMD.
Line: 53
int initialSize = getMap().size();
assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
assertEquals(
"remove(present) should decrease a map's size by one.", initialSize - 1, getMap().size());
expectMissing(e0());
}
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
@CollectionSize.Require(SEVERAL)
Reported by PMD.
Line: 57
expectMissing(e0());
}
@MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
@CollectionSize.Require(SEVERAL)
public void testRemovePresentConcurrentWithEntrySetIteration() {
try {
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
getMap().remove(k0());
Reported by PMD.
Line: 61
@CollectionSize.Require(SEVERAL)
public void testRemovePresentConcurrentWithEntrySetIteration() {
try {
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
getMap().remove(k0());
iterator.next();
fail("Expected ConcurrentModificationException");
} catch (ConcurrentModificationException expected) {
// success
Reported by PMD.
Line: 61
@CollectionSize.Require(SEVERAL)
public void testRemovePresentConcurrentWithEntrySetIteration() {
try {
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
getMap().remove(k0());
iterator.next();
fail("Expected ConcurrentModificationException");
} catch (ConcurrentModificationException expected) {
// success
Reported by PMD.
Line: 62
public void testRemovePresentConcurrentWithEntrySetIteration() {
try {
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
getMap().remove(k0());
iterator.next();
fail("Expected ConcurrentModificationException");
} catch (ConcurrentModificationException expected) {
// success
}
Reported by PMD.