The following issues were found
android/guava-tests/test/com/google/common/hash/BloomFilterTest.java
174 issues
Line: 47
*
* @author Dimitris Andreou
*/
public class BloomFilterTest extends TestCase {
private static final int NUM_PUTS = 100_000;
private static final ThreadLocal<Random> random =
new ThreadLocal<Random>() {
@Override
protected Random initialValue() {
Reported by PMD.
Line: 47
*
* @author Dimitris Andreou
*/
public class BloomFilterTest extends TestCase {
private static final int NUM_PUTS = 100_000;
private static final ThreadLocal<Random> random =
new ThreadLocal<Random>() {
@Override
protected Random initialValue() {
Reported by PMD.
Line: 47
*
* @author Dimitris Andreou
*/
public class BloomFilterTest extends TestCase {
private static final int NUM_PUTS = 100_000;
private static final ThreadLocal<Random> random =
new ThreadLocal<Random>() {
@Override
protected Random initialValue() {
Reported by PMD.
Line: 59
private static final int GOLDEN_PRESENT_KEY = random.get().nextInt();
@AndroidIncompatible // OutOfMemoryError
public void testLargeBloomFilterDoesntOverflow() {
long numBits = Integer.MAX_VALUE;
numBits++;
LockFreeBitArray bitArray = new LockFreeBitArray(numBits);
Reported by PMD.
Line: 82
assertThat(bf.approximateElementCount()).isAtMost((long) (sizeGuess * 1.01));
}
public void testCreateAndCheckMitz32BloomFilterWithKnownFalsePositives() {
int numInsertions = 1000000;
BloomFilter<String> bf =
BloomFilter.create(
Funnels.unencodedCharsFunnel(),
numInsertions,
Reported by PMD.
Line: 82
assertThat(bf.approximateElementCount()).isAtMost((long) (sizeGuess * 1.01));
}
public void testCreateAndCheckMitz32BloomFilterWithKnownFalsePositives() {
int numInsertions = 1000000;
BloomFilter<String> bf =
BloomFilter.create(
Funnels.unencodedCharsFunnel(),
numInsertions,
Reported by PMD.
Line: 99
// Assert that the BF "might" have all of the even numbers.
for (int i = 0; i < numInsertions * 2; i += 2) {
assertTrue(bf.mightContain(Integer.toString(i)));
}
// Now we check for known false positives using a set of known false positives.
// (These are all of the false positives under 900.)
ImmutableSet<Integer> falsePositives =
Reported by PMD.
Line: 121
numFpp++;
}
}
assertEquals(knownNumberOfFalsePositives, numFpp);
double expectedReportedFpp = (double) knownNumberOfFalsePositives / numInsertions;
double actualReportedFpp = bf.expectedFpp();
assertEquals(expectedReportedFpp, actualReportedFpp, 0.00015);
}
Reported by PMD.
Line: 123
}
assertEquals(knownNumberOfFalsePositives, numFpp);
double expectedReportedFpp = (double) knownNumberOfFalsePositives / numInsertions;
double actualReportedFpp = bf.expectedFpp();
assertEquals(expectedReportedFpp, actualReportedFpp, 0.00015);
}
public void testCreateAndCheckBloomFilterWithKnownFalsePositives64() {
int numInsertions = 1000000;
Reported by PMD.
Line: 124
assertEquals(knownNumberOfFalsePositives, numFpp);
double expectedReportedFpp = (double) knownNumberOfFalsePositives / numInsertions;
double actualReportedFpp = bf.expectedFpp();
assertEquals(expectedReportedFpp, actualReportedFpp, 0.00015);
}
public void testCreateAndCheckBloomFilterWithKnownFalsePositives64() {
int numInsertions = 1000000;
BloomFilter<String> bf =
Reported by PMD.
android/guava-tests/test/com/google/common/io/CloserTest.java
174 issues
Line: 42
*
* @author Colin Decker
*/
public class CloserTest extends TestCase {
private TestSuppressor suppressor;
@Override
protected void setUp() throws Exception {
Reported by PMD.
Line: 44
*/
public class CloserTest extends TestCase {
private TestSuppressor suppressor;
@Override
protected void setUp() throws Exception {
suppressor = new TestSuppressor();
}
Reported by PMD.
Line: 46
private TestSuppressor suppressor;
@Override
protected void setUp() throws Exception {
suppressor = new TestSuppressor();
}
@AndroidIncompatible // TODO(cpovirk): Look up Build.VERSION.SDK_INT reflectively.
Reported by PMD.
Line: 51
suppressor = new TestSuppressor();
}
@AndroidIncompatible // TODO(cpovirk): Look up Build.VERSION.SDK_INT reflectively.
public void testCreate() {
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Reported by PMD.
Line: 53
@AndroidIncompatible // TODO(cpovirk): Look up Build.VERSION.SDK_INT reflectively.
public void testCreate() {
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
Reported by PMD.
Line: 53
@AndroidIncompatible // TODO(cpovirk): Look up Build.VERSION.SDK_INT reflectively.
public void testCreate() {
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
Reported by PMD.
Line: 56
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
TestCloseable c1 = closer.register(TestCloseable.normal());
TestCloseable c2 = closer.register(TestCloseable.normal());
TestCloseable c3 = closer.register(TestCloseable.normal());
Reported by PMD.
Line: 56
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
TestCloseable c1 = closer.register(TestCloseable.normal());
TestCloseable c2 = closer.register(TestCloseable.normal());
TestCloseable c3 = closer.register(TestCloseable.normal());
Reported by PMD.
Line: 57
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
TestCloseable c1 = closer.register(TestCloseable.normal());
TestCloseable c2 = closer.register(TestCloseable.normal());
TestCloseable c3 = closer.register(TestCloseable.normal());
Reported by PMD.
Line: 63
TestCloseable c2 = closer.register(TestCloseable.normal());
TestCloseable c3 = closer.register(TestCloseable.normal());
assertFalse(c1.isClosed());
assertFalse(c2.isClosed());
assertFalse(c3.isClosed());
closer.close();
Reported by PMD.
guava-tests/test/com/google/common/io/CloserTest.java
174 issues
Line: 42
*
* @author Colin Decker
*/
public class CloserTest extends TestCase {
private TestSuppressor suppressor;
@Override
protected void setUp() throws Exception {
Reported by PMD.
Line: 44
*/
public class CloserTest extends TestCase {
private TestSuppressor suppressor;
@Override
protected void setUp() throws Exception {
suppressor = new TestSuppressor();
}
Reported by PMD.
Line: 46
private TestSuppressor suppressor;
@Override
protected void setUp() throws Exception {
suppressor = new TestSuppressor();
}
@AndroidIncompatible // TODO(cpovirk): Look up Build.VERSION.SDK_INT reflectively.
Reported by PMD.
Line: 51
suppressor = new TestSuppressor();
}
@AndroidIncompatible // TODO(cpovirk): Look up Build.VERSION.SDK_INT reflectively.
public void testCreate() {
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Reported by PMD.
Line: 53
@AndroidIncompatible // TODO(cpovirk): Look up Build.VERSION.SDK_INT reflectively.
public void testCreate() {
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
Reported by PMD.
Line: 53
@AndroidIncompatible // TODO(cpovirk): Look up Build.VERSION.SDK_INT reflectively.
public void testCreate() {
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
Reported by PMD.
Line: 56
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
TestCloseable c1 = closer.register(TestCloseable.normal());
TestCloseable c2 = closer.register(TestCloseable.normal());
TestCloseable c3 = closer.register(TestCloseable.normal());
Reported by PMD.
Line: 56
assertThat(Closer.create().suppressor).isInstanceOf(Closer.SuppressingSuppressor.class);
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
TestCloseable c1 = closer.register(TestCloseable.normal());
TestCloseable c2 = closer.register(TestCloseable.normal());
TestCloseable c3 = closer.register(TestCloseable.normal());
Reported by PMD.
Line: 57
}
public void testNoExceptionsThrown() throws IOException {
Closer closer = new Closer(suppressor);
TestCloseable c1 = closer.register(TestCloseable.normal());
TestCloseable c2 = closer.register(TestCloseable.normal());
TestCloseable c3 = closer.register(TestCloseable.normal());
Reported by PMD.
Line: 63
TestCloseable c2 = closer.register(TestCloseable.normal());
TestCloseable c3 = closer.register(TestCloseable.normal());
assertFalse(c1.isClosed());
assertFalse(c2.isClosed());
assertFalse(c3.isClosed());
closer.close();
Reported by PMD.
guava-tests/test/com/google/common/base/OptionalTest.java
173 issues
Line: 230
public void testEqualsAndHashCode() {
new EqualsTester()
.addEqualityGroup(Optional.absent(), reserialize(Optional.absent()))
.addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5))))
.addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42))))
.testEquals();
}
public void testToString_absent() {
Reported by PMD.
Line: 230
public void testEqualsAndHashCode() {
new EqualsTester()
.addEqualityGroup(Optional.absent(), reserialize(Optional.absent()))
.addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5))))
.addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42))))
.testEquals();
}
public void testToString_absent() {
Reported by PMD.
Line: 231
new EqualsTester()
.addEqualityGroup(Optional.absent(), reserialize(Optional.absent()))
.addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5))))
.addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42))))
.testEquals();
}
public void testToString_absent() {
assertEquals("Optional.absent()", Optional.absent().toString());
Reported by PMD.
Line: 231
new EqualsTester()
.addEqualityGroup(Optional.absent(), reserialize(Optional.absent()))
.addEqualityGroup(Optional.of(new Long(5)), reserialize(Optional.of(new Long(5))))
.addEqualityGroup(Optional.of(new Long(42)), reserialize(Optional.of(new Long(42))))
.testEquals();
}
public void testToString_absent() {
assertEquals("Optional.absent()", Optional.absent().toString());
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.base;
import static com.google.common.testing.SerializableTester.reserialize;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 39
* @author Kurt Alfred Kluever
*/
@GwtCompatible(emulated = true)
public final class OptionalTest extends TestCase {
public void testToJavaUtil_static() {
assertNull(Optional.toJavaUtil(null));
assertEquals(java.util.Optional.empty(), Optional.toJavaUtil(Optional.absent()));
assertEquals(java.util.Optional.of("abc"), Optional.toJavaUtil(Optional.of("abc")));
}
Reported by PMD.
Line: 40
*/
@GwtCompatible(emulated = true)
public final class OptionalTest extends TestCase {
public void testToJavaUtil_static() {
assertNull(Optional.toJavaUtil(null));
assertEquals(java.util.Optional.empty(), Optional.toJavaUtil(Optional.absent()));
assertEquals(java.util.Optional.of("abc"), Optional.toJavaUtil(Optional.of("abc")));
}
Reported by PMD.
Line: 40
*/
@GwtCompatible(emulated = true)
public final class OptionalTest extends TestCase {
public void testToJavaUtil_static() {
assertNull(Optional.toJavaUtil(null));
assertEquals(java.util.Optional.empty(), Optional.toJavaUtil(Optional.absent()));
assertEquals(java.util.Optional.of("abc"), Optional.toJavaUtil(Optional.of("abc")));
}
Reported by PMD.
Line: 41
@GwtCompatible(emulated = true)
public final class OptionalTest extends TestCase {
public void testToJavaUtil_static() {
assertNull(Optional.toJavaUtil(null));
assertEquals(java.util.Optional.empty(), Optional.toJavaUtil(Optional.absent()));
assertEquals(java.util.Optional.of("abc"), Optional.toJavaUtil(Optional.of("abc")));
}
public void testToJavaUtil_instance() {
Reported by PMD.
Line: 42
public final class OptionalTest extends TestCase {
public void testToJavaUtil_static() {
assertNull(Optional.toJavaUtil(null));
assertEquals(java.util.Optional.empty(), Optional.toJavaUtil(Optional.absent()));
assertEquals(java.util.Optional.of("abc"), Optional.toJavaUtil(Optional.of("abc")));
}
public void testToJavaUtil_instance() {
assertEquals(java.util.Optional.empty(), Optional.absent().toJavaUtil());
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java
171 issues
Line: 17
* the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.util.concurrent.InterruptionUtil.repeatedlyInterruptTestThread;
import static com.google.common.util.concurrent.Uninterruptibles.awaitTerminationUninterruptibly;
import static com.google.common.util.concurrent.Uninterruptibles.awaitUninterruptibly;
import static com.google.common.util.concurrent.Uninterruptibles.joinUninterruptibly;
Reported by PMD.
Line: 17
* the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.util.concurrent.InterruptionUtil.repeatedlyInterruptTestThread;
import static com.google.common.util.concurrent.Uninterruptibles.awaitTerminationUninterruptibly;
import static com.google.common.util.concurrent.Uninterruptibles.awaitUninterruptibly;
import static com.google.common.util.concurrent.Uninterruptibles.joinUninterruptibly;
Reported by PMD.
Line: 58
* @author Anthony Zana
*/
public class UninterruptiblesTest extends TestCase {
private static final String EXPECTED_TAKE = "expectedTake";
/** Timeout to use when we don't expect the timeout to expire. */
private static final long LONG_DELAY_MS = 2500;
Reported by PMD.
Line: 58
* @author Anthony Zana
*/
public class UninterruptiblesTest extends TestCase {
private static final String EXPECTED_TAKE = "expectedTake";
/** Timeout to use when we don't expect the timeout to expire. */
private static final long LONG_DELAY_MS = 2500;
Reported by PMD.
Line: 66
private static final long SLEEP_SLACK = 2;
private final TearDownStack tearDownStack = new TearDownStack();
// NOTE: All durations in these tests are expressed in milliseconds
@Override
protected void setUp() {
// Clear any previous interrupt before running the test.
Reported by PMD.
Line: 69
private final TearDownStack tearDownStack = new TearDownStack();
// NOTE: All durations in these tests are expressed in milliseconds
@Override
protected void setUp() {
// Clear any previous interrupt before running the test.
if (Thread.currentThread().isInterrupted()) {
throw new AssertionError(
"Thread interrupted on test entry. "
Reported by PMD.
Line: 72
@Override
protected void setUp() {
// Clear any previous interrupt before running the test.
if (Thread.currentThread().isInterrupted()) {
throw new AssertionError(
"Thread interrupted on test entry. "
+ "Some test probably didn't clear the interrupt state");
}
Reported by PMD.
Line: 80
tearDownStack.addTearDown(
new TearDown() {
@Override
public void tearDown() {
Thread.interrupted();
}
});
}
Reported by PMD.
Line: 87
});
}
@Override
protected void tearDown() {
tearDownStack.runTearDown();
}
public void testNull() throws Exception {
Reported by PMD.
Line: 92
tearDownStack.runTearDown();
}
public void testNull() throws Exception {
new NullPointerTester()
.setDefault(CountDownLatch.class, new CountDownLatch(0))
.setDefault(Semaphore.class, new Semaphore(999))
.testAllPublicStaticMethods(Uninterruptibles.class);
}
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java
171 issues
Line: 53
* @author Luke Sandberg
* @author Chris Nokleberg
*/
public class ServiceManagerTest extends TestCase {
private static class NoOpService extends AbstractService {
@Override
protected void doStart() {
notifyStarted();
Reported by PMD.
Line: 53
* @author Luke Sandberg
* @author Chris Nokleberg
*/
public class ServiceManagerTest extends TestCase {
private static class NoOpService extends AbstractService {
@Override
protected void doStart() {
notifyStarted();
Reported by PMD.
Line: 53
* @author Luke Sandberg
* @author Chris Nokleberg
*/
public class ServiceManagerTest extends TestCase {
private static class NoOpService extends AbstractService {
@Override
protected void doStart() {
notifyStarted();
Reported by PMD.
Line: 53
* @author Luke Sandberg
* @author Chris Nokleberg
*/
public class ServiceManagerTest extends TestCase {
private static class NoOpService extends AbstractService {
@Override
protected void doStart() {
notifyStarted();
Reported by PMD.
Line: 72
* of time.
*/
private static class NoOpDelayedService extends NoOpService {
private long delay;
public NoOpDelayedService(long delay) {
this.delay = delay;
}
Reported by PMD.
Line: 72
* of time.
*/
private static class NoOpDelayedService extends NoOpService {
private long delay;
public NoOpDelayedService(long delay) {
this.delay = delay;
}
Reported by PMD.
Line: 124
}
public void testServiceStartupTimes() {
Service a = new NoOpDelayedService(150);
Service b = new NoOpDelayedService(353);
ServiceManager serviceManager = new ServiceManager(asList(a, b));
serviceManager.startAsync().awaitHealthy();
ImmutableMap<Service, Long> startupTimes = serviceManager.startupTimes();
Reported by PMD.
Line: 124
}
public void testServiceStartupTimes() {
Service a = new NoOpDelayedService(150);
Service b = new NoOpDelayedService(353);
ServiceManager serviceManager = new ServiceManager(asList(a, b));
serviceManager.startAsync().awaitHealthy();
ImmutableMap<Service, Long> startupTimes = serviceManager.startupTimes();
Reported by PMD.
Line: 128
Service a = new NoOpDelayedService(150);
Service b = new NoOpDelayedService(353);
ServiceManager serviceManager = new ServiceManager(asList(a, b));
serviceManager.startAsync().awaitHealthy();
ImmutableMap<Service, Long> startupTimes = serviceManager.startupTimes();
assertThat(startupTimes).hasSize(2);
assertThat(startupTimes.get(a)).isAtLeast(150);
assertThat(startupTimes.get(b)).isAtLeast(353);
}
Reported by PMD.
Line: 130
ServiceManager serviceManager = new ServiceManager(asList(a, b));
serviceManager.startAsync().awaitHealthy();
ImmutableMap<Service, Long> startupTimes = serviceManager.startupTimes();
assertThat(startupTimes).hasSize(2);
assertThat(startupTimes.get(a)).isAtLeast(150);
assertThat(startupTimes.get(b)).isAtLeast(353);
}
Reported by PMD.
android/guava-tests/test/com/google/common/graph/AbstractStandardUndirectedGraphTest.java
167 issues
Line: 32
/**
* Abstract base class for testing undirected {@link Graph} implementations defined in this package.
*/
public abstract class AbstractStandardUndirectedGraphTest extends AbstractGraphTest {
@After
public void validateUndirectedEdges() {
for (Integer node : graph.nodes()) {
new EqualsTester()
Reported by PMD.
Line: 37
@After
public void validateUndirectedEdges() {
for (Integer node : graph.nodes()) {
new EqualsTester()
.addEqualityGroup(
graph.predecessors(node), graph.successors(node), graph.adjacentNodes(node))
.testEquals();
}
}
Reported by PMD.
Line: 47
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Set<Integer> nodes = graph.nodes();
try {
nodes.add(N2);
fail(ERROR_MODIFIABLE_SET);
Reported by PMD.
Line: 47
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Set<Integer> nodes = graph.nodes();
try {
nodes.add(N2);
fail(ERROR_MODIFIABLE_SET);
Reported by PMD.
Line: 55
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
addNode(N1);
assertThat(graph.nodes()).containsExactlyElementsIn(nodes);
}
}
@Override
@Test
Reported by PMD.
Line: 62
@Override
@Test
public void adjacentNodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N1);
Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
try {
adjacentNodes.add(N2);
Reported by PMD.
Line: 62
@Override
@Test
public void adjacentNodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N1);
Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
try {
adjacentNodes.add(N2);
Reported by PMD.
Line: 71
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
putEdge(N1, N2);
assertThat(graph.adjacentNodes(N1)).containsExactlyElementsIn(adjacentNodes);
}
}
@Override
@Test
Reported by PMD.
Line: 78
@Override
@Test
public void predecessors_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N2);
Set<Integer> predecessors = graph.predecessors(N2);
try {
predecessors.add(N1);
Reported by PMD.
Line: 78
@Override
@Test
public void predecessors_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N2);
Set<Integer> predecessors = graph.predecessors(N2);
try {
predecessors.add(N1);
Reported by PMD.
guava-tests/test/com/google/common/graph/AbstractStandardUndirectedGraphTest.java
167 issues
Line: 32
/**
* Abstract base class for testing undirected {@link Graph} implementations defined in this package.
*/
public abstract class AbstractStandardUndirectedGraphTest extends AbstractGraphTest {
@After
public void validateUndirectedEdges() {
for (Integer node : graph.nodes()) {
new EqualsTester()
Reported by PMD.
Line: 37
@After
public void validateUndirectedEdges() {
for (Integer node : graph.nodes()) {
new EqualsTester()
.addEqualityGroup(
graph.predecessors(node), graph.successors(node), graph.adjacentNodes(node))
.testEquals();
}
}
Reported by PMD.
Line: 47
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Set<Integer> nodes = graph.nodes();
try {
nodes.add(N2);
fail(ERROR_MODIFIABLE_SET);
Reported by PMD.
Line: 47
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Set<Integer> nodes = graph.nodes();
try {
nodes.add(N2);
fail(ERROR_MODIFIABLE_SET);
Reported by PMD.
Line: 55
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
addNode(N1);
assertThat(graph.nodes()).containsExactlyElementsIn(nodes);
}
}
@Override
@Test
Reported by PMD.
Line: 62
@Override
@Test
public void adjacentNodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N1);
Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
try {
adjacentNodes.add(N2);
Reported by PMD.
Line: 62
@Override
@Test
public void adjacentNodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N1);
Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
try {
adjacentNodes.add(N2);
Reported by PMD.
Line: 71
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
putEdge(N1, N2);
assertThat(graph.adjacentNodes(N1)).containsExactlyElementsIn(adjacentNodes);
}
}
@Override
@Test
Reported by PMD.
Line: 78
@Override
@Test
public void predecessors_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N2);
Set<Integer> predecessors = graph.predecessors(N2);
try {
predecessors.add(N1);
Reported by PMD.
Line: 78
@Override
@Test
public void predecessors_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N2);
Set<Integer> predecessors = graph.predecessors(N2);
try {
predecessors.add(N1);
Reported by PMD.
guava-tests/test/com/google/common/cache/EmptyCachesTest.java
167 issues
Line: 75
public void testEquals_null() {
for (LoadingCache<Object, Object> cache : caches()) {
assertFalse(cache.equals(null));
}
}
public void testEqualsAndHashCode_different() {
for (CacheBuilder<Object, Object> builder : cacheFactory().buildAllPermutations()) {
Reported by PMD.
Line: 42
* @author mike nonemacher
*/
public class EmptyCachesTest extends TestCase {
public void testEmpty() {
for (LoadingCache<Object, Object> cache : caches()) {
checkEmpty(cache);
}
Reported by PMD.
Line: 42
* @author mike nonemacher
*/
public class EmptyCachesTest extends TestCase {
public void testEmpty() {
for (LoadingCache<Object, Object> cache : caches()) {
checkEmpty(cache);
}
Reported by PMD.
Line: 44
public class EmptyCachesTest extends TestCase {
public void testEmpty() {
for (LoadingCache<Object, Object> cache : caches()) {
checkEmpty(cache);
}
}
Reported by PMD.
Line: 44
public class EmptyCachesTest extends TestCase {
public void testEmpty() {
for (LoadingCache<Object, Object> cache : caches()) {
checkEmpty(cache);
}
}
Reported by PMD.
Line: 51
}
public void testInvalidate_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
cache.getUnchecked("b");
cache.invalidate("a");
cache.invalidate("b");
Reported by PMD.
Line: 51
}
public void testInvalidate_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
cache.getUnchecked("b");
cache.invalidate("a");
cache.invalidate("b");
Reported by PMD.
Line: 62
}
}
public void testInvalidateAll_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
cache.getUnchecked("b");
cache.getUnchecked("c");
cache.invalidateAll();
Reported by PMD.
Line: 62
}
}
public void testInvalidateAll_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
cache.getUnchecked("b");
cache.getUnchecked("c");
cache.invalidateAll();
Reported by PMD.
Line: 73
}
public void testEquals_null() {
for (LoadingCache<Object, Object> cache : caches()) {
assertFalse(cache.equals(null));
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/cache/EmptyCachesTest.java
167 issues
Line: 75
public void testEquals_null() {
for (LoadingCache<Object, Object> cache : caches()) {
assertFalse(cache.equals(null));
}
}
public void testEqualsAndHashCode_different() {
for (CacheBuilder<Object, Object> builder : cacheFactory().buildAllPermutations()) {
Reported by PMD.
Line: 42
* @author mike nonemacher
*/
public class EmptyCachesTest extends TestCase {
public void testEmpty() {
for (LoadingCache<Object, Object> cache : caches()) {
checkEmpty(cache);
}
Reported by PMD.
Line: 42
* @author mike nonemacher
*/
public class EmptyCachesTest extends TestCase {
public void testEmpty() {
for (LoadingCache<Object, Object> cache : caches()) {
checkEmpty(cache);
}
Reported by PMD.
Line: 44
public class EmptyCachesTest extends TestCase {
public void testEmpty() {
for (LoadingCache<Object, Object> cache : caches()) {
checkEmpty(cache);
}
}
Reported by PMD.
Line: 44
public class EmptyCachesTest extends TestCase {
public void testEmpty() {
for (LoadingCache<Object, Object> cache : caches()) {
checkEmpty(cache);
}
}
Reported by PMD.
Line: 51
}
public void testInvalidate_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
cache.getUnchecked("b");
cache.invalidate("a");
cache.invalidate("b");
Reported by PMD.
Line: 51
}
public void testInvalidate_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
cache.getUnchecked("b");
cache.invalidate("a");
cache.invalidate("b");
Reported by PMD.
Line: 62
}
}
public void testInvalidateAll_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
cache.getUnchecked("b");
cache.getUnchecked("c");
cache.invalidateAll();
Reported by PMD.
Line: 62
}
}
public void testInvalidateAll_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
cache.getUnchecked("b");
cache.getUnchecked("c");
cache.invalidateAll();
Reported by PMD.
Line: 73
}
public void testEquals_null() {
for (LoadingCache<Object, Object> cache : caches()) {
assertFalse(cache.equals(null));
}
}
Reported by PMD.