The following issues were found
guava-tests/test/com/google/common/primitives/BooleansTest.java
239 issues
Line: 296
assertEquals(Booleans.asList(EMPTY), Collections.emptyList());
assertEquals(Booleans.asList(ARRAY_FALSE), Booleans.asList(ARRAY_FALSE));
assertFalse(Booleans.asList(ARRAY_FALSE).equals(ARRAY_FALSE));
assertFalse(Booleans.asList(ARRAY_FALSE).equals(null));
assertFalse(Booleans.asList(ARRAY_FALSE).equals(Booleans.asList(ARRAY_FALSE_TRUE)));
assertFalse(Booleans.asList(ARRAY_FALSE_FALSE).equals(Booleans.asList(ARRAY_FALSE_TRUE)));
assertEquals(1, Booleans.asList(ARRAY_FALSE_TRUE).lastIndexOf(true));
List<Boolean> reference = Booleans.asList(ARRAY_FALSE);
assertEquals(Booleans.asList(ARRAY_FALSE), reference);
Reported by PMD.
Line: 189
testReverse(new boolean[] {true, true, false, false}, new boolean[] {false, false, true, true});
}
private static void testReverse(boolean[] input, boolean[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Booleans.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 196
}
private static void testReverse(
boolean[] input, int fromIndex, int toIndex, boolean[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Booleans.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 37
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class BooleansTest extends TestCase {
private static final boolean[] EMPTY = {};
private static final boolean[] ARRAY_FALSE = {false};
private static final boolean[] ARRAY_TRUE = {true};
private static final boolean[] ARRAY_FALSE_FALSE = {false, false};
private static final boolean[] ARRAY_FALSE_TRUE = {false, true};
Reported by PMD.
Line: 46
private static final boolean[] VALUES = {false, true};
public void testHashCode() {
assertEquals(Boolean.TRUE.hashCode(), Booleans.hashCode(true));
assertEquals(Boolean.FALSE.hashCode(), Booleans.hashCode(false));
}
public void testTrueFirst() {
Reported by PMD.
Line: 46
private static final boolean[] VALUES = {false, true};
public void testHashCode() {
assertEquals(Boolean.TRUE.hashCode(), Booleans.hashCode(true));
assertEquals(Boolean.FALSE.hashCode(), Booleans.hashCode(false));
}
public void testTrueFirst() {
Reported by PMD.
Line: 47
private static final boolean[] VALUES = {false, true};
public void testHashCode() {
assertEquals(Boolean.TRUE.hashCode(), Booleans.hashCode(true));
assertEquals(Boolean.FALSE.hashCode(), Booleans.hashCode(false));
}
public void testTrueFirst() {
assertEquals(0, Booleans.trueFirst().compare(true, true));
Reported by PMD.
Line: 47
private static final boolean[] VALUES = {false, true};
public void testHashCode() {
assertEquals(Boolean.TRUE.hashCode(), Booleans.hashCode(true));
assertEquals(Boolean.FALSE.hashCode(), Booleans.hashCode(false));
}
public void testTrueFirst() {
assertEquals(0, Booleans.trueFirst().compare(true, true));
Reported by PMD.
Line: 48
public void testHashCode() {
assertEquals(Boolean.TRUE.hashCode(), Booleans.hashCode(true));
assertEquals(Boolean.FALSE.hashCode(), Booleans.hashCode(false));
}
public void testTrueFirst() {
assertEquals(0, Booleans.trueFirst().compare(true, true));
assertEquals(0, Booleans.trueFirst().compare(false, false));
Reported by PMD.
Line: 48
public void testHashCode() {
assertEquals(Boolean.TRUE.hashCode(), Booleans.hashCode(true));
assertEquals(Boolean.FALSE.hashCode(), Booleans.hashCode(false));
}
public void testTrueFirst() {
assertEquals(0, Booleans.trueFirst().compare(true, true));
assertEquals(0, Booleans.trueFirst().compare(false, false));
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ImmutableSortedMultisetTest.java
234 issues
Line: 15
* 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: 48
*
* @author Louis Wasserman
*/
public class ImmutableSortedMultisetTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableSortedMultisetTest.class);
suite.addTest(
Reported by PMD.
Line: 48
*
* @author Louis Wasserman
*/
public class ImmutableSortedMultisetTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableSortedMultisetTest.class);
suite.addTest(
Reported by PMD.
Line: 49
* @author Louis Wasserman
*/
public class ImmutableSortedMultisetTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableSortedMultisetTest.class);
suite.addTest(
SortedMultisetTestSuiteBuilder.using(
Reported by PMD.
Line: 63
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
})
.named("ImmutableSortedMultiset")
.withFeatures(
CollectionSize.ANY,
Reported by PMD.
Line: 78
new TestStringListGenerator() {
@Override
protected List<String> create(String[] elements) {
return ImmutableSortedMultiset.copyOf(elements).asList();
}
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
Reported by PMD.
Line: 83
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
})
.named("ImmutableSortedMultiset.asList")
.withFeatures(
CollectionSize.ANY,
Reported by PMD.
Line: 105
checkArgument(set.add(s));
builder.addCopies(s, 2);
}
return builder.build().elementSet().asList();
}
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
Reported by PMD.
Line: 105
checkArgument(set.add(s));
builder.addCopies(s, 2);
}
return builder.build().elementSet().asList();
}
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
Reported by PMD.
Line: 110
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
})
.named("ImmutableSortedMultiset.elementSet.asList")
.withFeatures(
CollectionSize.ANY,
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java
233 issues
Line: 31
* @author Gregory Kick
*/
@GwtCompatible(emulated = true)
public class ImmutableTableTest extends AbstractTableReadTest {
@Override
protected Table<String, Integer, Character> create(Object... data) {
ImmutableTable.Builder<String, Integer, Character> builder = ImmutableTable.builder();
for (int i = 0; i < data.length; i = i + 3) {
builder.put((String) data[i], (Integer) data[i + 1], (Character) data[i + 2]);
Reported by PMD.
Line: 42
}
// TODO(b/172823566): Use mainline testToImmutableMap once CollectorTester is usable to java7.
public void testToImmutableTable_java7_combine() {
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
Reported by PMD.
Line: 44
// TODO(b/172823566): Use mainline testToImmutableMap once CollectorTester is usable to java7.
public void testToImmutableTable_java7_combine() {
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
.put("two", "twei", 2);
ImmutableTable<String, String, Integer> table = zis.combine(zat).build();
Reported by PMD.
Line: 44
// TODO(b/172823566): Use mainline testToImmutableMap once CollectorTester is usable to java7.
public void testToImmutableTable_java7_combine() {
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
.put("two", "twei", 2);
ImmutableTable<String, String, Integer> table = zis.combine(zat).build();
Reported by PMD.
Line: 44
// TODO(b/172823566): Use mainline testToImmutableMap once CollectorTester is usable to java7.
public void testToImmutableTable_java7_combine() {
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
.put("two", "twei", 2);
ImmutableTable<String, String, Integer> table = zis.combine(zat).build();
Reported by PMD.
Line: 44
// TODO(b/172823566): Use mainline testToImmutableMap once CollectorTester is usable to java7.
public void testToImmutableTable_java7_combine() {
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
.put("two", "twei", 2);
ImmutableTable<String, String, Integer> table = zis.combine(zat).build();
Reported by PMD.
Line: 44
// TODO(b/172823566): Use mainline testToImmutableMap once CollectorTester is usable to java7.
public void testToImmutableTable_java7_combine() {
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
.put("two", "twei", 2);
ImmutableTable<String, String, Integer> table = zis.combine(zat).build();
Reported by PMD.
Line: 46
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
.put("two", "twei", 2);
ImmutableTable<String, String, Integer> table = zis.combine(zat).build();
ImmutableTable<String, String, Integer> expected =
ImmutableTable.<String, String, Integer>builder()
Reported by PMD.
Line: 46
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
.put("two", "twei", 2);
ImmutableTable<String, String, Integer> table = zis.combine(zat).build();
ImmutableTable<String, String, Integer> expected =
ImmutableTable.<String, String, Integer>builder()
Reported by PMD.
Line: 46
ImmutableTable.Builder<String, String, Integer> zis =
ImmutableTable.<String, String, Integer>builder().put("one", "uno", 1).put("two", "dos", 2);
ImmutableTable.Builder<String, String, Integer> zat =
ImmutableTable.<String, String, Integer>builder()
.put("one", "eins", 1)
.put("two", "twei", 2);
ImmutableTable<String, String, Integer> table = zis.combine(zat).build();
ImmutableTable<String, String, Integer> expected =
ImmutableTable.<String, String, Integer>builder()
Reported by PMD.
guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java
231 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 com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 60
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
Reported by PMD.
Line: 60
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
Reported by PMD.
Line: 60
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
Reported by PMD.
Line: 62
@GwtCompatible(emulated = true)
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
suite.addTest(
SortedSetMultimapTestSuiteBuilder.using(
Reported by PMD.
Line: 63
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
suite.addTest(
SortedSetMultimapTestSuiteBuilder.using(
new TestStringSetMultimapGenerator() {
Reported by PMD.
Line: 63
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
suite.addTest(
SortedSetMultimapTestSuiteBuilder.using(
new TestStringSetMultimapGenerator() {
Reported by PMD.
Line: 63
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
suite.addTest(
SortedSetMultimapTestSuiteBuilder.using(
new TestStringSetMultimapGenerator() {
Reported by PMD.
Line: 73
protected SetMultimap<String, String> create(Entry<String, String>[] entries) {
SetMultimap<String, String> multimap =
TreeMultimap.create(
Ordering.natural().nullsFirst(), Ordering.natural().nullsFirst());
for (Entry<String, String> entry : entries) {
multimap.put(entry.getKey(), entry.getValue());
}
return multimap;
}
Reported by PMD.
Line: 73
protected SetMultimap<String, String> create(Entry<String, String>[] entries) {
SetMultimap<String, String> multimap =
TreeMultimap.create(
Ordering.natural().nullsFirst(), Ordering.natural().nullsFirst());
for (Entry<String, String> entry : entries) {
multimap.put(entry.getKey(), entry.getValue());
}
return multimap;
}
Reported by PMD.
android/guava-tests/test/com/google/common/cache/PopulatedCachesTest.java
231 issues
Line: 47
* @author mike nonemacher
*/
public class PopulatedCachesTest extends TestCase {
// we use integers as keys; make sure the range covers some values that ARE cached by
// Integer.valueOf(int), and some that are not cached. (127 is the highest cached value.)
static final int WARMUP_MIN = 120;
static final int WARMUP_MAX = 135;
static final int WARMUP_SIZE = WARMUP_MAX - WARMUP_MIN;
Reported by PMD.
Line: 54
static final int WARMUP_MAX = 135;
static final int WARMUP_SIZE = WARMUP_MAX - WARMUP_MIN;
public void testSize_populated() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
assertEquals(WARMUP_SIZE, cache.size());
assertMapSize(cache.asMap(), WARMUP_SIZE);
Reported by PMD.
Line: 54
static final int WARMUP_MAX = 135;
static final int WARMUP_SIZE = WARMUP_MAX - WARMUP_MIN;
public void testSize_populated() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
assertEquals(WARMUP_SIZE, cache.size());
assertMapSize(cache.asMap(), WARMUP_SIZE);
Reported by PMD.
Line: 57
public void testSize_populated() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
assertEquals(WARMUP_SIZE, cache.size());
assertMapSize(cache.asMap(), WARMUP_SIZE);
checkValidState(cache);
}
}
Reported by PMD.
Line: 58
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
assertEquals(WARMUP_SIZE, cache.size());
assertMapSize(cache.asMap(), WARMUP_SIZE);
checkValidState(cache);
}
}
Reported by PMD.
Line: 64
}
}
public void testContainsKey_found() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
Reported by PMD.
Line: 64
}
}
public void testContainsKey_found() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
Reported by PMD.
Line: 69
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
assertTrue(cache.asMap().containsKey(entry.getKey()));
assertTrue(cache.asMap().containsValue(entry.getValue()));
// this getUnchecked() call shouldn't be a cache miss; verified below
assertEquals(entry.getValue(), cache.getUnchecked(entry.getKey()));
}
Reported by PMD.
Line: 70
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
assertTrue(cache.asMap().containsKey(entry.getKey()));
assertTrue(cache.asMap().containsValue(entry.getValue()));
// this getUnchecked() call shouldn't be a cache miss; verified below
assertEquals(entry.getValue(), cache.getUnchecked(entry.getKey()));
}
assertEquals(WARMUP_SIZE, cache.stats().missCount());
Reported by PMD.
Line: 70
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
assertTrue(cache.asMap().containsKey(entry.getKey()));
assertTrue(cache.asMap().containsValue(entry.getValue()));
// this getUnchecked() call shouldn't be a cache miss; verified below
assertEquals(entry.getValue(), cache.getUnchecked(entry.getKey()));
}
assertEquals(WARMUP_SIZE, cache.stats().missCount());
Reported by PMD.
android/guava-tests/test/com/google/common/primitives/ImmutableIntArrayTest.java
231 issues
Line: 45
/** @author Kevin Bourrillion */
@GwtCompatible(emulated = true)
public class ImmutableIntArrayTest extends TestCase {
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableIntArray.of().asList()).isEmpty();
}
Reported by PMD.
Line: 48
public class ImmutableIntArrayTest extends TestCase {
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableIntArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableIntArray.of(0).asList()).containsExactly(0);
Reported by PMD.
Line: 49
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableIntArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableIntArray.of(0).asList()).containsExactly(0);
}
Reported by PMD.
Line: 49
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableIntArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableIntArray.of(0).asList()).containsExactly(0);
}
Reported by PMD.
Line: 52
assertThat(ImmutableIntArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableIntArray.of(0).asList()).containsExactly(0);
}
public void testOf2() {
assertThat(ImmutableIntArray.of(0, 1).asList()).containsExactly(0, 1).inOrder();
Reported by PMD.
Line: 53
}
public void testOf1() {
assertThat(ImmutableIntArray.of(0).asList()).containsExactly(0);
}
public void testOf2() {
assertThat(ImmutableIntArray.of(0, 1).asList()).containsExactly(0, 1).inOrder();
}
Reported by PMD.
Line: 53
}
public void testOf1() {
assertThat(ImmutableIntArray.of(0).asList()).containsExactly(0);
}
public void testOf2() {
assertThat(ImmutableIntArray.of(0, 1).asList()).containsExactly(0, 1).inOrder();
}
Reported by PMD.
Line: 56
assertThat(ImmutableIntArray.of(0).asList()).containsExactly(0);
}
public void testOf2() {
assertThat(ImmutableIntArray.of(0, 1).asList()).containsExactly(0, 1).inOrder();
}
public void testOf3() {
assertThat(ImmutableIntArray.of(0, 1, 3).asList()).containsExactly(0, 1, 3).inOrder();
Reported by PMD.
Line: 57
}
public void testOf2() {
assertThat(ImmutableIntArray.of(0, 1).asList()).containsExactly(0, 1).inOrder();
}
public void testOf3() {
assertThat(ImmutableIntArray.of(0, 1, 3).asList()).containsExactly(0, 1, 3).inOrder();
}
Reported by PMD.
Line: 57
}
public void testOf2() {
assertThat(ImmutableIntArray.of(0, 1).asList()).containsExactly(0, 1).inOrder();
}
public void testOf3() {
assertThat(ImmutableIntArray.of(0, 1, 3).asList()).containsExactly(0, 1, 3).inOrder();
}
Reported by PMD.
guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java
231 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: 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: 59
* @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: 59
* @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: 59
* @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: 59
* @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: 61
@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.addTestSuite(FloodingTest.class);
Reported by PMD.
Line: 62
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.addTestSuite(FloodingTest.class);
suite.addTest(
Reported by PMD.
Line: 62
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.addTestSuite(FloodingTest.class);
suite.addTest(
Reported by PMD.
Line: 62
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.addTestSuite(FloodingTest.class);
suite.addTest(
Reported by PMD.
guava-tests/test/com/google/common/cache/PopulatedCachesTest.java
231 issues
Line: 47
* @author mike nonemacher
*/
public class PopulatedCachesTest extends TestCase {
// we use integers as keys; make sure the range covers some values that ARE cached by
// Integer.valueOf(int), and some that are not cached. (127 is the highest cached value.)
static final int WARMUP_MIN = 120;
static final int WARMUP_MAX = 135;
static final int WARMUP_SIZE = WARMUP_MAX - WARMUP_MIN;
Reported by PMD.
Line: 54
static final int WARMUP_MAX = 135;
static final int WARMUP_SIZE = WARMUP_MAX - WARMUP_MIN;
public void testSize_populated() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
assertEquals(WARMUP_SIZE, cache.size());
assertMapSize(cache.asMap(), WARMUP_SIZE);
Reported by PMD.
Line: 54
static final int WARMUP_MAX = 135;
static final int WARMUP_SIZE = WARMUP_MAX - WARMUP_MIN;
public void testSize_populated() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
assertEquals(WARMUP_SIZE, cache.size());
assertMapSize(cache.asMap(), WARMUP_SIZE);
Reported by PMD.
Line: 57
public void testSize_populated() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
assertEquals(WARMUP_SIZE, cache.size());
assertMapSize(cache.asMap(), WARMUP_SIZE);
checkValidState(cache);
}
}
Reported by PMD.
Line: 58
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
assertEquals(WARMUP_SIZE, cache.size());
assertMapSize(cache.asMap(), WARMUP_SIZE);
checkValidState(cache);
}
}
Reported by PMD.
Line: 64
}
}
public void testContainsKey_found() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
Reported by PMD.
Line: 64
}
}
public void testContainsKey_found() {
for (LoadingCache<Object, Object> cache : caches()) {
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
Reported by PMD.
Line: 69
// don't let the entries get GCed
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
assertTrue(cache.asMap().containsKey(entry.getKey()));
assertTrue(cache.asMap().containsValue(entry.getValue()));
// this getUnchecked() call shouldn't be a cache miss; verified below
assertEquals(entry.getValue(), cache.getUnchecked(entry.getKey()));
}
Reported by PMD.
Line: 70
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
assertTrue(cache.asMap().containsKey(entry.getKey()));
assertTrue(cache.asMap().containsValue(entry.getValue()));
// this getUnchecked() call shouldn't be a cache miss; verified below
assertEquals(entry.getValue(), cache.getUnchecked(entry.getKey()));
}
assertEquals(WARMUP_SIZE, cache.stats().missCount());
Reported by PMD.
Line: 70
List<Entry<Object, Object>> warmed = warmUp(cache);
for (int i = WARMUP_MIN; i < WARMUP_MAX; i++) {
Entry<Object, Object> entry = warmed.get(i - WARMUP_MIN);
assertTrue(cache.asMap().containsKey(entry.getKey()));
assertTrue(cache.asMap().containsValue(entry.getValue()));
// this getUnchecked() call shouldn't be a cache miss; verified below
assertEquals(entry.getValue(), cache.getUnchecked(entry.getKey()));
}
assertEquals(WARMUP_SIZE, cache.stats().missCount());
Reported by PMD.
android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java
231 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 com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 60
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
Reported by PMD.
Line: 60
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
Reported by PMD.
Line: 60
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
Reported by PMD.
Line: 62
@GwtCompatible(emulated = true)
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
suite.addTest(
SortedSetMultimapTestSuiteBuilder.using(
Reported by PMD.
Line: 63
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
suite.addTest(
SortedSetMultimapTestSuiteBuilder.using(
new TestStringSetMultimapGenerator() {
Reported by PMD.
Line: 63
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
suite.addTest(
SortedSetMultimapTestSuiteBuilder.using(
new TestStringSetMultimapGenerator() {
Reported by PMD.
Line: 63
public class TreeMultimapNaturalTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
// TODO(lowasser): should we force TreeMultimap to be more thorough about checking nulls?
suite.addTest(
SortedSetMultimapTestSuiteBuilder.using(
new TestStringSetMultimapGenerator() {
Reported by PMD.
Line: 73
protected SetMultimap<String, String> create(Entry<String, String>[] entries) {
SetMultimap<String, String> multimap =
TreeMultimap.create(
Ordering.natural().nullsFirst(), Ordering.natural().nullsFirst());
for (Entry<String, String> entry : entries) {
multimap.put(entry.getKey(), entry.getValue());
}
return multimap;
}
Reported by PMD.
Line: 73
protected SetMultimap<String, String> create(Entry<String, String>[] entries) {
SetMultimap<String, String> multimap =
TreeMultimap.create(
Ordering.natural().nullsFirst(), Ordering.natural().nullsFirst());
for (Entry<String, String> entry : entries) {
multimap.put(entry.getKey(), entry.getValue());
}
return multimap;
}
Reported by PMD.
android/guava-tests/test/com/google/common/cache/CacheBuilderSpecTest.java
230 issues
Line: 34
*
* @author Adam Winer
*/
public class CacheBuilderSpecTest extends TestCase {
public void testParse_empty() {
CacheBuilderSpec spec = parse("");
assertNull(spec.initialCapacity);
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
Reported by PMD.
Line: 34
*
* @author Adam Winer
*/
public class CacheBuilderSpecTest extends TestCase {
public void testParse_empty() {
CacheBuilderSpec spec = parse("");
assertNull(spec.initialCapacity);
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
Reported by PMD.
Line: 35
* @author Adam Winer
*/
public class CacheBuilderSpecTest extends TestCase {
public void testParse_empty() {
CacheBuilderSpec spec = parse("");
assertNull(spec.initialCapacity);
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
assertNull(spec.concurrencyLevel);
Reported by PMD.
Line: 35
* @author Adam Winer
*/
public class CacheBuilderSpecTest extends TestCase {
public void testParse_empty() {
CacheBuilderSpec spec = parse("");
assertNull(spec.initialCapacity);
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
assertNull(spec.concurrencyLevel);
Reported by PMD.
Line: 37
public class CacheBuilderSpecTest extends TestCase {
public void testParse_empty() {
CacheBuilderSpec spec = parse("");
assertNull(spec.initialCapacity);
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
assertNull(spec.concurrencyLevel);
assertNull(spec.keyStrength);
assertNull(spec.valueStrength);
Reported by PMD.
Line: 38
public void testParse_empty() {
CacheBuilderSpec spec = parse("");
assertNull(spec.initialCapacity);
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
assertNull(spec.concurrencyLevel);
assertNull(spec.keyStrength);
assertNull(spec.valueStrength);
assertNull(spec.writeExpirationTimeUnit);
Reported by PMD.
Line: 39
CacheBuilderSpec spec = parse("");
assertNull(spec.initialCapacity);
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
assertNull(spec.concurrencyLevel);
assertNull(spec.keyStrength);
assertNull(spec.valueStrength);
assertNull(spec.writeExpirationTimeUnit);
assertNull(spec.accessExpirationTimeUnit);
Reported by PMD.
Line: 40
assertNull(spec.initialCapacity);
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
assertNull(spec.concurrencyLevel);
assertNull(spec.keyStrength);
assertNull(spec.valueStrength);
assertNull(spec.writeExpirationTimeUnit);
assertNull(spec.accessExpirationTimeUnit);
assertCacheBuilderEquivalence(CacheBuilder.newBuilder(), CacheBuilder.from(spec));
Reported by PMD.
Line: 41
assertNull(spec.maximumSize);
assertNull(spec.maximumWeight);
assertNull(spec.concurrencyLevel);
assertNull(spec.keyStrength);
assertNull(spec.valueStrength);
assertNull(spec.writeExpirationTimeUnit);
assertNull(spec.accessExpirationTimeUnit);
assertCacheBuilderEquivalence(CacheBuilder.newBuilder(), CacheBuilder.from(spec));
}
Reported by PMD.
Line: 42
assertNull(spec.maximumWeight);
assertNull(spec.concurrencyLevel);
assertNull(spec.keyStrength);
assertNull(spec.valueStrength);
assertNull(spec.writeExpirationTimeUnit);
assertNull(spec.accessExpirationTimeUnit);
assertCacheBuilderEquivalence(CacheBuilder.newBuilder(), CacheBuilder.from(spec));
}
Reported by PMD.