The following issues were found
guava-tests/test/com/google/common/collect/MultisetsTest.java
132 issues
Line: 40
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class MultisetsTest extends TestCase {
/* See MultisetsImmutableEntryTest for immutableEntry() tests. */
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
Reported by PMD.
Line: 44
/* See MultisetsImmutableEntryTest for immutableEntry() tests. */
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
Reported by PMD.
Line: 44
/* See MultisetsImmutableEntryTest for immutableEntry() tests. */
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
Reported by PMD.
Line: 46
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
.containsExactly(
new DerivedComparable("bar"),
Reported by PMD.
Line: 46
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
.containsExactly(
new DerivedComparable("bar"),
Reported by PMD.
Line: 47
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
.containsExactly(
new DerivedComparable("bar"),
new DerivedComparable("bar"),
Reported by PMD.
Line: 48
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
.containsExactly(
new DerivedComparable("bar"),
new DerivedComparable("bar"),
new DerivedComparable("bar"),
Reported by PMD.
Line: 59
.inOrder();
}
public void testNewTreeMultisetNonGeneric() {
TreeMultiset<LegacyComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new LegacyComparable("foo"), 2);
set.add(new LegacyComparable("bar"), 3);
assertThat(set)
Reported by PMD.
Line: 59
.inOrder();
}
public void testNewTreeMultisetNonGeneric() {
TreeMultiset<LegacyComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new LegacyComparable("foo"), 2);
set.add(new LegacyComparable("bar"), 3);
assertThat(set)
Reported by PMD.
Line: 61
public void testNewTreeMultisetNonGeneric() {
TreeMultiset<LegacyComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new LegacyComparable("foo"), 2);
set.add(new LegacyComparable("bar"), 3);
assertThat(set)
.containsExactly(
new LegacyComparable("bar"),
Reported by PMD.
android/guava-tests/test/com/google/common/net/HostAndPortTest.java
130 issues
Line: 30
* @author Paul Marks
*/
@GwtCompatible
public class HostAndPortTest extends TestCase {
public void testFromStringWellFormed() {
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
Reported by PMD.
Line: 32
@GwtCompatible
public class HostAndPortTest extends TestCase {
public void testFromStringWellFormed() {
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
Reported by PMD.
Line: 32
@GwtCompatible
public class HostAndPortTest extends TestCase {
public void testFromStringWellFormed() {
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
Reported by PMD.
Line: 34
public void testFromStringWellFormed() {
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
Reported by PMD.
Line: 36
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
Reported by PMD.
Line: 36
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
Reported by PMD.
Line: 36
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
Reported by PMD.
Line: 37
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
public void testFromStringBadDefaultPort() {
Reported by PMD.
Line: 38
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
public void testFromStringBadDefaultPort() {
// Well-formed strings with bad default ports.
Reported by PMD.
Line: 38
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
public void testFromStringBadDefaultPort() {
// Well-formed strings with bad default ports.
Reported by PMD.
guava-tests/test/com/google/common/net/HostAndPortTest.java
130 issues
Line: 30
* @author Paul Marks
*/
@GwtCompatible
public class HostAndPortTest extends TestCase {
public void testFromStringWellFormed() {
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
Reported by PMD.
Line: 32
@GwtCompatible
public class HostAndPortTest extends TestCase {
public void testFromStringWellFormed() {
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
Reported by PMD.
Line: 32
@GwtCompatible
public class HostAndPortTest extends TestCase {
public void testFromStringWellFormed() {
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
Reported by PMD.
Line: 34
public void testFromStringWellFormed() {
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
Reported by PMD.
Line: 36
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
Reported by PMD.
Line: 36
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
Reported by PMD.
Line: 36
// Well-formed inputs.
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
Reported by PMD.
Line: 37
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
public void testFromStringBadDefaultPort() {
Reported by PMD.
Line: 38
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
public void testFromStringBadDefaultPort() {
// Well-formed strings with bad default ports.
Reported by PMD.
Line: 38
checkFromStringCase("google.com", 80, "google.com", 80, false);
checkFromStringCase("192.0.2.1", 82, "192.0.2.1", 82, false);
checkFromStringCase("[2001::1]", 84, "2001::1", 84, false);
checkFromStringCase("2001::3", 86, "2001::3", 86, false);
checkFromStringCase("host:", 80, "host", 80, false);
}
public void testFromStringBadDefaultPort() {
// Well-formed strings with bad default ports.
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java
129 issues
Line: 15
* the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.util.concurrent.ClassPathUtil.parseJavaClassPath;
import static com.google.common.util.concurrent.Futures.getChecked;
import static com.google.common.util.concurrent.Futures.immediateFuture;
Reported by PMD.
Line: 53
import junit.framework.TestCase;
/** Unit tests for {@link Futures#getChecked(Future, Class)}. */
public class FuturesGetCheckedTest extends TestCase {
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
Reported by PMD.
Line: 53
import junit.framework.TestCase;
/** Unit tests for {@link Futures#getChecked(Future, Class)}. */
public class FuturesGetCheckedTest extends TestCase {
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
Reported by PMD.
Line: 56
public class FuturesGetCheckedTest extends TestCase {
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Reported by PMD.
Line: 57
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
Reported by PMD.
Line: 57
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
Reported by PMD.
Line: 60
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
try {
getChecked(future, TwoArgConstructorException.class);
fail();
Reported by PMD.
Line: 60
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
try {
getChecked(future, TwoArgConstructorException.class);
fail();
Reported by PMD.
Line: 62
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
try {
getChecked(future, TwoArgConstructorException.class);
fail();
} catch (TwoArgConstructorException expected) {
assertThat(expected).hasCauseThat().isInstanceOf(InterruptedException.class);
Reported by PMD.
Line: 65
Thread.currentThread().interrupt();
try {
getChecked(future, TwoArgConstructorException.class);
fail();
} catch (TwoArgConstructorException expected) {
assertThat(expected).hasCauseThat().isInstanceOf(InterruptedException.class);
assertTrue(Thread.currentThread().isInterrupted());
} finally {
Thread.interrupted();
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java
129 issues
Line: 15
* the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.util.concurrent.ClassPathUtil.parseJavaClassPath;
import static com.google.common.util.concurrent.Futures.getChecked;
import static com.google.common.util.concurrent.Futures.immediateFuture;
Reported by PMD.
Line: 53
import junit.framework.TestCase;
/** Unit tests for {@link Futures#getChecked(Future, Class)}. */
public class FuturesGetCheckedTest extends TestCase {
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
Reported by PMD.
Line: 53
import junit.framework.TestCase;
/** Unit tests for {@link Futures#getChecked(Future, Class)}. */
public class FuturesGetCheckedTest extends TestCase {
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
Reported by PMD.
Line: 56
public class FuturesGetCheckedTest extends TestCase {
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Reported by PMD.
Line: 57
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
Reported by PMD.
Line: 57
// Boring untimed-get tests:
public void testGetCheckedUntimed_success() throws TwoArgConstructorException {
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
Reported by PMD.
Line: 60
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
try {
getChecked(future, TwoArgConstructorException.class);
fail();
Reported by PMD.
Line: 60
assertEquals("foo", getChecked(immediateFuture("foo"), TwoArgConstructorException.class));
}
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
try {
getChecked(future, TwoArgConstructorException.class);
fail();
Reported by PMD.
Line: 62
public void testGetCheckedUntimed_interrupted() {
SettableFuture<String> future = SettableFuture.create();
Thread.currentThread().interrupt();
try {
getChecked(future, TwoArgConstructorException.class);
fail();
} catch (TwoArgConstructorException expected) {
assertThat(expected).hasCauseThat().isInstanceOf(InterruptedException.class);
Reported by PMD.
Line: 65
Thread.currentThread().interrupt();
try {
getChecked(future, TwoArgConstructorException.class);
fail();
} catch (TwoArgConstructorException expected) {
assertThat(expected).hasCauseThat().isInstanceOf(InterruptedException.class);
assertTrue(Thread.currentThread().isInterrupted());
} finally {
Thread.interrupted();
Reported by PMD.
guava-tests/test/com/google/common/collect/FilteredCollectionsTest.java
128 issues
Line: 74
abstract C filter(C elements, Predicate<? super Integer> predicate);
public void testIterationOrderPreserved() {
for (List<Integer> contents : SAMPLE_INPUTS) {
C unfiltered = createUnfiltered(contents);
C filtered = filter(unfiltered, EVEN);
Iterator<Integer> filteredItr = filtered.iterator();
Reported by PMD.
Line: 74
abstract C filter(C elements, Predicate<? super Integer> predicate);
public void testIterationOrderPreserved() {
for (List<Integer> contents : SAMPLE_INPUTS) {
C unfiltered = createUnfiltered(contents);
C filtered = filter(unfiltered, EVEN);
Iterator<Integer> filteredItr = filtered.iterator();
Reported by PMD.
Line: 79
C unfiltered = createUnfiltered(contents);
C filtered = filter(unfiltered, EVEN);
Iterator<Integer> filteredItr = filtered.iterator();
for (Integer i : unfiltered) {
if (EVEN.apply(i)) {
assertTrue(filteredItr.hasNext());
assertEquals(i, filteredItr.next());
}
Reported by PMD.
Line: 82
Iterator<Integer> filteredItr = filtered.iterator();
for (Integer i : unfiltered) {
if (EVEN.apply(i)) {
assertTrue(filteredItr.hasNext());
assertEquals(i, filteredItr.next());
}
}
assertFalse(filteredItr.hasNext());
}
Reported by PMD.
Line: 83
for (Integer i : unfiltered) {
if (EVEN.apply(i)) {
assertTrue(filteredItr.hasNext());
assertEquals(i, filteredItr.next());
}
}
assertFalse(filteredItr.hasNext());
}
}
Reported by PMD.
Line: 86
assertEquals(i, filteredItr.next());
}
}
assertFalse(filteredItr.hasNext());
}
}
public void testForEach() {
for (List<Integer> contents : SAMPLE_INPUTS) {
Reported by PMD.
Line: 90
}
}
public void testForEach() {
for (List<Integer> contents : SAMPLE_INPUTS) {
C unfiltered = createUnfiltered(contents);
C filtered = filter(unfiltered, EVEN);
List<Integer> foundElements = new ArrayList<>();
filtered.forEach(
Reported by PMD.
Line: 90
}
}
public void testForEach() {
for (List<Integer> contents : SAMPLE_INPUTS) {
C unfiltered = createUnfiltered(contents);
C filtered = filter(unfiltered, EVEN);
List<Integer> foundElements = new ArrayList<>();
filtered.forEach(
Reported by PMD.
Line: 94
for (List<Integer> contents : SAMPLE_INPUTS) {
C unfiltered = createUnfiltered(contents);
C filtered = filter(unfiltered, EVEN);
List<Integer> foundElements = new ArrayList<>();
filtered.forEach(
(Integer i) -> {
assertTrue("Unexpected element: " + i, EVEN.apply(i));
foundElements.add(i);
});
Reported by PMD.
Line: 95
C unfiltered = createUnfiltered(contents);
C filtered = filter(unfiltered, EVEN);
List<Integer> foundElements = new ArrayList<>();
filtered.forEach(
(Integer i) -> {
assertTrue("Unexpected element: " + i, EVEN.apply(i));
foundElements.add(i);
});
assertEquals(ImmutableList.copyOf(filtered), foundElements);
Reported by PMD.
android/guava-tests/test/com/google/common/collect/MultisetsTest.java
128 issues
Line: 38
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class MultisetsTest extends TestCase {
/* See MultisetsImmutableEntryTest for immutableEntry() tests. */
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
Reported by PMD.
Line: 42
/* See MultisetsImmutableEntryTest for immutableEntry() tests. */
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
Reported by PMD.
Line: 42
/* See MultisetsImmutableEntryTest for immutableEntry() tests. */
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
Reported by PMD.
Line: 44
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
.containsExactly(
new DerivedComparable("bar"),
Reported by PMD.
Line: 44
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
.containsExactly(
new DerivedComparable("bar"),
Reported by PMD.
Line: 45
public void testNewTreeMultisetDerived() {
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
.containsExactly(
new DerivedComparable("bar"),
new DerivedComparable("bar"),
Reported by PMD.
Line: 46
TreeMultiset<DerivedComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new DerivedComparable("foo"), 2);
set.add(new DerivedComparable("bar"), 3);
assertThat(set)
.containsExactly(
new DerivedComparable("bar"),
new DerivedComparable("bar"),
new DerivedComparable("bar"),
Reported by PMD.
Line: 57
.inOrder();
}
public void testNewTreeMultisetNonGeneric() {
TreeMultiset<LegacyComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new LegacyComparable("foo"), 2);
set.add(new LegacyComparable("bar"), 3);
assertThat(set)
Reported by PMD.
Line: 57
.inOrder();
}
public void testNewTreeMultisetNonGeneric() {
TreeMultiset<LegacyComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new LegacyComparable("foo"), 2);
set.add(new LegacyComparable("bar"), 3);
assertThat(set)
Reported by PMD.
Line: 59
public void testNewTreeMultisetNonGeneric() {
TreeMultiset<LegacyComparable> set = TreeMultiset.create();
assertTrue(set.isEmpty());
set.add(new LegacyComparable("foo"), 2);
set.add(new LegacyComparable("bar"), 3);
assertThat(set)
.containsExactly(
new LegacyComparable("bar"),
Reported by PMD.
android/guava-tests/test/com/google/common/cache/CacheExpirationTest.java
125 issues
Line: 43
* @author mike nonemacher
*/
@SuppressWarnings("deprecation") // tests of deprecated method
public class CacheExpirationTest extends TestCase {
private static final long EXPIRING_TIME = 1000;
private static final int VALUE_PREFIX = 12345;
private static final String KEY_PREFIX = "key prefix:";
Reported by PMD.
Line: 49
private static final int VALUE_PREFIX = 12345;
private static final String KEY_PREFIX = "key prefix:";
public void testExpiration_expireAfterWrite() {
FakeTicker ticker = new FakeTicker();
CountingRemovalListener<String, Integer> removalListener = countingRemovalListener();
WatchedCreatorLoader loader = new WatchedCreatorLoader();
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder()
Reported by PMD.
Line: 49
private static final int VALUE_PREFIX = 12345;
private static final String KEY_PREFIX = "key prefix:";
public void testExpiration_expireAfterWrite() {
FakeTicker ticker = new FakeTicker();
CountingRemovalListener<String, Integer> removalListener = countingRemovalListener();
WatchedCreatorLoader loader = new WatchedCreatorLoader();
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder()
Reported by PMD.
Line: 62
checkExpiration(cache, loader, ticker, removalListener);
}
public void testExpiration_expireAfterAccess() {
FakeTicker ticker = new FakeTicker();
CountingRemovalListener<String, Integer> removalListener = countingRemovalListener();
WatchedCreatorLoader loader = new WatchedCreatorLoader();
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder()
Reported by PMD.
Line: 62
checkExpiration(cache, loader, ticker, removalListener);
}
public void testExpiration_expireAfterAccess() {
FakeTicker ticker = new FakeTicker();
CountingRemovalListener<String, Integer> removalListener = countingRemovalListener();
WatchedCreatorLoader loader = new WatchedCreatorLoader();
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder()
Reported by PMD.
Line: 82
CountingRemovalListener<String, Integer> removalListener) {
for (int i = 0; i < 10; i++) {
assertEquals(Integer.valueOf(VALUE_PREFIX + i), cache.getUnchecked(KEY_PREFIX + i));
}
for (int i = 0; i < 10; i++) {
loader.reset();
assertEquals(Integer.valueOf(VALUE_PREFIX + i), cache.getUnchecked(KEY_PREFIX + i));
Reported by PMD.
Line: 87
for (int i = 0; i < 10; i++) {
loader.reset();
assertEquals(Integer.valueOf(VALUE_PREFIX + i), cache.getUnchecked(KEY_PREFIX + i));
assertFalse("Creator should not have been called @#" + i, loader.wasCalled());
}
CacheTesting.expireEntries((LoadingCache<?, ?>) cache, EXPIRING_TIME, ticker);
Reported by PMD.
Line: 94
CacheTesting.expireEntries((LoadingCache<?, ?>) cache, EXPIRING_TIME, ticker);
assertEquals("Map must be empty by now", 0, cache.size());
assertEquals("Eviction notifications must be received", 10, removalListener.getCount());
CacheTesting.expireEntries((LoadingCache<?, ?>) cache, EXPIRING_TIME, ticker);
// ensure that no new notifications are sent
assertEquals("Eviction notifications must be received", 10, removalListener.getCount());
}
Reported by PMD.
Line: 101
assertEquals("Eviction notifications must be received", 10, removalListener.getCount());
}
public void testExpiringGet_expireAfterWrite() {
FakeTicker ticker = new FakeTicker();
CountingRemovalListener<String, Integer> removalListener = countingRemovalListener();
WatchedCreatorLoader loader = new WatchedCreatorLoader();
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder()
Reported by PMD.
Line: 101
assertEquals("Eviction notifications must be received", 10, removalListener.getCount());
}
public void testExpiringGet_expireAfterWrite() {
FakeTicker ticker = new FakeTicker();
CountingRemovalListener<String, Integer> removalListener = countingRemovalListener();
WatchedCreatorLoader loader = new WatchedCreatorLoader();
LoadingCache<String, Integer> cache =
CacheBuilder.newBuilder()
Reported by PMD.
guava/src/com/google/common/collect/StandardTable.java
125 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.alwaysTrue;
import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Predicates.in;
Reported by PMD.
Line: 70
*/
@GwtCompatible
@ElementTypesAreNonnullByDefault
class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
@GwtTransient final Map<R, Map<C, V>> backingMap;
@GwtTransient final Supplier<? extends Map<C, V>> factory;
StandardTable(Map<R, Map<C, V>> backingMap, Supplier<? extends Map<C, V>> factory) {
this.backingMap = backingMap;
Reported by PMD.
Line: 71
@GwtCompatible
@ElementTypesAreNonnullByDefault
class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
@GwtTransient final Map<R, Map<C, V>> backingMap;
@GwtTransient final Supplier<? extends Map<C, V>> factory;
StandardTable(Map<R, Map<C, V>> backingMap, Supplier<? extends Map<C, V>> factory) {
this.backingMap = backingMap;
this.factory = factory;
Reported by PMD.
Line: 72
@ElementTypesAreNonnullByDefault
class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable {
@GwtTransient final Map<R, Map<C, V>> backingMap;
@GwtTransient final Supplier<? extends Map<C, V>> factory;
StandardTable(Map<R, Map<C, V>> backingMap, Supplier<? extends Map<C, V>> factory) {
this.backingMap = backingMap;
this.factory = factory;
}
Reported by PMD.
Line: 152
checkNotNull(rowKey);
checkNotNull(columnKey);
checkNotNull(value);
return getOrCreate(rowKey).put(columnKey, value);
}
@CanIgnoreReturnValue
@Override
@CheckForNull
Reported by PMD.
Line: 166
if (map == null) {
return null;
}
V value = map.remove(columnKey);
if (map.isEmpty()) {
backingMap.remove(rowKey);
}
return value;
}
Reported by PMD.
Line: 167
return null;
}
V value = map.remove(columnKey);
if (map.isEmpty()) {
backingMap.remove(rowKey);
}
return value;
}
Reported by PMD.
Line: 176
@CanIgnoreReturnValue
private Map<R, V> removeColumn(@CheckForNull Object column) {
Map<R, V> output = new LinkedHashMap<>();
Iterator<Entry<R, Map<C, V>>> iterator = backingMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<R, Map<C, V>> entry = iterator.next();
V value = entry.getValue().remove(column);
if (value != null) {
output.put(entry.getKey(), value);
Reported by PMD.
Line: 179
Iterator<Entry<R, Map<C, V>>> iterator = backingMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<R, Map<C, V>> entry = iterator.next();
V value = entry.getValue().remove(column);
if (value != null) {
output.put(entry.getKey(), value);
if (entry.getValue().isEmpty()) {
iterator.remove();
}
Reported by PMD.
Line: 179
Iterator<Entry<R, Map<C, V>>> iterator = backingMap.entrySet().iterator();
while (iterator.hasNext()) {
Entry<R, Map<C, V>> entry = iterator.next();
V value = entry.getValue().remove(column);
if (value != null) {
output.put(entry.getKey(), value);
if (entry.getValue().isEmpty()) {
iterator.remove();
}
Reported by PMD.
android/guava-tests/test/com/google/common/math/MathPreconditionsTest.java
125 issues
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.annotations.GwtCompatible;
import java.math.BigInteger;
Reported by PMD.
Line: 32
* @author Ben Yu
*/
@GwtCompatible
public class MathPreconditionsTest extends TestCase {
public void testCheckPositive_zeroInt() {
try {
MathPreconditions.checkPositive("int", 0);
fail();
Reported by PMD.
Line: 32
* @author Ben Yu
*/
@GwtCompatible
public class MathPreconditionsTest extends TestCase {
public void testCheckPositive_zeroInt() {
try {
MathPreconditions.checkPositive("int", 0);
fail();
Reported by PMD.
Line: 34
@GwtCompatible
public class MathPreconditionsTest extends TestCase {
public void testCheckPositive_zeroInt() {
try {
MathPreconditions.checkPositive("int", 0);
fail();
} catch (IllegalArgumentException expected) {
}
Reported by PMD.
Line: 36
public void testCheckPositive_zeroInt() {
try {
MathPreconditions.checkPositive("int", 0);
fail();
} catch (IllegalArgumentException expected) {
}
}
Reported by PMD.
Line: 37
public void testCheckPositive_zeroInt() {
try {
MathPreconditions.checkPositive("int", 0);
fail();
} catch (IllegalArgumentException expected) {
}
}
public void testCheckPositive_maxInt() {
Reported by PMD.
Line: 37
public void testCheckPositive_zeroInt() {
try {
MathPreconditions.checkPositive("int", 0);
fail();
} catch (IllegalArgumentException expected) {
}
}
public void testCheckPositive_maxInt() {
Reported by PMD.
Line: 42
}
}
public void testCheckPositive_maxInt() {
MathPreconditions.checkPositive("int", Integer.MAX_VALUE);
}
public void testCheckPositive_minInt() {
try {
Reported by PMD.
Line: 42
}
}
public void testCheckPositive_maxInt() {
MathPreconditions.checkPositive("int", Integer.MAX_VALUE);
}
public void testCheckPositive_minInt() {
try {
Reported by PMD.
Line: 46
MathPreconditions.checkPositive("int", Integer.MAX_VALUE);
}
public void testCheckPositive_minInt() {
try {
MathPreconditions.checkPositive("int", Integer.MIN_VALUE);
fail();
} catch (IllegalArgumentException expected) {
}
Reported by PMD.