The following issues were found
guava-tests/test/com/google/common/math/DoubleMathTest.java
264 issues
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.collect.Iterables.get;
import static com.google.common.collect.Iterables.size;
import static com.google.common.math.MathTesting.ALL_DOUBLE_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.collect.Iterables.get;
import static com.google.common.collect.Iterables.size;
import static com.google.common.math.MathTesting.ALL_DOUBLE_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
Reported by PMD.
Line: 60
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class DoubleMathTest extends TestCase {
private static final BigDecimal MAX_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MAX_VALUE);
private static final BigDecimal MIN_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MIN_VALUE);
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
Reported by PMD.
Line: 60
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class DoubleMathTest extends TestCase {
private static final BigDecimal MAX_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MAX_VALUE);
private static final BigDecimal MIN_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MIN_VALUE);
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
Reported by PMD.
Line: 60
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class DoubleMathTest extends TestCase {
private static final BigDecimal MAX_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MAX_VALUE);
private static final BigDecimal MIN_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MIN_VALUE);
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
Reported by PMD.
Line: 68
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
private static final BigDecimal MIN_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MIN_VALUE);
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
Reported by PMD.
Line: 68
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
private static final BigDecimal MIN_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MIN_VALUE);
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
Reported by PMD.
Line: 69
private static final BigDecimal MIN_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MIN_VALUE);
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
Reported by PMD.
Line: 70
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
public void testConstantsEverySixteenthFactorial() {
Reported by PMD.
Line: 70
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
public void testConstantsEverySixteenthFactorial() {
Reported by PMD.
android/guava-tests/test/com/google/common/math/DoubleMathTest.java
264 issues
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.collect.Iterables.get;
import static com.google.common.collect.Iterables.size;
import static com.google.common.math.MathTesting.ALL_DOUBLE_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.collect.Iterables.get;
import static com.google.common.collect.Iterables.size;
import static com.google.common.math.MathTesting.ALL_DOUBLE_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
Reported by PMD.
Line: 60
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class DoubleMathTest extends TestCase {
private static final BigDecimal MAX_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MAX_VALUE);
private static final BigDecimal MIN_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MIN_VALUE);
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
Reported by PMD.
Line: 60
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class DoubleMathTest extends TestCase {
private static final BigDecimal MAX_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MAX_VALUE);
private static final BigDecimal MIN_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MIN_VALUE);
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
Reported by PMD.
Line: 60
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class DoubleMathTest extends TestCase {
private static final BigDecimal MAX_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MAX_VALUE);
private static final BigDecimal MIN_INT_AS_BIG_DECIMAL = BigDecimal.valueOf(Integer.MIN_VALUE);
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
Reported by PMD.
Line: 68
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
private static final BigDecimal MIN_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MIN_VALUE);
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
Reported by PMD.
Line: 68
private static final BigDecimal MAX_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MAX_VALUE);
private static final BigDecimal MIN_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MIN_VALUE);
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
Reported by PMD.
Line: 69
private static final BigDecimal MIN_LONG_AS_BIG_DECIMAL = BigDecimal.valueOf(Long.MIN_VALUE);
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
Reported by PMD.
Line: 70
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
public void testConstantsEverySixteenthFactorial() {
Reported by PMD.
Line: 70
public void testConstantsMaxFactorial() {
BigInteger maxDoubleValue = BigDecimal.valueOf(Double.MAX_VALUE).toBigInteger();
assertTrue(BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL).compareTo(maxDoubleValue) <= 0);
assertTrue(
BigIntegerMath.factorial(DoubleMath.MAX_FACTORIAL + 1).compareTo(maxDoubleValue) > 0);
}
public void testConstantsEverySixteenthFactorial() {
Reported by PMD.
guava-tests/test/com/google/common/graph/AbstractNetworkTest.java
262 issues
Line: 17
* limitations under the License.
*/
package com.google.common.graph;
import static com.google.common.graph.TestUtil.ERROR_NODE_NOT_IN_GRAPH;
import static com.google.common.graph.TestUtil.assertEdgeNotInGraphErrorMessage;
import static com.google.common.graph.TestUtil.assertNodeNotInGraphErrorMessage;
import static com.google.common.graph.TestUtil.assertStronglyEquivalent;
Reported by PMD.
Line: 59
* TODO(user): Make this class generic (using <N, E>) for all node and edge types.
* TODO(user): Differentiate between directed and undirected edge strings.
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
Reported by PMD.
Line: 59
* TODO(user): Make this class generic (using <N, E>) for all node and edge types.
* TODO(user): Differentiate between directed and undirected edge strings.
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
Reported by PMD.
Line: 59
* TODO(user): Make this class generic (using <N, E>) for all node and edge types.
* TODO(user): Differentiate between directed and undirected edge strings.
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
Reported by PMD.
Line: 59
* TODO(user): Make this class generic (using <N, E>) for all node and edge types.
* TODO(user): Differentiate between directed and undirected edge strings.
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
Reported by PMD.
Line: 61
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
* {@link #createGraph()} didn't return a mutable network.
*/
Reported by PMD.
Line: 67
* The same reference as {@link #network}, except as a mutable network. This field is null in case
* {@link #createGraph()} didn't return a mutable network.
*/
MutableNetwork<Integer, String> networkAsMutableNetwork;
static final Integer N1 = 1;
static final Integer N2 = 2;
static final Integer N3 = 3;
static final Integer N4 = 4;
Reported by PMD.
Line: 142
validateNetwork(network);
}
static <N, E> void validateNetwork(Network<N, E> network) {
assertStronglyEquivalent(network, Graphs.copyOf(network));
assertStronglyEquivalent(network, ImmutableNetwork.copyOf(network));
String networkString = network.toString();
assertThat(networkString).contains("isDirected: " + network.isDirected());
Reported by PMD.
Line: 142
validateNetwork(network);
}
static <N, E> void validateNetwork(Network<N, E> network) {
assertStronglyEquivalent(network, Graphs.copyOf(network));
assertStronglyEquivalent(network, ImmutableNetwork.copyOf(network));
String networkString = network.toString();
assertThat(networkString).contains("isDirected: " + network.isDirected());
Reported by PMD.
Line: 142
validateNetwork(network);
}
static <N, E> void validateNetwork(Network<N, E> network) {
assertStronglyEquivalent(network, Graphs.copyOf(network));
assertStronglyEquivalent(network, ImmutableNetwork.copyOf(network));
String networkString = network.toString();
assertThat(networkString).contains("isDirected: " + network.isDirected());
Reported by PMD.
guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java
260 issues
Line: 39
* @author Louis Wasserman
*/
@GwtIncompatible // ImmutableRangeSet
public class ImmutableRangeSetTest extends AbstractRangeSetTest {
static final class ImmutableRangeSetIntegerAsSetGenerator implements TestSetGenerator<Integer> {
@Override
public SampleElements<Integer> samples() {
return new SampleElements<>(1, 4, 3, 2, 5);
Reported by PMD.
Line: 39
* @author Louis Wasserman
*/
@GwtIncompatible // ImmutableRangeSet
public class ImmutableRangeSetTest extends AbstractRangeSetTest {
static final class ImmutableRangeSetIntegerAsSetGenerator implements TestSetGenerator<Integer> {
@Override
public SampleElements<Integer> samples() {
return new SampleElements<>(1, 4, 3, 2, 5);
Reported by PMD.
Line: 39
* @author Louis Wasserman
*/
@GwtIncompatible // ImmutableRangeSet
public class ImmutableRangeSetTest extends AbstractRangeSetTest {
static final class ImmutableRangeSetIntegerAsSetGenerator implements TestSetGenerator<Integer> {
@Override
public SampleElements<Integer> samples() {
return new SampleElements<>(1, 4, 3, 2, 5);
Reported by PMD.
Line: 39
* @author Louis Wasserman
*/
@GwtIncompatible // ImmutableRangeSet
public class ImmutableRangeSetTest extends AbstractRangeSetTest {
static final class ImmutableRangeSetIntegerAsSetGenerator implements TestSetGenerator<Integer> {
@Override
public SampleElements<Integer> samples() {
return new SampleElements<>(1, 4, 3, 2, 5);
Reported by PMD.
Line: 54
@Override
public Iterable<Integer> order(List<Integer> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
@Override
public Set<Integer> create(Object... elements) {
ImmutableRangeSet.Builder<Integer> builder = ImmutableRangeSet.builder();
Reported by PMD.
Line: 64
Integer i = (Integer) o;
builder.add(Range.singleton(i));
}
return builder.build().asSet(DiscreteDomain.integers());
}
}
static final class ImmutableRangeSetBigIntegerAsSetGenerator
implements TestSetGenerator<BigInteger> {
Reported by PMD.
Line: 87
@Override
public Iterable<BigInteger> order(List<BigInteger> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
@Override
public Set<BigInteger> create(Object... elements) {
ImmutableRangeSet.Builder<BigInteger> builder = ImmutableRangeSet.builder();
Reported by PMD.
Line: 95
ImmutableRangeSet.Builder<BigInteger> builder = ImmutableRangeSet.builder();
for (Object o : elements) {
BigInteger i = (BigInteger) o;
builder.add(Range.closedOpen(i, i.add(BigInteger.ONE)));
}
return builder.build().asSet(DiscreteDomain.bigIntegers());
}
}
Reported by PMD.
Line: 97
BigInteger i = (BigInteger) o;
builder.add(Range.closedOpen(i, i.add(BigInteger.ONE)));
}
return builder.build().asSet(DiscreteDomain.bigIntegers());
}
}
public static Test suite() {
TestSuite suite = new TestSuite();
Reported by PMD.
Line: 101
}
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableRangeSetTest.class);
suite.addTest(
NavigableSetTestSuiteBuilder.using(new ImmutableRangeSetIntegerAsSetGenerator())
.named("ImmutableRangeSet.asSet[DiscreteDomain.integers[]]")
Reported by PMD.
guava-tests/test/com/google/common/collect/ImmutableSortedMultisetTest.java
258 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;
import static org.mockito.Mockito.mock;
Reported by PMD.
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;
import static org.mockito.Mockito.mock;
Reported by PMD.
Line: 54
*
* @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: 54
*
* @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: 55
* @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: 69
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
})
.named("ImmutableSortedMultiset")
.withFeatures(
CollectionSize.ANY,
Reported by PMD.
Line: 84
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: 89
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
})
.named("ImmutableSortedMultiset.asList")
.withFeatures(
CollectionSize.ANY,
Reported by PMD.
Line: 111
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: 111
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.
guava-tests/test/com/google/common/primitives/ImmutableIntArrayTest.java
257 issues
Line: 46
/** @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: 46
/** @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: 49
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: 50
// 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: 50
// 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: 53
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: 54
}
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: 54
}
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: 57
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: 58
}
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.
android/guava-tests/test/com/google/common/graph/AbstractNetworkTest.java
257 issues
Line: 17
* limitations under the License.
*/
package com.google.common.graph;
import static com.google.common.graph.TestUtil.ERROR_NODE_NOT_IN_GRAPH;
import static com.google.common.graph.TestUtil.assertEdgeNotInGraphErrorMessage;
import static com.google.common.graph.TestUtil.assertNodeNotInGraphErrorMessage;
import static com.google.common.graph.TestUtil.assertStronglyEquivalent;
Reported by PMD.
Line: 59
* TODO(user): Make this class generic (using <N, E>) for all node and edge types.
* TODO(user): Differentiate between directed and undirected edge strings.
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
Reported by PMD.
Line: 59
* TODO(user): Make this class generic (using <N, E>) for all node and edge types.
* TODO(user): Differentiate between directed and undirected edge strings.
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
Reported by PMD.
Line: 59
* TODO(user): Make this class generic (using <N, E>) for all node and edge types.
* TODO(user): Differentiate between directed and undirected edge strings.
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
Reported by PMD.
Line: 59
* TODO(user): Make this class generic (using <N, E>) for all node and edge types.
* TODO(user): Differentiate between directed and undirected edge strings.
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
Reported by PMD.
Line: 61
*/
public abstract class AbstractNetworkTest {
Network<Integer, String> network;
/**
* The same reference as {@link #network}, except as a mutable network. This field is null in case
* {@link #createGraph()} didn't return a mutable network.
*/
Reported by PMD.
Line: 67
* The same reference as {@link #network}, except as a mutable network. This field is null in case
* {@link #createGraph()} didn't return a mutable network.
*/
MutableNetwork<Integer, String> networkAsMutableNetwork;
static final Integer N1 = 1;
static final Integer N2 = 2;
static final Integer N3 = 3;
static final Integer N4 = 4;
Reported by PMD.
Line: 142
validateNetwork(network);
}
static <N, E> void validateNetwork(Network<N, E> network) {
assertStronglyEquivalent(network, Graphs.copyOf(network));
assertStronglyEquivalent(network, ImmutableNetwork.copyOf(network));
String networkString = network.toString();
assertThat(networkString).contains("isDirected: " + network.isDirected());
Reported by PMD.
Line: 142
validateNetwork(network);
}
static <N, E> void validateNetwork(Network<N, E> network) {
assertStronglyEquivalent(network, Graphs.copyOf(network));
assertStronglyEquivalent(network, ImmutableNetwork.copyOf(network));
String networkString = network.toString();
assertThat(networkString).contains("isDirected: " + network.isDirected());
Reported by PMD.
Line: 142
validateNetwork(network);
}
static <N, E> void validateNetwork(Network<N, E> network) {
assertStronglyEquivalent(network, Graphs.copyOf(network));
assertStronglyEquivalent(network, ImmutableNetwork.copyOf(network));
String networkString = network.toString();
assertThat(networkString).contains("isDirected: " + network.isDirected());
Reported by PMD.
guava-tests/test/com/google/common/primitives/ImmutableLongArrayTest.java
256 issues
Line: 46
/** @author Kevin Bourrillion */
@GwtCompatible(emulated = true)
public class ImmutableLongArrayTest extends TestCase {
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableLongArray.of().asList()).isEmpty();
}
Reported by PMD.
Line: 46
/** @author Kevin Bourrillion */
@GwtCompatible(emulated = true)
public class ImmutableLongArrayTest extends TestCase {
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableLongArray.of().asList()).isEmpty();
}
Reported by PMD.
Line: 49
public class ImmutableLongArrayTest extends TestCase {
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableLongArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableLongArray.of(0).asList()).containsExactly(0L);
Reported by PMD.
Line: 50
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableLongArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableLongArray.of(0).asList()).containsExactly(0L);
}
Reported by PMD.
Line: 50
// Test all creation paths very lazily: by assuming asList() works
public void testOf0() {
assertThat(ImmutableLongArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableLongArray.of(0).asList()).containsExactly(0L);
}
Reported by PMD.
Line: 53
assertThat(ImmutableLongArray.of().asList()).isEmpty();
}
public void testOf1() {
assertThat(ImmutableLongArray.of(0).asList()).containsExactly(0L);
}
public void testOf2() {
assertThat(ImmutableLongArray.of(0, 1).asList()).containsExactly(0L, 1L).inOrder();
Reported by PMD.
Line: 54
}
public void testOf1() {
assertThat(ImmutableLongArray.of(0).asList()).containsExactly(0L);
}
public void testOf2() {
assertThat(ImmutableLongArray.of(0, 1).asList()).containsExactly(0L, 1L).inOrder();
}
Reported by PMD.
Line: 54
}
public void testOf1() {
assertThat(ImmutableLongArray.of(0).asList()).containsExactly(0L);
}
public void testOf2() {
assertThat(ImmutableLongArray.of(0, 1).asList()).containsExactly(0L, 1L).inOrder();
}
Reported by PMD.
Line: 57
assertThat(ImmutableLongArray.of(0).asList()).containsExactly(0L);
}
public void testOf2() {
assertThat(ImmutableLongArray.of(0, 1).asList()).containsExactly(0L, 1L).inOrder();
}
public void testOf3() {
assertThat(ImmutableLongArray.of(0, 1, 3).asList()).containsExactly(0L, 1L, 3L).inOrder();
Reported by PMD.
Line: 58
}
public void testOf2() {
assertThat(ImmutableLongArray.of(0, 1).asList()).containsExactly(0L, 1L).inOrder();
}
public void testOf3() {
assertThat(ImmutableLongArray.of(0, 1, 3).asList()).containsExactly(0L, 1L, 3L).inOrder();
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java
251 issues
Line: 50
* @author Neal Kanodia
*/
@GwtCompatible(emulated = true)
public class TreeMultisetTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
Reported by PMD.
Line: 52
@GwtCompatible(emulated = true)
public class TreeMultisetTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
SortedMultisetTestSuiteBuilder.using(
new TestStringMultisetGenerator() {
Reported by PMD.
Line: 65
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
})
.withFeatures(
CollectionSize.ANY,
CollectionFeature.KNOWN_ORDER,
Reported by PMD.
Line: 107
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
return TreeMultiset.create(Arrays.asList(elements)).elementSet();
}
@Override
public List<String> order(List<String> insertionOrder) {
return Lists.newArrayList(Sets.newTreeSet(insertionOrder));
Reported by PMD.
Line: 125
return suite;
}
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
Reported by PMD.
Line: 125
return suite;
}
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
Reported by PMD.
Line: 127
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals(Ordering.natural(), multiset.comparator());
assertEquals("[bar, foo x 2]", multiset.toString());
Reported by PMD.
Line: 127
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals(Ordering.natural(), multiset.comparator());
assertEquals("[bar, foo x 2]", multiset.toString());
Reported by PMD.
Line: 128
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals(Ordering.natural(), multiset.comparator());
assertEquals("[bar, foo x 2]", multiset.toString());
}
Reported by PMD.
Line: 128
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals(Ordering.natural(), multiset.comparator());
assertEquals("[bar, foo x 2]", multiset.toString());
}
Reported by PMD.
guava-tests/test/com/google/common/collect/TreeMultisetTest.java
251 issues
Line: 50
* @author Neal Kanodia
*/
@GwtCompatible(emulated = true)
public class TreeMultisetTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
Reported by PMD.
Line: 52
@GwtCompatible(emulated = true)
public class TreeMultisetTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
SortedMultisetTestSuiteBuilder.using(
new TestStringMultisetGenerator() {
Reported by PMD.
Line: 65
@Override
public List<String> order(List<String> insertionOrder) {
return Ordering.natural().sortedCopy(insertionOrder);
}
})
.withFeatures(
CollectionSize.ANY,
CollectionFeature.KNOWN_ORDER,
Reported by PMD.
Line: 107
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
return TreeMultiset.create(Arrays.asList(elements)).elementSet();
}
@Override
public List<String> order(List<String> insertionOrder) {
return Lists.newArrayList(Sets.newTreeSet(insertionOrder));
Reported by PMD.
Line: 125
return suite;
}
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
Reported by PMD.
Line: 125
return suite;
}
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
Reported by PMD.
Line: 127
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals(Ordering.natural(), multiset.comparator());
assertEquals("[bar, foo x 2]", multiset.toString());
Reported by PMD.
Line: 127
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals(Ordering.natural(), multiset.comparator());
assertEquals("[bar, foo x 2]", multiset.toString());
Reported by PMD.
Line: 128
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals(Ordering.natural(), multiset.comparator());
assertEquals("[bar, foo x 2]", multiset.toString());
}
Reported by PMD.
Line: 128
public void testCreate() {
TreeMultiset<String> multiset = TreeMultiset.create();
multiset.add("foo", 2);
multiset.add("bar");
assertEquals(3, multiset.size());
assertEquals(2, multiset.count("foo"));
assertEquals(Ordering.natural(), multiset.comparator());
assertEquals("[bar, foo x 2]", multiset.toString());
}
Reported by PMD.