The following issues were found
guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java
290 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newHashSet;
import static com.google.common.collect.Sets.newLinkedHashSet;
import static com.google.common.collect.testing.IteratorFeature.MODIFIABLE;
Reported by PMD.
Line: 57
* @author Mike Bostock
*/
@GwtCompatible(emulated = true)
public class LinkedListMultimapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
Reported by PMD.
Line: 59
@GwtCompatible(emulated = true)
public class LinkedListMultimapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
ListMultimapTestSuiteBuilder.using(
new TestStringListMultimapGenerator() {
Reported by PMD.
Line: 94
}
/** Confirm that get() returns a List that doesn't implement RandomAccess. */
public void testGetRandomAccess() {
Multimap<String, Integer> multimap = create();
multimap.put("foo", 1);
multimap.put("foo", 3);
assertFalse(multimap.get("foo") instanceof RandomAccess);
assertFalse(multimap.get("bar") instanceof RandomAccess);
Reported by PMD.
Line: 94
}
/** Confirm that get() returns a List that doesn't implement RandomAccess. */
public void testGetRandomAccess() {
Multimap<String, Integer> multimap = create();
multimap.put("foo", 1);
multimap.put("foo", 3);
assertFalse(multimap.get("foo") instanceof RandomAccess);
assertFalse(multimap.get("bar") instanceof RandomAccess);
Reported by PMD.
Line: 96
/** Confirm that get() returns a List that doesn't implement RandomAccess. */
public void testGetRandomAccess() {
Multimap<String, Integer> multimap = create();
multimap.put("foo", 1);
multimap.put("foo", 3);
assertFalse(multimap.get("foo") instanceof RandomAccess);
assertFalse(multimap.get("bar") instanceof RandomAccess);
}
Reported by PMD.
Line: 96
/** Confirm that get() returns a List that doesn't implement RandomAccess. */
public void testGetRandomAccess() {
Multimap<String, Integer> multimap = create();
multimap.put("foo", 1);
multimap.put("foo", 3);
assertFalse(multimap.get("foo") instanceof RandomAccess);
assertFalse(multimap.get("bar") instanceof RandomAccess);
}
Reported by PMD.
Line: 97
public void testGetRandomAccess() {
Multimap<String, Integer> multimap = create();
multimap.put("foo", 1);
multimap.put("foo", 3);
assertFalse(multimap.get("foo") instanceof RandomAccess);
assertFalse(multimap.get("bar") instanceof RandomAccess);
}
/**
Reported by PMD.
Line: 98
Multimap<String, Integer> multimap = create();
multimap.put("foo", 1);
multimap.put("foo", 3);
assertFalse(multimap.get("foo") instanceof RandomAccess);
assertFalse(multimap.get("bar") instanceof RandomAccess);
}
/**
* Confirm that removeAll() returns a List that implements RandomAccess, even though get()
Reported by PMD.
Line: 98
Multimap<String, Integer> multimap = create();
multimap.put("foo", 1);
multimap.put("foo", 3);
assertFalse(multimap.get("foo") instanceof RandomAccess);
assertFalse(multimap.get("bar") instanceof RandomAccess);
}
/**
* Confirm that removeAll() returns a List that implements RandomAccess, even though get()
Reported by PMD.
guava-tests/test/com/google/common/cache/LocalLoadingCacheTest.java
287 issues
Line: 39
import junit.framework.TestCase;
/** @author Charles Fry */
public class LocalLoadingCacheTest extends TestCase {
private static <K, V> LocalLoadingCache<K, V> makeCache(
CacheBuilder<K, V> builder, CacheLoader<? super K, V> loader) {
return new LocalLoadingCache<>(builder, loader);
}
Reported by PMD.
Line: 52
// constructor tests
public void testComputingFunction() {
CacheLoader<Object, Object> loader =
new CacheLoader<Object, Object>() {
@Override
public Object load(Object from) {
return new Object();
Reported by PMD.
Line: 61
}
};
LocalLoadingCache<Object, Object> cache = makeCache(createCacheBuilder(), loader);
assertSame(loader, cache.localCache.defaultLoader);
}
// null parameters test
public void testNullParameters() throws Exception {
Reported by PMD.
Line: 66
// null parameters test
public void testNullParameters() throws Exception {
NullPointerTester tester = new NullPointerTester();
CacheLoader<Object, Object> loader = identityLoader();
tester.testAllPublicInstanceMethods(makeCache(createCacheBuilder(), loader));
}
Reported by PMD.
Line: 66
// null parameters test
public void testNullParameters() throws Exception {
NullPointerTester tester = new NullPointerTester();
CacheLoader<Object, Object> loader = identityLoader();
tester.testAllPublicInstanceMethods(makeCache(createCacheBuilder(), loader));
}
Reported by PMD.
Line: 74
// stats tests
public void testStats() {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1).maximumSize(2);
LocalLoadingCache<Object, Object> cache = makeCache(builder, identityLoader());
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
Reported by PMD.
Line: 74
// stats tests
public void testStats() {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1).maximumSize(2);
LocalLoadingCache<Object, Object> cache = makeCache(builder, identityLoader());
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
Reported by PMD.
Line: 77
public void testStats() {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1).maximumSize(2);
LocalLoadingCache<Object, Object> cache = makeCache(builder, identityLoader());
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
cache.getUnchecked(one);
CacheStats stats = cache.stats();
assertEquals(1, stats.requestCount());
Reported by PMD.
Line: 77
public void testStats() {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1).maximumSize(2);
LocalLoadingCache<Object, Object> cache = makeCache(builder, identityLoader());
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
cache.getUnchecked(one);
CacheStats stats = cache.stats();
assertEquals(1, stats.requestCount());
Reported by PMD.
Line: 80
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
cache.getUnchecked(one);
CacheStats stats = cache.stats();
assertEquals(1, stats.requestCount());
assertEquals(0, stats.hitCount());
assertEquals(0.0, stats.hitRate());
assertEquals(1, stats.missCount());
Reported by PMD.
android/guava-tests/test/com/google/common/cache/LocalLoadingCacheTest.java
287 issues
Line: 39
import junit.framework.TestCase;
/** @author Charles Fry */
public class LocalLoadingCacheTest extends TestCase {
private static <K, V> LocalLoadingCache<K, V> makeCache(
CacheBuilder<K, V> builder, CacheLoader<? super K, V> loader) {
return new LocalLoadingCache<>(builder, loader);
}
Reported by PMD.
Line: 52
// constructor tests
public void testComputingFunction() {
CacheLoader<Object, Object> loader =
new CacheLoader<Object, Object>() {
@Override
public Object load(Object from) {
return new Object();
Reported by PMD.
Line: 61
}
};
LocalLoadingCache<Object, Object> cache = makeCache(createCacheBuilder(), loader);
assertSame(loader, cache.localCache.defaultLoader);
}
// null parameters test
public void testNullParameters() throws Exception {
Reported by PMD.
Line: 66
// null parameters test
public void testNullParameters() throws Exception {
NullPointerTester tester = new NullPointerTester();
CacheLoader<Object, Object> loader = identityLoader();
tester.testAllPublicInstanceMethods(makeCache(createCacheBuilder(), loader));
}
Reported by PMD.
Line: 66
// null parameters test
public void testNullParameters() throws Exception {
NullPointerTester tester = new NullPointerTester();
CacheLoader<Object, Object> loader = identityLoader();
tester.testAllPublicInstanceMethods(makeCache(createCacheBuilder(), loader));
}
Reported by PMD.
Line: 74
// stats tests
public void testStats() {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1).maximumSize(2);
LocalLoadingCache<Object, Object> cache = makeCache(builder, identityLoader());
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
Reported by PMD.
Line: 74
// stats tests
public void testStats() {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1).maximumSize(2);
LocalLoadingCache<Object, Object> cache = makeCache(builder, identityLoader());
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
Reported by PMD.
Line: 77
public void testStats() {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1).maximumSize(2);
LocalLoadingCache<Object, Object> cache = makeCache(builder, identityLoader());
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
cache.getUnchecked(one);
CacheStats stats = cache.stats();
assertEquals(1, stats.requestCount());
Reported by PMD.
Line: 77
public void testStats() {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1).maximumSize(2);
LocalLoadingCache<Object, Object> cache = makeCache(builder, identityLoader());
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
cache.getUnchecked(one);
CacheStats stats = cache.stats();
assertEquals(1, stats.requestCount());
Reported by PMD.
Line: 80
assertEquals(EMPTY_STATS, cache.stats());
Object one = new Object();
cache.getUnchecked(one);
CacheStats stats = cache.stats();
assertEquals(1, stats.requestCount());
assertEquals(0, stats.hitCount());
assertEquals(0.0, stats.hitRate());
assertEquals(1, stats.missCount());
Reported by PMD.
guava/src/com/google/common/collect/MapMakerInternalMap.java
285 issues
Line: 1209
Segment(MapMakerInternalMap<K, V, E, S> map, int initialCapacity, int maxSegmentSize) {
this.map = map;
this.maxSegmentSize = maxSegmentSize;
initTable(newEntryArray(initialCapacity));
}
/**
* Returns {@code this} up-casted to the specific {@link Segment} implementation type {@code S}.
*
Reported by PMD.
Line: 2516
HashIterator() {
nextSegmentIndex = segments.length - 1;
nextTableIndex = -1;
advance();
}
@Override
public abstract T next();
Reported by PMD.
Line: 1055
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 1055
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 1055
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 1055
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 1055
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkRemove;
import com.google.common.annotations.GwtIncompatible;
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkRemove;
import com.google.common.annotations.GwtIncompatible;
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkRemove;
import com.google.common.annotations.GwtIncompatible;
Reported by PMD.
android/guava/src/com/google/common/collect/MapMakerInternalMap.java
285 issues
Line: 1214
Segment(MapMakerInternalMap<K, V, E, S> map, int initialCapacity, int maxSegmentSize) {
this.map = map;
this.maxSegmentSize = maxSegmentSize;
initTable(newEntryArray(initialCapacity));
}
/**
* Returns {@code this} up-casted to the specific {@link Segment} implementation type {@code S}.
*
Reported by PMD.
Line: 2521
HashIterator() {
nextSegmentIndex = segments.length - 1;
nextTableIndex = -1;
advance();
}
@Override
public abstract T next();
Reported by PMD.
Line: 1060
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 1060
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 1060
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 1060
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 1060
*
* @param h hash code
*/
static int rehash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
// TODO(kevinb): use Hashing/move this to Hashing?
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkRemove;
import com.google.common.annotations.GwtIncompatible;
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkRemove;
import com.google.common.annotations.GwtIncompatible;
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkRemove;
import com.google.common.annotations.GwtIncompatible;
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ContiguousSetTest.java
283 issues
Line: 49
/** @author Gregory Kick */
@GwtCompatible(emulated = true)
public class ContiguousSetTest extends TestCase {
private static final DiscreteDomain<Integer> NOT_EQUAL_TO_INTEGERS =
new DiscreteDomain<Integer>() {
@Override
public Integer next(Integer value) {
return integers().next(value);
Reported by PMD.
Line: 54
new DiscreteDomain<Integer>() {
@Override
public Integer next(Integer value) {
return integers().next(value);
}
@Override
public Integer previous(Integer value) {
return integers().previous(value);
Reported by PMD.
Line: 59
@Override
public Integer previous(Integer value) {
return integers().previous(value);
}
@Override
public long distance(Integer start, Integer end) {
return integers().distance(start, end);
Reported by PMD.
Line: 64
@Override
public long distance(Integer start, Integer end) {
return integers().distance(start, end);
}
@Override
public Integer minValue() {
return integers().minValue();
Reported by PMD.
Line: 69
@Override
public Integer minValue() {
return integers().minValue();
}
@Override
public Integer maxValue() {
return integers().maxValue();
Reported by PMD.
Line: 74
@Override
public Integer maxValue() {
return integers().maxValue();
}
};
public void testInvalidIntRange() {
try {
Reported by PMD.
Line: 78
}
};
public void testInvalidIntRange() {
try {
ContiguousSet.closed(2, 1);
fail();
} catch (IllegalArgumentException expected) {
}
Reported by PMD.
Line: 81
public void testInvalidIntRange() {
try {
ContiguousSet.closed(2, 1);
fail();
} catch (IllegalArgumentException expected) {
}
try {
ContiguousSet.closedOpen(2, 1);
fail();
Reported by PMD.
Line: 81
public void testInvalidIntRange() {
try {
ContiguousSet.closed(2, 1);
fail();
} catch (IllegalArgumentException expected) {
}
try {
ContiguousSet.closedOpen(2, 1);
fail();
Reported by PMD.
Line: 86
}
try {
ContiguousSet.closedOpen(2, 1);
fail();
} catch (IllegalArgumentException expected) {
}
}
public void testInvalidLongRange() {
Reported by PMD.
guava-testlib/test/com/google/common/testing/ArbitraryInstancesTest.java
283 issues
Line: 465
new WithExceptionalConstructor("whatever");
public WithExceptionalConstructor() {
throw new RuntimeException();
}
private WithExceptionalConstructor(String unused) {}
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.testing;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.base.CharMatcher;
import com.google.common.base.Charsets;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.testing;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.base.CharMatcher;
import com.google.common.base.Charsets;
Reported by PMD.
Line: 140
*
* @author Ben Yu
*/
public class ArbitraryInstancesTest extends TestCase {
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
Reported by PMD.
Line: 142
*/
public class ArbitraryInstancesTest extends TestCase {
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
Reported by PMD.
Line: 142
*/
public class ArbitraryInstancesTest extends TestCase {
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
Reported by PMD.
Line: 143
public class ArbitraryInstancesTest extends TestCase {
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
Reported by PMD.
Line: 144
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(byte.class));
Reported by PMD.
Line: 145
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(byte.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(Byte.class));
Reported by PMD.
Line: 145
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(byte.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(Byte.class));
Reported by PMD.
guava-tests/test/com/google/common/collect/ContiguousSetTest.java
283 issues
Line: 49
/** @author Gregory Kick */
@GwtCompatible(emulated = true)
public class ContiguousSetTest extends TestCase {
private static final DiscreteDomain<Integer> NOT_EQUAL_TO_INTEGERS =
new DiscreteDomain<Integer>() {
@Override
public Integer next(Integer value) {
return integers().next(value);
Reported by PMD.
Line: 54
new DiscreteDomain<Integer>() {
@Override
public Integer next(Integer value) {
return integers().next(value);
}
@Override
public Integer previous(Integer value) {
return integers().previous(value);
Reported by PMD.
Line: 59
@Override
public Integer previous(Integer value) {
return integers().previous(value);
}
@Override
public long distance(Integer start, Integer end) {
return integers().distance(start, end);
Reported by PMD.
Line: 64
@Override
public long distance(Integer start, Integer end) {
return integers().distance(start, end);
}
@Override
public Integer minValue() {
return integers().minValue();
Reported by PMD.
Line: 69
@Override
public Integer minValue() {
return integers().minValue();
}
@Override
public Integer maxValue() {
return integers().maxValue();
Reported by PMD.
Line: 74
@Override
public Integer maxValue() {
return integers().maxValue();
}
};
public void testInvalidIntRange() {
try {
Reported by PMD.
Line: 78
}
};
public void testInvalidIntRange() {
try {
ContiguousSet.closed(2, 1);
fail();
} catch (IllegalArgumentException expected) {
}
Reported by PMD.
Line: 81
public void testInvalidIntRange() {
try {
ContiguousSet.closed(2, 1);
fail();
} catch (IllegalArgumentException expected) {
}
try {
ContiguousSet.closedOpen(2, 1);
fail();
Reported by PMD.
Line: 81
public void testInvalidIntRange() {
try {
ContiguousSet.closed(2, 1);
fail();
} catch (IllegalArgumentException expected) {
}
try {
ContiguousSet.closedOpen(2, 1);
fail();
Reported by PMD.
Line: 86
}
try {
ContiguousSet.closedOpen(2, 1);
fail();
} catch (IllegalArgumentException expected) {
}
}
public void testInvalidLongRange() {
Reported by PMD.
guava-tests/test/com/google/common/graph/AbstractStandardDirectedNetworkTest.java
280 issues
Line: 17
* limitations under the License.
*/
package com.google.common.graph;
import static com.google.common.graph.GraphConstants.ENDPOINTS_MISMATCH;
import static com.google.common.graph.TestUtil.assertEdgeNotInGraphErrorMessage;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.TruthJUnit.assume;
Reported by PMD.
Line: 36
/**
* Abstract base class for testing directed {@link Network} implementations defined in this package.
*/
public abstract class AbstractStandardDirectedNetworkTest extends AbstractNetworkTest {
@After
public void validateSourceAndTarget() {
for (Integer node : network.nodes()) {
for (String inEdge : network.inEdges(node)) {
Reported by PMD.
Line: 36
/**
* Abstract base class for testing directed {@link Network} implementations defined in this package.
*/
public abstract class AbstractStandardDirectedNetworkTest extends AbstractNetworkTest {
@After
public void validateSourceAndTarget() {
for (Integer node : network.nodes()) {
for (String inEdge : network.inEdges(node)) {
Reported by PMD.
Line: 43
for (Integer node : network.nodes()) {
for (String inEdge : network.inEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(inEdge);
assertThat(endpointPair.source()).isEqualTo(endpointPair.adjacentNode(node));
assertThat(endpointPair.target()).isEqualTo(node);
}
for (String outEdge : network.outEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(outEdge);
Reported by PMD.
Line: 43
for (Integer node : network.nodes()) {
for (String inEdge : network.inEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(inEdge);
assertThat(endpointPair.source()).isEqualTo(endpointPair.adjacentNode(node));
assertThat(endpointPair.target()).isEqualTo(node);
}
for (String outEdge : network.outEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(outEdge);
Reported by PMD.
Line: 43
for (Integer node : network.nodes()) {
for (String inEdge : network.inEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(inEdge);
assertThat(endpointPair.source()).isEqualTo(endpointPair.adjacentNode(node));
assertThat(endpointPair.target()).isEqualTo(node);
}
for (String outEdge : network.outEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(outEdge);
Reported by PMD.
Line: 44
for (String inEdge : network.inEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(inEdge);
assertThat(endpointPair.source()).isEqualTo(endpointPair.adjacentNode(node));
assertThat(endpointPair.target()).isEqualTo(node);
}
for (String outEdge : network.outEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(outEdge);
assertThat(endpointPair.source()).isEqualTo(node);
Reported by PMD.
Line: 44
for (String inEdge : network.inEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(inEdge);
assertThat(endpointPair.source()).isEqualTo(endpointPair.adjacentNode(node));
assertThat(endpointPair.target()).isEqualTo(node);
}
for (String outEdge : network.outEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(outEdge);
assertThat(endpointPair.source()).isEqualTo(node);
Reported by PMD.
Line: 49
for (String outEdge : network.outEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(outEdge);
assertThat(endpointPair.source()).isEqualTo(node);
assertThat(endpointPair.target()).isEqualTo(endpointPair.adjacentNode(node));
}
for (Integer adjacentNode : network.adjacentNodes(node)) {
Set<String> edges = network.edgesConnecting(node, adjacentNode);
Reported by PMD.
Line: 49
for (String outEdge : network.outEdges(node)) {
EndpointPair<Integer> endpointPair = network.incidentNodes(outEdge);
assertThat(endpointPair.source()).isEqualTo(node);
assertThat(endpointPair.target()).isEqualTo(endpointPair.adjacentNode(node));
}
for (Integer adjacentNode : network.adjacentNodes(node)) {
Set<String> edges = network.edgesConnecting(node, adjacentNode);
Reported by PMD.
android/guava-testlib/test/com/google/common/testing/ArbitraryInstancesTest.java
279 issues
Line: 457
new WithExceptionalConstructor("whatever");
public WithExceptionalConstructor() {
throw new RuntimeException();
}
private WithExceptionalConstructor(String unused) {}
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.testing;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.base.CharMatcher;
import com.google.common.base.Charsets;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.testing;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.base.CharMatcher;
import com.google.common.base.Charsets;
Reported by PMD.
Line: 136
*
* @author Ben Yu
*/
public class ArbitraryInstancesTest extends TestCase {
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
Reported by PMD.
Line: 138
*/
public class ArbitraryInstancesTest extends TestCase {
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
Reported by PMD.
Line: 138
*/
public class ArbitraryInstancesTest extends TestCase {
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
Reported by PMD.
Line: 139
public class ArbitraryInstancesTest extends TestCase {
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
Reported by PMD.
Line: 140
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(byte.class));
Reported by PMD.
Line: 141
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(byte.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(Byte.class));
Reported by PMD.
Line: 141
public void testGet_primitives() {
assertNull(ArbitraryInstances.get(void.class));
assertNull(ArbitraryInstances.get(Void.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(boolean.class));
assertEquals(Boolean.FALSE, ArbitraryInstances.get(Boolean.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(char.class));
assertEquals(Character.valueOf('\0'), ArbitraryInstances.get(Character.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(byte.class));
assertEquals(Byte.valueOf((byte) 0), ArbitraryInstances.get(Byte.class));
Reported by PMD.