The following issues were found
guava-tests/test/com/google/common/cache/CacheBuilderTest.java
278 issues
Line: 652
int behavior = random.nextInt(4);
if (behavior == 0) { // throw an exception
exceptionCount.incrementAndGet();
throw new RuntimeException("fake exception for test");
} else if (behavior == 1) { // return null
computeNullCount.incrementAndGet();
return null;
} else if (behavior == 2) { // slight delay before returning
Thread.sleep(5);
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.cache;
import static com.google.common.cache.TestingCacheLoaders.constantLoader;
import static com.google.common.cache.TestingCacheLoaders.identityLoader;
import static com.google.common.cache.TestingRemovalListeners.countingRemovalListener;
import static com.google.common.cache.TestingRemovalListeners.nullRemovalListener;
Reported by PMD.
Line: 51
/** Unit tests for CacheBuilder. */
@GwtCompatible(emulated = true)
public class CacheBuilderTest extends TestCase {
public void testNewBuilder() {
CacheLoader<Object, Integer> loader = constantLoader(1);
LoadingCache<String, Integer> cache =
Reported by PMD.
Line: 51
/** Unit tests for CacheBuilder. */
@GwtCompatible(emulated = true)
public class CacheBuilderTest extends TestCase {
public void testNewBuilder() {
CacheLoader<Object, Integer> loader = constantLoader(1);
LoadingCache<String, Integer> cache =
Reported by PMD.
Line: 51
/** Unit tests for CacheBuilder. */
@GwtCompatible(emulated = true)
public class CacheBuilderTest extends TestCase {
public void testNewBuilder() {
CacheLoader<Object, Integer> loader = constantLoader(1);
LoadingCache<String, Integer> cache =
Reported by PMD.
Line: 51
/** Unit tests for CacheBuilder. */
@GwtCompatible(emulated = true)
public class CacheBuilderTest extends TestCase {
public void testNewBuilder() {
CacheLoader<Object, Integer> loader = constantLoader(1);
LoadingCache<String, Integer> cache =
Reported by PMD.
Line: 51
/** Unit tests for CacheBuilder. */
@GwtCompatible(emulated = true)
public class CacheBuilderTest extends TestCase {
public void testNewBuilder() {
CacheLoader<Object, Integer> loader = constantLoader(1);
LoadingCache<String, Integer> cache =
Reported by PMD.
Line: 53
@GwtCompatible(emulated = true)
public class CacheBuilderTest extends TestCase {
public void testNewBuilder() {
CacheLoader<Object, Integer> loader = constantLoader(1);
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder().removalListener(countingRemovalListener()).build(loader);
Reported by PMD.
Line: 53
@GwtCompatible(emulated = true)
public class CacheBuilderTest extends TestCase {
public void testNewBuilder() {
CacheLoader<Object, Integer> loader = constantLoader(1);
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder().removalListener(countingRemovalListener()).build(loader);
Reported by PMD.
Line: 59
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder().removalListener(countingRemovalListener()).build(loader);
assertEquals(Integer.valueOf(1), cache.getUnchecked("one"));
assertEquals(1, cache.size());
}
public void testInitialCapacity_negative() {
CacheBuilder<Object, Object> builder = CacheBuilder.newBuilder();
Reported by PMD.
guava-tests/test/com/google/common/io/MoreFilesTest.java
276 issues
Line: 57
* @author Colin Decker
*/
public class MoreFilesTest extends TestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
suite.addTest(
ByteSourceTester.tests(
Reported by PMD.
Line: 57
* @author Colin Decker
*/
public class MoreFilesTest extends TestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
suite.addTest(
ByteSourceTester.tests(
Reported by PMD.
Line: 90
private static final FileSystem FS = FileSystems.getDefault();
private static Path root() {
return FS.getRootDirectories().iterator().next();
}
private Path tempDir;
@Override
Reported by PMD.
Line: 90
private static final FileSystem FS = FileSystems.getDefault();
private static Path root() {
return FS.getRootDirectories().iterator().next();
}
private Path tempDir;
@Override
Reported by PMD.
Line: 93
return FS.getRootDirectories().iterator().next();
}
private Path tempDir;
@Override
protected void setUp() throws Exception {
tempDir = Files.createTempDirectory("MoreFilesTest");
}
Reported by PMD.
Line: 95
private Path tempDir;
@Override
protected void setUp() throws Exception {
tempDir = Files.createTempDirectory("MoreFilesTest");
}
@Override
Reported by PMD.
Line: 100
tempDir = Files.createTempDirectory("MoreFilesTest");
}
@Override
protected void tearDown() throws Exception {
if (tempDir != null) {
// delete tempDir and its contents
Files.walkFileTree(
tempDir,
Reported by PMD.
Line: 131
return Files.createTempFile(tempDir, "test", ".test");
}
public void testByteSource_size_ofDirectory() throws IOException {
try (FileSystem fs = Jimfs.newFileSystem(Configuration.unix())) {
Path dir = fs.getPath("dir");
Files.createDirectory(dir);
ByteSource source = MoreFiles.asByteSource(dir);
Reported by PMD.
Line: 133
public void testByteSource_size_ofDirectory() throws IOException {
try (FileSystem fs = Jimfs.newFileSystem(Configuration.unix())) {
Path dir = fs.getPath("dir");
Files.createDirectory(dir);
ByteSource source = MoreFiles.asByteSource(dir);
assertThat(source.sizeIfKnown()).isAbsent();
Reported by PMD.
Line: 138
ByteSource source = MoreFiles.asByteSource(dir);
assertThat(source.sizeIfKnown()).isAbsent();
try {
source.size();
fail();
} catch (IOException expected) {
Reported by PMD.
android/guava-tests/test/com/google/common/graph/AbstractStandardDirectedNetworkTest.java
275 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: 35
/**
* 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: 35
/**
* 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: 42
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: 42
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: 42
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 (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: 43
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: 48
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: 48
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.
guava/src/com/google/common/collect/Maps.java
273 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.compose;
import static com.google.common.collect.CollectPreconditions.checkEntryNotNull;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.compose;
import static com.google.common.collect.CollectPreconditions.checkEntryNotNull;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.compose;
import static com.google.common.collect.CollectPreconditions.checkEntryNotNull;
Reported by PMD.
Line: 92
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 92
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 92
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 92
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 92
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 92
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 112
};
}
@SuppressWarnings("unchecked")
static <K extends @Nullable Object> Function<Entry<K, ?>, K> keyFunction() {
return (Function) EntryFunction.KEY;
}
@SuppressWarnings("unchecked")
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java
270 issues
Line: 38
* @author Louis Wasserman
*/
@GwtIncompatible // ImmutableRangeSet
public class ImmutableRangeSetTest extends AbstractRangeSetTest {
static final class ImmutableRangeSetIntegerAsSetGenerator implements TestSetGenerator<Integer> {
@Override
public SampleElements<Integer> samples() {
return new SampleElements<>(1, 4, 3, 2, 5);
Reported by PMD.
Line: 38
* @author Louis Wasserman
*/
@GwtIncompatible // ImmutableRangeSet
public class ImmutableRangeSetTest extends AbstractRangeSetTest {
static final class ImmutableRangeSetIntegerAsSetGenerator implements TestSetGenerator<Integer> {
@Override
public SampleElements<Integer> samples() {
return new SampleElements<>(1, 4, 3, 2, 5);
Reported by PMD.
Line: 38
* @author Louis Wasserman
*/
@GwtIncompatible // ImmutableRangeSet
public class ImmutableRangeSetTest extends AbstractRangeSetTest {
static final class ImmutableRangeSetIntegerAsSetGenerator implements TestSetGenerator<Integer> {
@Override
public SampleElements<Integer> samples() {
return new SampleElements<>(1, 4, 3, 2, 5);
Reported by PMD.
Line: 38
* @author Louis Wasserman
*/
@GwtIncompatible // ImmutableRangeSet
public class ImmutableRangeSetTest extends AbstractRangeSetTest {
static final class ImmutableRangeSetIntegerAsSetGenerator implements TestSetGenerator<Integer> {
@Override
public SampleElements<Integer> samples() {
return new SampleElements<>(1, 4, 3, 2, 5);
Reported by PMD.
Line: 53
@Override
public Iterable<Integer> order(List<Integer> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
@Override
public Set<Integer> create(Object... elements) {
ImmutableRangeSet.Builder<Integer> builder = ImmutableRangeSet.builder();
Reported by PMD.
Line: 63
Integer i = (Integer) o;
builder.add(Range.singleton(i));
}
return builder.build().asSet(DiscreteDomain.integers());
}
}
static final class ImmutableRangeSetBigIntegerAsSetGenerator
implements TestSetGenerator<BigInteger> {
Reported by PMD.
Line: 86
@Override
public Iterable<BigInteger> order(List<BigInteger> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
@Override
public Set<BigInteger> create(Object... elements) {
ImmutableRangeSet.Builder<BigInteger> builder = ImmutableRangeSet.builder();
Reported by PMD.
Line: 94
ImmutableRangeSet.Builder<BigInteger> builder = ImmutableRangeSet.builder();
for (Object o : elements) {
BigInteger i = (BigInteger) o;
builder.add(Range.closedOpen(i, i.add(BigInteger.ONE)));
}
return builder.build().asSet(DiscreteDomain.bigIntegers());
}
}
Reported by PMD.
Line: 96
BigInteger i = (BigInteger) o;
builder.add(Range.closedOpen(i, i.add(BigInteger.ONE)));
}
return builder.build().asSet(DiscreteDomain.bigIntegers());
}
}
public static Test suite() {
TestSuite suite = new TestSuite();
Reported by PMD.
Line: 100
}
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableRangeSetTest.class);
suite.addTest(
NavigableSetTestSuiteBuilder.using(new ImmutableRangeSetIntegerAsSetGenerator())
.named("ImmutableRangeSet.asSet[DiscreteDomain.integers[]]")
Reported by PMD.
android/guava/src/com/google/common/collect/Maps.java
268 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.compose;
import static com.google.common.collect.CollectPreconditions.checkEntryNotNull;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.compose;
import static com.google.common.collect.CollectPreconditions.checkEntryNotNull;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.compose;
import static com.google.common.collect.CollectPreconditions.checkEntryNotNull;
Reported by PMD.
Line: 85
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 85
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 85
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 85
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 85
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 85
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Maps {
private Maps() {}
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
KEY {
@Override
Reported by PMD.
Line: 105
};
}
@SuppressWarnings("unchecked")
static <K extends @Nullable Object> Function<Entry<K, ?>, K> keyFunction() {
return (Function) EntryFunction.KEY;
}
@SuppressWarnings("unchecked")
Reported by PMD.
guava-tests/test/com/google/common/primitives/ImmutableDoubleArrayTest.java
268 issues
Line: 46
/** @author Kevin Bourrillion */
@GwtCompatible(emulated = true)
public class ImmutableDoubleArrayTest extends TestCase {
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableDoubleArray.of().asList()).isEmpty();
}
Reported by PMD.
Line: 46
/** @author Kevin Bourrillion */
@GwtCompatible(emulated = true)
public class ImmutableDoubleArrayTest extends TestCase {
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableDoubleArray.of().asList()).isEmpty();
}
Reported by PMD.
Line: 49
public class ImmutableDoubleArrayTest extends TestCase {
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableDoubleArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableDoubleArray.of(0).asList()).containsExactly(0.0);
Reported by PMD.
Line: 50
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableDoubleArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableDoubleArray.of(0).asList()).containsExactly(0.0);
}
Reported by PMD.
Line: 50
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableDoubleArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableDoubleArray.of(0).asList()).containsExactly(0.0);
}
Reported by PMD.
Line: 53
assertThat(ImmutableDoubleArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableDoubleArray.of(0).asList()).containsExactly(0.0);
}
public void testOf2() {
assertThat(ImmutableDoubleArray.of(0, 1).asList()).containsExactly(0.0, 1.0).inOrder();
Reported by PMD.
Line: 54
}
public void testOf1() {
assertThat(ImmutableDoubleArray.of(0).asList()).containsExactly(0.0);
}
public void testOf2() {
assertThat(ImmutableDoubleArray.of(0, 1).asList()).containsExactly(0.0, 1.0).inOrder();
}
Reported by PMD.
Line: 54
}
public void testOf1() {
assertThat(ImmutableDoubleArray.of(0).asList()).containsExactly(0.0);
}
public void testOf2() {
assertThat(ImmutableDoubleArray.of(0, 1).asList()).containsExactly(0.0, 1.0).inOrder();
}
Reported by PMD.
Line: 57
assertThat(ImmutableDoubleArray.of(0).asList()).containsExactly(0.0);
}
public void testOf2() {
assertThat(ImmutableDoubleArray.of(0, 1).asList()).containsExactly(0.0, 1.0).inOrder();
}
public void testOf3() {
assertThat(ImmutableDoubleArray.of(0, 1, 3).asList()).containsExactly(0.0, 1.0, 3.0).inOrder();
Reported by PMD.
Line: 58
}
public void testOf2() {
assertThat(ImmutableDoubleArray.of(0, 1).asList()).containsExactly(0.0, 1.0).inOrder();
}
public void testOf3() {
assertThat(ImmutableDoubleArray.of(0, 1, 3).asList()).containsExactly(0.0, 1.0, 3.0).inOrder();
}
Reported by PMD.
guava-tests/test/com/google/common/collect/ImmutableMapTest.java
267 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.collect.testing.Helpers.mapEntry;
import static com.google.common.testing.SerializableTester.reserialize;
import static com.google.common.truth.Truth.assertThat;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.collect.testing.Helpers.mapEntry;
import static com.google.common.testing.SerializableTester.reserialize;
import static com.google.common.truth.Truth.assertThat;
Reported by PMD.
Line: 80
* @author Jesse Wilson
*/
@GwtCompatible(emulated = true)
public class ImmutableMapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableMapTest.class);
Reported by PMD.
Line: 82
@GwtCompatible(emulated = true)
public class ImmutableMapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableMapTest.class);
suite.addTestSuite(FloodingTest.class);
Reported by PMD.
Line: 83
public class ImmutableMapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableMapTest.class);
suite.addTestSuite(FloodingTest.class);
suite.addTest(
Reported by PMD.
Line: 216
protected void assertMoreInvariants(Map<K, V> map) {
// TODO: can these be moved to MapInterfaceTest?
for (Entry<K, V> entry : map.entrySet()) {
assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
Reported by PMD.
Line: 219
assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
Reported by PMD.
Line: 220
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
Reported by PMD.
Line: 220
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
Reported by PMD.
Line: 221
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
}
Reported by PMD.
guava-tests/test/com/google/common/math/BigIntegerMathTest.java
267 issues
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.math.MathTesting.ALL_BIGINTEGER_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
import static com.google.common.math.MathTesting.ALL_SAFE_ROUNDING_MODES;
import static com.google.common.math.MathTesting.NEGATIVE_BIGINTEGER_CANDIDATES;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.math.MathTesting.ALL_BIGINTEGER_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
import static com.google.common.math.MathTesting.ALL_SAFE_ROUNDING_MODES;
import static com.google.common.math.MathTesting.NEGATIVE_BIGINTEGER_CANDIDATES;
Reported by PMD.
Line: 58
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
Reported by PMD.
Line: 58
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
Reported by PMD.
Line: 58
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
Reported by PMD.
Line: 59
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
Reported by PMD.
Line: 59
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
Reported by PMD.
Line: 62
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
}
}
Reported by PMD.
Line: 63
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
}
}
public void testFloorPowerOfTwo() {
Reported by PMD.
Line: 63
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
}
}
public void testFloorPowerOfTwo() {
Reported by PMD.
android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java
267 issues
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.math.MathTesting.ALL_BIGINTEGER_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
import static com.google.common.math.MathTesting.ALL_SAFE_ROUNDING_MODES;
import static com.google.common.math.MathTesting.NEGATIVE_BIGINTEGER_CANDIDATES;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.math.MathTesting.ALL_BIGINTEGER_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
import static com.google.common.math.MathTesting.ALL_SAFE_ROUNDING_MODES;
import static com.google.common.math.MathTesting.NEGATIVE_BIGINTEGER_CANDIDATES;
Reported by PMD.
Line: 58
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
Reported by PMD.
Line: 58
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
Reported by PMD.
Line: 58
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
Reported by PMD.
Line: 59
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
Reported by PMD.
Line: 59
*/
@GwtCompatible(emulated = true)
public class BigIntegerMathTest extends TestCase {
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
Reported by PMD.
Line: 62
public void testCeilingPowerOfTwo() {
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
}
}
Reported by PMD.
Line: 63
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
}
}
public void testFloorPowerOfTwo() {
Reported by PMD.
Line: 63
for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
BigInteger result = BigIntegerMath.ceilingPowerOfTwo(x);
assertTrue(BigIntegerMath.isPowerOfTwo(result));
assertTrue(result.compareTo(x) >= 0);
assertTrue(result.compareTo(x.add(x)) < 0);
}
}
public void testFloorPowerOfTwo() {
Reported by PMD.