The following issues were found
guava-testlib/src/com/google/common/collect/testing/google/MultisetEntrySetTester.java
111 issues
Line: 44
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
Reported by PMD.
Line: 46
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
Reported by PMD.
Line: 48
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
Reported by PMD.
Line: 48
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
Reported by PMD.
Line: 49
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Reported by PMD.
Line: 52
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
Reported by PMD.
Line: 54
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
assertEquals(
"multiset.entrySet() iterator.next() returned incorrect entry",
Reported by PMD.
Line: 55
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
assertEquals(
"multiset.entrySet() iterator.next() returned incorrect entry",
Multisets.immutableEntry(e0(), 1),
Reported by PMD.
Line: 55
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
assertEquals(
"multiset.entrySet() iterator.next() returned incorrect entry",
Multisets.immutableEntry(e0(), 1),
Reported by PMD.
Line: 68
iterator.remove();
assertTrue(
"multiset isn't empty after multiset.entrySet() iterator.remove()",
getMultiset().isEmpty());
}
@CollectionSize.Require(absent = ZERO)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_removePresent() {
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultisetEntrySetTester.java
111 issues
Line: 44
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
Reported by PMD.
Line: 46
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
Reported by PMD.
Line: 48
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
Reported by PMD.
Line: 48
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
Reported by PMD.
Line: 49
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_clear() {
getMultiset().entrySet().clear();
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Reported by PMD.
Line: 52
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
}
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
Reported by PMD.
Line: 54
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
assertEquals(
"multiset.entrySet() iterator.next() returned incorrect entry",
Reported by PMD.
Line: 55
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
assertEquals(
"multiset.entrySet() iterator.next() returned incorrect entry",
Multisets.immutableEntry(e0(), 1),
Reported by PMD.
Line: 55
@CollectionSize.Require(ONE)
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
public void testEntrySet_iteratorRemovePropagates() {
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
assertTrue(
"non-empty multiset.entrySet() iterator.hasNext() returned false", iterator.hasNext());
assertEquals(
"multiset.entrySet() iterator.next() returned incorrect entry",
Multisets.immutableEntry(e0(), 1),
Reported by PMD.
Line: 68
iterator.remove();
assertTrue(
"multiset isn't empty after multiset.entrySet() iterator.remove()",
getMultiset().isEmpty());
}
@CollectionSize.Require(absent = ZERO)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testEntrySet_removePresent() {
Reported by PMD.
guava/src/com/google/common/collect/Sets.java
111 issues
Line: 1468
int adjust = size() - 1;
for (int i = 0; i < axes.size(); i++) {
adjust *= 31;
adjust = ~~adjust;
// in GWT, we have to deal with integer overflow carefully
}
int hash = 1;
for (Set<E> axis : axes) {
hash = 31 * hash + (size() / axis.size() * axis.hashCode());
Reported by PMD.
Line: 1475
for (Set<E> axis : axes) {
hash = 31 * hash + (size() / axis.size() * axis.hashCode());
hash = ~~hash;
}
hash += adjust;
return ~~hash;
}
}
Reported by PMD.
Line: 1478
hash = ~~hash;
}
hash += adjust;
return ~~hash;
}
}
/**
* Returns the set of all possible subsets of {@code set}. For example, {@code
Reported by PMD.
Line: 1749
for (Object o : s) {
hashCode += o != null ? o.hashCode() : 0;
hashCode = ~~hashCode;
// Needed to deal with unusual integer overflow in GWT.
}
return hashCode;
}
Reported by PMD.
Line: 1966
return changed;
}
static boolean removeAllImpl(Set<?> set, Collection<?> collection) {
checkNotNull(collection); // for GWT
if (collection instanceof Multiset) {
collection = ((Multiset<?>) collection).elementSet();
}
/*
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
Reported by PMD.
Line: 71
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Sets {
private Sets() {}
/**
* {@link AbstractSet} substitute without the potentially-quadratic {@code removeAll}
* implementation.
Reported by PMD.
Line: 71
*/
@GwtCompatible(emulated = true)
@ElementTypesAreNonnullByDefault
public final class Sets {
private Sets() {}
/**
* {@link AbstractSet} substitute without the potentially-quadratic {@code removeAll}
* implementation.
Reported by PMD.
guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java
111 issues
Line: 36
* @author Isaac Shum
*/
@GwtCompatible
public class MapsTransformValuesTest extends MapInterfaceTest<String, String> {
/**
* Constructor that assigns {@code supportsIteratorRemove} the same value as {@code
* supportsRemove}.
*/
Reported by PMD.
Line: 69
@Override
protected Map<String, String> makePopulatedMap() {
Map<String, Integer> underlying = Maps.newHashMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
Reported by PMD.
Line: 70
protected Map<String, String> makePopulatedMap() {
Map<String, Integer> underlying = Maps.newHashMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
@Override
Reported by PMD.
Line: 71
Map<String, Integer> underlying = Maps.newHashMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
@Override
protected String getKeyNotInPopulatedMap() throws UnsupportedOperationException {
Reported by PMD.
Line: 76
}
@Override
protected String getKeyNotInPopulatedMap() throws UnsupportedOperationException {
return "z";
}
@Override
protected String getValueNotInPopulatedMap() throws UnsupportedOperationException {
Reported by PMD.
Line: 81
}
@Override
protected String getValueNotInPopulatedMap() throws UnsupportedOperationException {
return "26";
}
/** Helper assertion comparing two maps */
private void assertMapsEqual(Map<?, ?> expected, Map<?, ?> map) {
Reported by PMD.
Line: 95
// mapValues > expectedValues; i.e. that expectedValues == mapValues.
Collection<?> expectedValues = expected.values();
Collection<?> mapValues = map.values();
assertEquals(expectedValues.size(), mapValues.size());
assertTrue(expectedValues.containsAll(mapValues));
assertTrue(mapValues.containsAll(expectedValues));
}
public void testTransformEmptyMapEquality() {
Reported by PMD.
Line: 95
// mapValues > expectedValues; i.e. that expectedValues == mapValues.
Collection<?> expectedValues = expected.values();
Collection<?> mapValues = map.values();
assertEquals(expectedValues.size(), mapValues.size());
assertTrue(expectedValues.containsAll(mapValues));
assertTrue(mapValues.containsAll(expectedValues));
}
public void testTransformEmptyMapEquality() {
Reported by PMD.
Line: 96
Collection<?> expectedValues = expected.values();
Collection<?> mapValues = map.values();
assertEquals(expectedValues.size(), mapValues.size());
assertTrue(expectedValues.containsAll(mapValues));
assertTrue(mapValues.containsAll(expectedValues));
}
public void testTransformEmptyMapEquality() {
Map<String, String> map =
Reported by PMD.
Line: 97
Collection<?> mapValues = map.values();
assertEquals(expectedValues.size(), mapValues.size());
assertTrue(expectedValues.containsAll(mapValues));
assertTrue(mapValues.containsAll(expectedValues));
}
public void testTransformEmptyMapEquality() {
Map<String, String> map =
Maps.transformValues(ImmutableMap.<String, Integer>of(), Functions.toStringFunction());
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java
111 issues
Line: 50
protected void shutDown() throws Exception {}
}
public void testServiceStartStop() throws Exception {
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
Reported by PMD.
Line: 50
protected void shutDown() throws Exception {}
}
public void testServiceStartStop() throws Exception {
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
Reported by PMD.
Line: 52
public void testServiceStartStop() throws Exception {
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
}
Reported by PMD.
Line: 53
public void testServiceStartStop() throws Exception {
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
Reported by PMD.
Line: 54
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
Reported by PMD.
Line: 55
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
AbstractIdleService service =
Reported by PMD.
Line: 58
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
AbstractIdleService service =
new DefaultService() {
@Override
protected void startUp() throws Exception {
Reported by PMD.
Line: 58
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
AbstractIdleService service =
new DefaultService() {
@Override
protected void startUp() throws Exception {
Reported by PMD.
Line: 59
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
AbstractIdleService service =
new DefaultService() {
@Override
protected void startUp() throws Exception {
throw exception;
Reported by PMD.
Line: 68
}
};
try {
service.startAsync().awaitRunning();
fail();
} catch (RuntimeException e) {
assertThat(e).hasCauseThat().isSameInstanceAs(exception);
}
assertEquals(Service.State.FAILED, service.state());
Reported by PMD.
android/guava-tests/test/com/google/common/primitives/UnsignedIntegerTest.java
111 issues
Line: 32
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class UnsignedIntegerTest extends TestCase {
private static final ImmutableSet<Integer> TEST_INTS;
private static final ImmutableSet<Long> TEST_LONGS;
private static int force32(int value) {
// GWT doesn't consistently overflow values to make them 32-bit, so we need to force it.
Reported by PMD.
Line: 59
TEST_LONGS = testLongsBuilder.build();
}
public void testFromIntBitsAndIntValueAreInverses() {
for (int value : TEST_INTS) {
assertEquals(
UnsignedInts.toString(value), value, UnsignedInteger.fromIntBits(value).intValue());
}
}
Reported by PMD.
Line: 62
public void testFromIntBitsAndIntValueAreInverses() {
for (int value : TEST_INTS) {
assertEquals(
UnsignedInts.toString(value), value, UnsignedInteger.fromIntBits(value).intValue());
}
}
public void testFromIntBitsLongValue() {
for (int value : TEST_INTS) {
Reported by PMD.
Line: 66
}
}
public void testFromIntBitsLongValue() {
for (int value : TEST_INTS) {
long expected = value & 0xffffffffL;
assertEquals(
UnsignedInts.toString(value), expected, UnsignedInteger.fromIntBits(value).longValue());
}
Reported by PMD.
Line: 70
for (int value : TEST_INTS) {
long expected = value & 0xffffffffL;
assertEquals(
UnsignedInts.toString(value), expected, UnsignedInteger.fromIntBits(value).longValue());
}
}
public void testValueOfLong() {
long min = 0;
Reported by PMD.
Line: 74
}
}
public void testValueOfLong() {
long min = 0;
long max = (1L << 32) - 1;
for (long value : TEST_LONGS) {
boolean expectSuccess = value >= min && value <= max;
try {
Reported by PMD.
Line: 74
}
}
public void testValueOfLong() {
long min = 0;
long max = (1L << 32) - 1;
for (long value : TEST_LONGS) {
boolean expectSuccess = value >= min && value <= max;
try {
Reported by PMD.
Line: 80
for (long value : TEST_LONGS) {
boolean expectSuccess = value >= min && value <= max;
try {
assertEquals(value, UnsignedInteger.valueOf(value).longValue());
assertTrue(expectSuccess);
} catch (IllegalArgumentException e) {
assertFalse(expectSuccess);
}
}
Reported by PMD.
Line: 80
for (long value : TEST_LONGS) {
boolean expectSuccess = value >= min && value <= max;
try {
assertEquals(value, UnsignedInteger.valueOf(value).longValue());
assertTrue(expectSuccess);
} catch (IllegalArgumentException e) {
assertFalse(expectSuccess);
}
}
Reported by PMD.
Line: 81
boolean expectSuccess = value >= min && value <= max;
try {
assertEquals(value, UnsignedInteger.valueOf(value).longValue());
assertTrue(expectSuccess);
} catch (IllegalArgumentException e) {
assertFalse(expectSuccess);
}
}
}
Reported by PMD.
guava-tests/test/com/google/common/primitives/UnsignedIntegerTest.java
111 issues
Line: 32
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class UnsignedIntegerTest extends TestCase {
private static final ImmutableSet<Integer> TEST_INTS;
private static final ImmutableSet<Long> TEST_LONGS;
private static int force32(int value) {
// GWT doesn't consistently overflow values to make them 32-bit, so we need to force it.
Reported by PMD.
Line: 59
TEST_LONGS = testLongsBuilder.build();
}
public void testFromIntBitsAndIntValueAreInverses() {
for (int value : TEST_INTS) {
assertEquals(
UnsignedInts.toString(value), value, UnsignedInteger.fromIntBits(value).intValue());
}
}
Reported by PMD.
Line: 62
public void testFromIntBitsAndIntValueAreInverses() {
for (int value : TEST_INTS) {
assertEquals(
UnsignedInts.toString(value), value, UnsignedInteger.fromIntBits(value).intValue());
}
}
public void testFromIntBitsLongValue() {
for (int value : TEST_INTS) {
Reported by PMD.
Line: 66
}
}
public void testFromIntBitsLongValue() {
for (int value : TEST_INTS) {
long expected = value & 0xffffffffL;
assertEquals(
UnsignedInts.toString(value), expected, UnsignedInteger.fromIntBits(value).longValue());
}
Reported by PMD.
Line: 70
for (int value : TEST_INTS) {
long expected = value & 0xffffffffL;
assertEquals(
UnsignedInts.toString(value), expected, UnsignedInteger.fromIntBits(value).longValue());
}
}
public void testValueOfLong() {
long min = 0;
Reported by PMD.
Line: 74
}
}
public void testValueOfLong() {
long min = 0;
long max = (1L << 32) - 1;
for (long value : TEST_LONGS) {
boolean expectSuccess = value >= min && value <= max;
try {
Reported by PMD.
Line: 74
}
}
public void testValueOfLong() {
long min = 0;
long max = (1L << 32) - 1;
for (long value : TEST_LONGS) {
boolean expectSuccess = value >= min && value <= max;
try {
Reported by PMD.
Line: 80
for (long value : TEST_LONGS) {
boolean expectSuccess = value >= min && value <= max;
try {
assertEquals(value, UnsignedInteger.valueOf(value).longValue());
assertTrue(expectSuccess);
} catch (IllegalArgumentException e) {
assertFalse(expectSuccess);
}
}
Reported by PMD.
Line: 80
for (long value : TEST_LONGS) {
boolean expectSuccess = value >= min && value <= max;
try {
assertEquals(value, UnsignedInteger.valueOf(value).longValue());
assertTrue(expectSuccess);
} catch (IllegalArgumentException e) {
assertFalse(expectSuccess);
}
}
Reported by PMD.
Line: 81
boolean expectSuccess = value >= min && value <= max;
try {
assertEquals(value, UnsignedInteger.valueOf(value).longValue());
assertTrue(expectSuccess);
} catch (IllegalArgumentException e) {
assertFalse(expectSuccess);
}
}
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java
111 issues
Line: 36
* @author Isaac Shum
*/
@GwtCompatible
public class MapsTransformValuesTest extends MapInterfaceTest<String, String> {
/**
* Constructor that assigns {@code supportsIteratorRemove} the same value as {@code
* supportsRemove}.
*/
Reported by PMD.
Line: 68
@Override
protected Map<String, String> makePopulatedMap() {
Map<String, Integer> underlying = Maps.newHashMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
Reported by PMD.
Line: 69
protected Map<String, String> makePopulatedMap() {
Map<String, Integer> underlying = Maps.newHashMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
@Override
Reported by PMD.
Line: 70
Map<String, Integer> underlying = Maps.newHashMap();
underlying.put("a", 1);
underlying.put("b", 2);
underlying.put("c", 3);
return Maps.transformValues(underlying, Functions.toStringFunction());
}
@Override
protected String getKeyNotInPopulatedMap() throws UnsupportedOperationException {
Reported by PMD.
Line: 75
}
@Override
protected String getKeyNotInPopulatedMap() throws UnsupportedOperationException {
return "z";
}
@Override
protected String getValueNotInPopulatedMap() throws UnsupportedOperationException {
Reported by PMD.
Line: 80
}
@Override
protected String getValueNotInPopulatedMap() throws UnsupportedOperationException {
return "26";
}
/** Helper assertion comparing two maps */
private void assertMapsEqual(Map<?, ?> expected, Map<?, ?> map) {
Reported by PMD.
Line: 94
// mapValues > expectedValues; i.e. that expectedValues == mapValues.
Collection<?> expectedValues = expected.values();
Collection<?> mapValues = map.values();
assertEquals(expectedValues.size(), mapValues.size());
assertTrue(expectedValues.containsAll(mapValues));
assertTrue(mapValues.containsAll(expectedValues));
}
public void testTransformEmptyMapEquality() {
Reported by PMD.
Line: 94
// mapValues > expectedValues; i.e. that expectedValues == mapValues.
Collection<?> expectedValues = expected.values();
Collection<?> mapValues = map.values();
assertEquals(expectedValues.size(), mapValues.size());
assertTrue(expectedValues.containsAll(mapValues));
assertTrue(mapValues.containsAll(expectedValues));
}
public void testTransformEmptyMapEquality() {
Reported by PMD.
Line: 95
Collection<?> expectedValues = expected.values();
Collection<?> mapValues = map.values();
assertEquals(expectedValues.size(), mapValues.size());
assertTrue(expectedValues.containsAll(mapValues));
assertTrue(mapValues.containsAll(expectedValues));
}
public void testTransformEmptyMapEquality() {
Map<String, String> map =
Reported by PMD.
Line: 96
Collection<?> mapValues = map.values();
assertEquals(expectedValues.size(), mapValues.size());
assertTrue(expectedValues.containsAll(mapValues));
assertTrue(mapValues.containsAll(expectedValues));
}
public void testTransformEmptyMapEquality() {
Map<String, String> map =
Maps.transformValues(ImmutableMap.<String, Integer>of(), Functions.toStringFunction());
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java
111 issues
Line: 50
protected void shutDown() throws Exception {}
}
public void testServiceStartStop() throws Exception {
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
Reported by PMD.
Line: 50
protected void shutDown() throws Exception {}
}
public void testServiceStartStop() throws Exception {
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
Reported by PMD.
Line: 52
public void testServiceStartStop() throws Exception {
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
}
Reported by PMD.
Line: 53
public void testServiceStartStop() throws Exception {
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
Reported by PMD.
Line: 54
AbstractIdleService service = new DefaultService();
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
Reported by PMD.
Line: 55
service.startAsync().awaitRunning();
assertEquals(Service.State.RUNNING, service.state());
service.stopAsync().awaitTerminated();
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
AbstractIdleService service =
Reported by PMD.
Line: 58
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
AbstractIdleService service =
new DefaultService() {
@Override
protected void startUp() throws Exception {
Reported by PMD.
Line: 58
assertEquals(Service.State.TERMINATED, service.state());
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
AbstractIdleService service =
new DefaultService() {
@Override
protected void startUp() throws Exception {
Reported by PMD.
Line: 59
}
public void testStart_failed() throws Exception {
final Exception exception = new Exception("deliberate");
AbstractIdleService service =
new DefaultService() {
@Override
protected void startUp() throws Exception {
throw exception;
Reported by PMD.
Line: 68
}
};
try {
service.startAsync().awaitRunning();
fail();
} catch (RuntimeException e) {
assertThat(e).hasCauseThat().isSameInstanceAs(exception);
}
assertEquals(Service.State.FAILED, service.state());
Reported by PMD.
guava-tests/test/com/google/common/collect/HashingTest.java
110 issues
Line: 25
/** Tests for {@code Hashing}. */
@GwtCompatible
public class HashingTest extends TestCase {
public void testSmear() {
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
Reported by PMD.
Line: 25
/** Tests for {@code Hashing}. */
@GwtCompatible
public class HashingTest extends TestCase {
public void testSmear() {
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
Reported by PMD.
Line: 25
/** Tests for {@code Hashing}. */
@GwtCompatible
public class HashingTest extends TestCase {
public void testSmear() {
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
Reported by PMD.
Line: 25
/** Tests for {@code Hashing}. */
@GwtCompatible
public class HashingTest extends TestCase {
public void testSmear() {
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
Reported by PMD.
Line: 25
/** Tests for {@code Hashing}. */
@GwtCompatible
public class HashingTest extends TestCase {
public void testSmear() {
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
Reported by PMD.
Line: 26
@GwtCompatible
public class HashingTest extends TestCase {
public void testSmear() {
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
assertEquals(-309370926, smear(-1155484576));
Reported by PMD.
Line: 27
public class HashingTest extends TestCase {
public void testSmear() {
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
assertEquals(-309370926, smear(-1155484576));
assertEquals(-1645495900, smear(-723955400));
Reported by PMD.
Line: 28
public void testSmear() {
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
assertEquals(-309370926, smear(-1155484576));
assertEquals(-1645495900, smear(-723955400));
assertEquals(766424523, smear(1033096058));
Reported by PMD.
Line: 29
assertEquals(1459320713, smear(754102528));
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
assertEquals(-309370926, smear(-1155484576));
assertEquals(-1645495900, smear(-723955400));
assertEquals(766424523, smear(1033096058));
assertEquals(-757003149, smear(-1690734402));
Reported by PMD.
Line: 30
assertEquals(-160560296, smear(1234567890));
assertEquals(-1017931171, smear(1));
assertEquals(-1350072884, smear(-2000000000));
assertEquals(-809843551, smear(2000000000));
assertEquals(-309370926, smear(-1155484576));
assertEquals(-1645495900, smear(-723955400));
assertEquals(766424523, smear(1033096058));
assertEquals(-757003149, smear(-1690734402));
assertEquals(-245078984, smear(-1557280266));
Reported by PMD.