The following issues were found
guava-tests/test/com/google/common/math/PairedStatsAccumulatorTest.java
194 issues
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.math.StatsTesting.ALLOWED_ERROR;
import static com.google.common.math.StatsTesting.ALL_MANY_VALUES;
import static com.google.common.math.StatsTesting.EMPTY_STATS_ITERABLE;
import static com.google.common.math.StatsTesting.MANY_VALUES;
Reported by PMD.
Line: 60
*
* @author Pete Gillin
*/
public class PairedStatsAccumulatorTest extends TestCase {
private PairedStatsAccumulator emptyAccumulator;
private PairedStatsAccumulator emptyAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator oneValueAccumulator;
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
Reported by PMD.
Line: 60
*
* @author Pete Gillin
*/
public class PairedStatsAccumulatorTest extends TestCase {
private PairedStatsAccumulator emptyAccumulator;
private PairedStatsAccumulator emptyAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator oneValueAccumulator;
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
Reported by PMD.
Line: 62
*/
public class PairedStatsAccumulatorTest extends TestCase {
private PairedStatsAccumulator emptyAccumulator;
private PairedStatsAccumulator emptyAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator oneValueAccumulator;
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator twoValuesAccumulator;
private PairedStatsAccumulator twoValuesAccumulatorByAddAllPartitionedPairedStats;
Reported by PMD.
Line: 63
public class PairedStatsAccumulatorTest extends TestCase {
private PairedStatsAccumulator emptyAccumulator;
private PairedStatsAccumulator emptyAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator oneValueAccumulator;
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator twoValuesAccumulator;
private PairedStatsAccumulator twoValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator manyValuesAccumulator;
Reported by PMD.
Line: 64
private PairedStatsAccumulator emptyAccumulator;
private PairedStatsAccumulator emptyAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator oneValueAccumulator;
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator twoValuesAccumulator;
private PairedStatsAccumulator twoValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator manyValuesAccumulator;
private PairedStatsAccumulator manyValuesAccumulatorByAddAllPartitionedPairedStats;
Reported by PMD.
Line: 65
private PairedStatsAccumulator emptyAccumulator;
private PairedStatsAccumulator emptyAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator oneValueAccumulator;
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator twoValuesAccumulator;
private PairedStatsAccumulator twoValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator manyValuesAccumulator;
private PairedStatsAccumulator manyValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator horizontalValuesAccumulator;
Reported by PMD.
Line: 66
private PairedStatsAccumulator emptyAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator oneValueAccumulator;
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator twoValuesAccumulator;
private PairedStatsAccumulator twoValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator manyValuesAccumulator;
private PairedStatsAccumulator manyValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator horizontalValuesAccumulator;
private PairedStatsAccumulator horizontalValuesAccumulatorByAddAllPartitionedPairedStats;
Reported by PMD.
Line: 67
private PairedStatsAccumulator oneValueAccumulator;
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator twoValuesAccumulator;
private PairedStatsAccumulator twoValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator manyValuesAccumulator;
private PairedStatsAccumulator manyValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator horizontalValuesAccumulator;
private PairedStatsAccumulator horizontalValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator verticalValuesAccumulator;
Reported by PMD.
Line: 68
private PairedStatsAccumulator oneValueAccumulatorByAddAllEmptyPairedStats;
private PairedStatsAccumulator twoValuesAccumulator;
private PairedStatsAccumulator twoValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator manyValuesAccumulator;
private PairedStatsAccumulator manyValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator horizontalValuesAccumulator;
private PairedStatsAccumulator horizontalValuesAccumulatorByAddAllPartitionedPairedStats;
private PairedStatsAccumulator verticalValuesAccumulator;
private PairedStatsAccumulator verticalValuesAccumulatorByAddAllPartitionedPairedStats;
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java
193 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.truth.Truth.assertThat;
import static java.util.Arrays.asList;
Reported by PMD.
Line: 54
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ImmutableMultisetTest extends TestCase {
@GwtIncompatible // suite // TODO(cpovirk): add to collect/gwt/suites
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableMultisetTest.class);
Reported by PMD.
Line: 54
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ImmutableMultisetTest extends TestCase {
@GwtIncompatible // suite // TODO(cpovirk): add to collect/gwt/suites
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableMultisetTest.class);
Reported by PMD.
Line: 56
@GwtCompatible(emulated = true)
public class ImmutableMultisetTest extends TestCase {
@GwtIncompatible // suite // TODO(cpovirk): add to collect/gwt/suites
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableMultisetTest.class);
suite.addTest(
Reported by PMD.
Line: 81
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
return ImmutableMultiset.copyOf(elements).elementSet();
}
})
.named("ImmutableMultiset, element set")
.withFeatures(
CollectionSize.ANY,
Reported by PMD.
Line: 96
new TestStringListGenerator() {
@Override
protected List<String> create(String[] elements) {
return ImmutableMultiset.copyOf(elements).asList();
}
@Override
public List<String> order(List<String> insertionOrder) {
List<String> order = new ArrayList<>();
Reported by PMD.
Line: 132
builder.addCopies(s, 2);
}
ImmutableSet<String> elementSet =
(ImmutableSet<String>) builder.build().elementSet();
return elementSet.asList();
}
})
.named("ImmutableMultiset.elementSet.asList")
.withFeatures(
Reported by PMD.
Line: 133
}
ImmutableSet<String> elementSet =
(ImmutableSet<String>) builder.build().elementSet();
return elementSet.asList();
}
})
.named("ImmutableMultiset.elementSet.asList")
.withFeatures(
CollectionSize.ANY,
Reported by PMD.
Line: 147
return suite;
}
public void testCreation_noArgs() {
Multiset<String> multiset = ImmutableMultiset.of();
assertTrue(multiset.isEmpty());
}
public void testCreation_oneElement() {
Reported by PMD.
Line: 149
public void testCreation_noArgs() {
Multiset<String> multiset = ImmutableMultiset.of();
assertTrue(multiset.isEmpty());
}
public void testCreation_oneElement() {
Multiset<String> multiset = ImmutableMultiset.of("a");
assertEquals(HashMultiset.create(asList("a")), multiset);
Reported by PMD.
guava-tests/test/com/google/common/hash/MacHashFunctionTest.java
191 issues
Line: 158
}
@Override
public byte[] getEncoded() {
return null;
}
@Override
public String getFormat() {
Reported by PMD.
Line: 40
*
* @author Kurt Alfred Kluever
*/
public class MacHashFunctionTest extends TestCase {
private static final ImmutableSet<String> INPUTS = ImmutableSet.of("", "Z", "foobar");
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
Reported by PMD.
Line: 45
private static final ImmutableSet<String> INPUTS = ImmutableSet.of("", "Z", "foobar");
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
Reported by PMD.
Line: 45
private static final ImmutableSet<String> INPUTS = ImmutableSet.of("", "Z", "foobar");
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
Reported by PMD.
Line: 45
private static final ImmutableSet<String> INPUTS = ImmutableSet.of("", "Z", "foobar");
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
Reported by PMD.
Line: 47
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA512");
Reported by PMD.
Line: 47
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA512");
Reported by PMD.
Line: 49
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA512");
// From http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac
private static final ImmutableTable<String, SecretKey, HashFunction> ALGORITHMS =
Reported by PMD.
Line: 51
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA512");
// From http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac
private static final ImmutableTable<String, SecretKey, HashFunction> ALGORITHMS =
new ImmutableTable.Builder<String, SecretKey, HashFunction>()
.put("HmacMD5", MD5_KEY, Hashing.hmacMd5(MD5_KEY))
Reported by PMD.
Line: 62
.put("HmacSHA512", SHA512_KEY, Hashing.hmacSha512(SHA512_KEY))
.build();
public void testNulls() {
NullPointerTester tester =
new NullPointerTester().setDefault(String.class, "HmacMD5").setDefault(Key.class, MD5_KEY);
tester.testAllPublicConstructors(MacHashFunction.class);
tester.testAllPublicInstanceMethods(new MacHashFunction("HmacMD5", MD5_KEY, "toString"));
}
Reported by PMD.
android/guava-tests/test/com/google/common/hash/MacHashFunctionTest.java
191 issues
Line: 158
}
@Override
public byte[] getEncoded() {
return null;
}
@Override
public String getFormat() {
Reported by PMD.
Line: 40
*
* @author Kurt Alfred Kluever
*/
public class MacHashFunctionTest extends TestCase {
private static final ImmutableSet<String> INPUTS = ImmutableSet.of("", "Z", "foobar");
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
Reported by PMD.
Line: 45
private static final ImmutableSet<String> INPUTS = ImmutableSet.of("", "Z", "foobar");
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
Reported by PMD.
Line: 45
private static final ImmutableSet<String> INPUTS = ImmutableSet.of("", "Z", "foobar");
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
Reported by PMD.
Line: 45
private static final ImmutableSet<String> INPUTS = ImmutableSet.of("", "Z", "foobar");
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
Reported by PMD.
Line: 47
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA512");
Reported by PMD.
Line: 47
private static final SecretKey MD5_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacMD5");
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA512");
Reported by PMD.
Line: 49
private static final SecretKey SHA1_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA1");
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA512");
// From http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac
private static final ImmutableTable<String, SecretKey, HashFunction> ALGORITHMS =
Reported by PMD.
Line: 51
private static final SecretKey SHA256_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA256");
private static final SecretKey SHA512_KEY =
new SecretKeySpec("secret key".getBytes(UTF_8), "HmacSHA512");
// From http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#Mac
private static final ImmutableTable<String, SecretKey, HashFunction> ALGORITHMS =
new ImmutableTable.Builder<String, SecretKey, HashFunction>()
.put("HmacMD5", MD5_KEY, Hashing.hmacMd5(MD5_KEY))
Reported by PMD.
Line: 62
.put("HmacSHA512", SHA512_KEY, Hashing.hmacSha512(SHA512_KEY))
.build();
public void testNulls() {
NullPointerTester tester =
new NullPointerTester().setDefault(String.class, "HmacMD5").setDefault(Key.class, MD5_KEY);
tester.testAllPublicConstructors(MacHashFunction.class);
tester.testAllPublicInstanceMethods(new MacHashFunction("HmacMD5", MD5_KEY, "toString"));
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java
189 issues
Line: 34
* @author Kurt Alfred Kluever
*/
@GwtCompatible(emulated = true)
public class EvictingQueueTest extends TestCase {
public void testCreateWithNegativeSize() throws Exception {
try {
EvictingQueue.create(-1);
fail();
Reported by PMD.
Line: 36
@GwtCompatible(emulated = true)
public class EvictingQueueTest extends TestCase {
public void testCreateWithNegativeSize() throws Exception {
try {
EvictingQueue.create(-1);
fail();
} catch (IllegalArgumentException expected) {
}
Reported by PMD.
Line: 39
public void testCreateWithNegativeSize() throws Exception {
try {
EvictingQueue.create(-1);
fail();
} catch (IllegalArgumentException expected) {
}
}
public void testCreateWithZeroSize() throws Exception {
Reported by PMD.
Line: 39
public void testCreateWithNegativeSize() throws Exception {
try {
EvictingQueue.create(-1);
fail();
} catch (IllegalArgumentException expected) {
}
}
public void testCreateWithZeroSize() throws Exception {
Reported by PMD.
Line: 44
}
}
public void testCreateWithZeroSize() throws Exception {
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
Reported by PMD.
Line: 44
}
}
public void testCreateWithZeroSize() throws Exception {
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
Reported by PMD.
Line: 46
public void testCreateWithZeroSize() throws Exception {
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
assertTrue(queue.offer("hi"));
Reported by PMD.
Line: 46
public void testCreateWithZeroSize() throws Exception {
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
assertTrue(queue.offer("hi"));
Reported by PMD.
Line: 48
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
assertTrue(queue.offer("hi"));
assertEquals(0, queue.size());
Reported by PMD.
Line: 48
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
assertTrue(queue.offer("hi"));
assertEquals(0, queue.size());
Reported by PMD.
guava-tests/test/com/google/common/collect/EvictingQueueTest.java
189 issues
Line: 34
* @author Kurt Alfred Kluever
*/
@GwtCompatible(emulated = true)
public class EvictingQueueTest extends TestCase {
public void testCreateWithNegativeSize() throws Exception {
try {
EvictingQueue.create(-1);
fail();
Reported by PMD.
Line: 36
@GwtCompatible(emulated = true)
public class EvictingQueueTest extends TestCase {
public void testCreateWithNegativeSize() throws Exception {
try {
EvictingQueue.create(-1);
fail();
} catch (IllegalArgumentException expected) {
}
Reported by PMD.
Line: 39
public void testCreateWithNegativeSize() throws Exception {
try {
EvictingQueue.create(-1);
fail();
} catch (IllegalArgumentException expected) {
}
}
public void testCreateWithZeroSize() throws Exception {
Reported by PMD.
Line: 39
public void testCreateWithNegativeSize() throws Exception {
try {
EvictingQueue.create(-1);
fail();
} catch (IllegalArgumentException expected) {
}
}
public void testCreateWithZeroSize() throws Exception {
Reported by PMD.
Line: 44
}
}
public void testCreateWithZeroSize() throws Exception {
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
Reported by PMD.
Line: 44
}
}
public void testCreateWithZeroSize() throws Exception {
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
Reported by PMD.
Line: 46
public void testCreateWithZeroSize() throws Exception {
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
assertTrue(queue.offer("hi"));
Reported by PMD.
Line: 46
public void testCreateWithZeroSize() throws Exception {
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
assertTrue(queue.offer("hi"));
Reported by PMD.
Line: 48
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
assertTrue(queue.offer("hi"));
assertEquals(0, queue.size());
Reported by PMD.
Line: 48
EvictingQueue<String> queue = EvictingQueue.create(0);
assertEquals(0, queue.size());
assertTrue(queue.add("hi"));
assertEquals(0, queue.size());
assertTrue(queue.offer("hi"));
assertEquals(0, queue.size());
Reported by PMD.
android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java
185 issues
Line: 53
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class LinkedHashMultimapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
Reported by PMD.
Line: 55
@GwtCompatible(emulated = true)
public class LinkedHashMultimapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
SetMultimapTestSuiteBuilder.using(
new TestStringSetMultimapGenerator() {
Reported by PMD.
Line: 86
return suite;
}
public void testValueSetHashTableExpansion() {
LinkedHashMultimap<String, Integer> multimap = LinkedHashMultimap.create();
for (int z = 1; z <= 100; z++) {
multimap.put("a", z);
// The Eclipse compiler (and hence GWT) rejects a parameterized cast.
@SuppressWarnings("unchecked")
Reported by PMD.
Line: 86
return suite;
}
public void testValueSetHashTableExpansion() {
LinkedHashMultimap<String, Integer> multimap = LinkedHashMultimap.create();
for (int z = 1; z <= 100; z++) {
multimap.put("a", z);
// The Eclipse compiler (and hence GWT) rejects a parameterized cast.
@SuppressWarnings("unchecked")
Reported by PMD.
Line: 93
// The Eclipse compiler (and hence GWT) rejects a parameterized cast.
@SuppressWarnings("unchecked")
LinkedHashMultimap<String, Integer>.ValueSet valueSet =
(LinkedHashMultimap.ValueSet) multimap.backingMap().get("a");
assertEquals(z, valueSet.size());
assertFalse(
Hashing.needsResizing(
valueSet.size(),
valueSet.hashTable.length,
Reported by PMD.
Line: 94
@SuppressWarnings("unchecked")
LinkedHashMultimap<String, Integer>.ValueSet valueSet =
(LinkedHashMultimap.ValueSet) multimap.backingMap().get("a");
assertEquals(z, valueSet.size());
assertFalse(
Hashing.needsResizing(
valueSet.size(),
valueSet.hashTable.length,
LinkedHashMultimap.VALUE_SET_LOAD_FACTOR));
Reported by PMD.
Line: 94
@SuppressWarnings("unchecked")
LinkedHashMultimap<String, Integer>.ValueSet valueSet =
(LinkedHashMultimap.ValueSet) multimap.backingMap().get("a");
assertEquals(z, valueSet.size());
assertFalse(
Hashing.needsResizing(
valueSet.size(),
valueSet.hashTable.length,
LinkedHashMultimap.VALUE_SET_LOAD_FACTOR));
Reported by PMD.
Line: 95
LinkedHashMultimap<String, Integer>.ValueSet valueSet =
(LinkedHashMultimap.ValueSet) multimap.backingMap().get("a");
assertEquals(z, valueSet.size());
assertFalse(
Hashing.needsResizing(
valueSet.size(),
valueSet.hashTable.length,
LinkedHashMultimap.VALUE_SET_LOAD_FACTOR));
}
Reported by PMD.
Line: 97
assertEquals(z, valueSet.size());
assertFalse(
Hashing.needsResizing(
valueSet.size(),
valueSet.hashTable.length,
LinkedHashMultimap.VALUE_SET_LOAD_FACTOR));
}
}
Reported by PMD.
Line: 105
private Multimap<String, Integer> initializeMultimap5() {
Multimap<String, Integer> multimap = LinkedHashMultimap.create();
multimap.put("foo", 5);
multimap.put("bar", 4);
multimap.put("foo", 3);
multimap.put("cow", 2);
multimap.put("bar", 1);
return multimap;
Reported by PMD.
android/guava-tests/test/com/google/common/graph/ValueGraphTest.java
185 issues
Line: 39
/** Tests for {@link StandardMutableValueGraph} and related functionality. */
// TODO(user): Expand coverage and move to proper test suite.
@RunWith(JUnit4.class)
public final class ValueGraphTest {
private static final String DEFAULT = "default";
MutableValueGraph<Integer, String> graph;
@After
Reported by PMD.
Line: 40
// TODO(user): Expand coverage and move to proper test suite.
@RunWith(JUnit4.class)
public final class ValueGraphTest {
private static final String DEFAULT = "default";
MutableValueGraph<Integer, String> graph;
@After
public void validateGraphState() {
Reported by PMD.
Line: 42
public final class ValueGraphTest {
private static final String DEFAULT = "default";
MutableValueGraph<Integer, String> graph;
@After
public void validateGraphState() {
assertStronglyEquivalent(graph, Graphs.copyOf(graph));
assertStronglyEquivalent(graph, ImmutableValueGraph.copyOf(graph));
Reported by PMD.
Line: 51
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
Reported by PMD.
Line: 51
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
Reported by PMD.
Line: 52
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
Reported by PMD.
Line: 52
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
Reported by PMD.
Line: 53
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
for (Integer node : graph.nodes()) {
Reported by PMD.
Line: 53
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
for (Integer node : graph.nodes()) {
Reported by PMD.
Line: 54
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
for (Integer node : graph.nodes()) {
assertThat(graph.adjacentNodes(node)).isEqualTo(asGraph.adjacentNodes(node));
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java
183 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: 59
* @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: 59
* @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: 67
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: 70
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: 73
@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: 81
tearDownStack.addTearDown(
new TearDown() {
@Override
public void tearDown() {
Thread.interrupted();
}
});
}
Reported by PMD.
Line: 88
});
}
@Override
protected void tearDown() {
tearDownStack.runTearDown();
}
public void testNull() throws Exception {
Reported by PMD.
Line: 93
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/hash/BloomFilterTest.java
182 issues
Line: 48
*
* @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: 48
*
* @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: 48
*
* @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: 60
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: 83
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: 83
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: 100
// 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: 122
numFpp++;
}
}
assertEquals(knownNumberOfFalsePositives, numFpp);
double expectedReportedFpp = (double) knownNumberOfFalsePositives / numInsertions;
double actualReportedFpp = bf.expectedFpp();
assertEquals(expectedReportedFpp, actualReportedFpp, 0.00015);
}
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;
Reported by PMD.
Line: 125
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.