The following issues were found

android/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java
390 issues
Possible God Class (WMC=49, ATFD=39, TCC=0.000%)
Design

Line: 48

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ImmutableListMultimapTest extends TestCase {
  public static class ImmutableListMultimapGenerator extends TestStringListMultimapGenerator {
    @Override
    protected ListMultimap<String, String> create(Entry<String, String>[] entries) {
      ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
      for (Entry<String, String> entry : entries) {

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 48

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ImmutableListMultimapTest extends TestCase {
  public static class ImmutableListMultimapGenerator extends TestStringListMultimapGenerator {
    @Override
    protected ListMultimap<String, String> create(Entry<String, String>[] entries) {
      ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
      for (Entry<String, String> entry : entries) {

            

Reported by PMD.

JUnit 4 indicates test suites via annotations, not the suite method.
Design

Line: 68

                  }
  }

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(
        ListMultimapTestSuiteBuilder.using(new ImmutableListMultimapGenerator())
            .named("ImmutableListMultimap")

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 85

                  return suite;
  }

  public void testBuilder_withImmutableEntry() {
    ImmutableListMultimap<String, Integer> multimap =
        new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).build();
    assertEquals(Arrays.asList(1), multimap.get("one"));
  }


            

Reported by PMD.

The String literal 'one' appears 19 times in this file; the first occurrence is on line 87
Error

Line: 87

              
  public void testBuilder_withImmutableEntry() {
    ImmutableListMultimap<String, Integer> multimap =
        new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).build();
    assertEquals(Arrays.asList(1), multimap.get("one"));
  }

  public void testBuilder_withImmutableEntryAndNullContents() {
    Builder<String, Integer> builder = new Builder<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 88

                public void testBuilder_withImmutableEntry() {
    ImmutableListMultimap<String, Integer> multimap =
        new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).build();
    assertEquals(Arrays.asList(1), multimap.get("one"));
  }

  public void testBuilder_withImmutableEntryAndNullContents() {
    Builder<String, Integer> builder = new Builder<>();
    try {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 91

                  assertEquals(Arrays.asList(1), multimap.get("one"));
  }

  public void testBuilder_withImmutableEntryAndNullContents() {
    Builder<String, Integer> builder = new Builder<>();
    try {
      builder.put(Maps.immutableEntry("one", (Integer) null));
      fail();
    } catch (NullPointerException expected) {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 95

                  Builder<String, Integer> builder = new Builder<>();
    try {
      builder.put(Maps.immutableEntry("one", (Integer) null));
      fail();
    } catch (NullPointerException expected) {
    }
    try {
      builder.put(Maps.immutableEntry((String) null, 1));
      fail();

            

Reported by PMD.

In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 95

                  Builder<String, Integer> builder = new Builder<>();
    try {
      builder.put(Maps.immutableEntry("one", (Integer) null));
      fail();
    } catch (NullPointerException expected) {
    }
    try {
      builder.put(Maps.immutableEntry((String) null, 1));
      fail();

            

Reported by PMD.

Avoid catching NullPointerException; consider removing the cause of the NPE.
Error

Line: 96

                  try {
      builder.put(Maps.immutableEntry("one", (Integer) null));
      fail();
    } catch (NullPointerException expected) {
    }
    try {
      builder.put(Maps.immutableEntry((String) null, 1));
      fail();
    } catch (NullPointerException expected) {

            

Reported by PMD.

android/guava-tests/test/com/google/common/graph/GraphsTest.java
386 issues
This class has too many methods, consider refactoring it.
Design

Line: 38

               * the missing nodes to the graph, then adds the edge between them.
 */
@RunWith(JUnit4.class)
public class GraphsTest {
  private static final Integer N1 = 1;
  private static final Integer N2 = 2;
  private static final Integer N3 = 3;
  private static final Integer N4 = 4;
  private static final String E11 = "1-1";

            

Reported by PMD.

Avoid unused private fields such as 'E12_B'.
Design

Line: 47

                private static final String E11_A = "1-1a";
  private static final String E12 = "1-2";
  private static final String E12_A = "1-2a";
  private static final String E12_B = "1-2b";
  private static final String E21 = "2-1";
  private static final String E13 = "1-3";
  private static final String E31 = "3-1";
  private static final String E34 = "3-4";
  private static final String E44 = "4-4";

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 66

                static final String ERROR_SELF_LOOP = "self-loops are not allowed";

  @Test
  public void transitiveClosure_directedGraph() {
    MutableGraph<Integer> directedGraph = GraphBuilder.directed().allowsSelfLoops(false).build();
    directedGraph.putEdge(N1, N2);
    directedGraph.putEdge(N1, N3);
    directedGraph.putEdge(N2, N3);
    directedGraph.addNode(N4);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 67

              
  @Test
  public void transitiveClosure_directedGraph() {
    MutableGraph<Integer> directedGraph = GraphBuilder.directed().allowsSelfLoops(false).build();
    directedGraph.putEdge(N1, N2);
    directedGraph.putEdge(N1, N3);
    directedGraph.putEdge(N2, N3);
    directedGraph.addNode(N4);


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 67

              
  @Test
  public void transitiveClosure_directedGraph() {
    MutableGraph<Integer> directedGraph = GraphBuilder.directed().allowsSelfLoops(false).build();
    directedGraph.putEdge(N1, N2);
    directedGraph.putEdge(N1, N3);
    directedGraph.putEdge(N2, N3);
    directedGraph.addNode(N4);


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 68

                @Test
  public void transitiveClosure_directedGraph() {
    MutableGraph<Integer> directedGraph = GraphBuilder.directed().allowsSelfLoops(false).build();
    directedGraph.putEdge(N1, N2);
    directedGraph.putEdge(N1, N3);
    directedGraph.putEdge(N2, N3);
    directedGraph.addNode(N4);

    MutableGraph<Integer> expectedClosure = GraphBuilder.directed().allowsSelfLoops(true).build();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 69

                public void transitiveClosure_directedGraph() {
    MutableGraph<Integer> directedGraph = GraphBuilder.directed().allowsSelfLoops(false).build();
    directedGraph.putEdge(N1, N2);
    directedGraph.putEdge(N1, N3);
    directedGraph.putEdge(N2, N3);
    directedGraph.addNode(N4);

    MutableGraph<Integer> expectedClosure = GraphBuilder.directed().allowsSelfLoops(true).build();
    expectedClosure.putEdge(N1, N1);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 70

                  MutableGraph<Integer> directedGraph = GraphBuilder.directed().allowsSelfLoops(false).build();
    directedGraph.putEdge(N1, N2);
    directedGraph.putEdge(N1, N3);
    directedGraph.putEdge(N2, N3);
    directedGraph.addNode(N4);

    MutableGraph<Integer> expectedClosure = GraphBuilder.directed().allowsSelfLoops(true).build();
    expectedClosure.putEdge(N1, N1);
    expectedClosure.putEdge(N1, N2);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 71

                  directedGraph.putEdge(N1, N2);
    directedGraph.putEdge(N1, N3);
    directedGraph.putEdge(N2, N3);
    directedGraph.addNode(N4);

    MutableGraph<Integer> expectedClosure = GraphBuilder.directed().allowsSelfLoops(true).build();
    expectedClosure.putEdge(N1, N1);
    expectedClosure.putEdge(N1, N2);
    expectedClosure.putEdge(N1, N3);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 73

                  directedGraph.putEdge(N2, N3);
    directedGraph.addNode(N4);

    MutableGraph<Integer> expectedClosure = GraphBuilder.directed().allowsSelfLoops(true).build();
    expectedClosure.putEdge(N1, N1);
    expectedClosure.putEdge(N1, N2);
    expectedClosure.putEdge(N1, N3);
    expectedClosure.putEdge(N2, N2);
    expectedClosure.putEdge(N2, N3);

            

Reported by PMD.

guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java
385 issues
This class has too many methods, consider refactoring it.
Design

Line: 53

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ImmutableListMultimapTest extends TestCase {
  public static class ImmutableListMultimapGenerator extends TestStringListMultimapGenerator {
    @Override
    protected ListMultimap<String, String> create(Entry<String, String>[] entries) {
      ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
      for (Entry<String, String> entry : entries) {

            

Reported by PMD.

Possible God Class (WMC=50, ATFD=41, TCC=0.000%)
Design

Line: 53

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ImmutableListMultimapTest extends TestCase {
  public static class ImmutableListMultimapGenerator extends TestStringListMultimapGenerator {
    @Override
    protected ListMultimap<String, String> create(Entry<String, String>[] entries) {
      ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
      for (Entry<String, String> entry : entries) {

            

Reported by PMD.

JUnit 4 indicates test suites via annotations, not the suite method.
Design

Line: 73

                  }
  }

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(
        ListMultimapTestSuiteBuilder.using(new ImmutableListMultimapGenerator())
            .named("ImmutableListMultimap")

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 90

                  return suite;
  }

  public void testBuilder_withImmutableEntry() {
    ImmutableListMultimap<String, Integer> multimap =
        new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).build();
    assertEquals(Arrays.asList(1), multimap.get("one"));
  }


            

Reported by PMD.

The String literal 'one' appears 19 times in this file; the first occurrence is on line 92
Error

Line: 92

              
  public void testBuilder_withImmutableEntry() {
    ImmutableListMultimap<String, Integer> multimap =
        new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).build();
    assertEquals(Arrays.asList(1), multimap.get("one"));
  }

  public void testBuilder_withImmutableEntryAndNullContents() {
    Builder<String, Integer> builder = new Builder<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 93

                public void testBuilder_withImmutableEntry() {
    ImmutableListMultimap<String, Integer> multimap =
        new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).build();
    assertEquals(Arrays.asList(1), multimap.get("one"));
  }

  public void testBuilder_withImmutableEntryAndNullContents() {
    Builder<String, Integer> builder = new Builder<>();
    try {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 96

                  assertEquals(Arrays.asList(1), multimap.get("one"));
  }

  public void testBuilder_withImmutableEntryAndNullContents() {
    Builder<String, Integer> builder = new Builder<>();
    try {
      builder.put(Maps.immutableEntry("one", (Integer) null));
      fail();
    } catch (NullPointerException expected) {

            

Reported by PMD.

In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 100

                  Builder<String, Integer> builder = new Builder<>();
    try {
      builder.put(Maps.immutableEntry("one", (Integer) null));
      fail();
    } catch (NullPointerException expected) {
    }
    try {
      builder.put(Maps.immutableEntry((String) null, 1));
      fail();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 100

                  Builder<String, Integer> builder = new Builder<>();
    try {
      builder.put(Maps.immutableEntry("one", (Integer) null));
      fail();
    } catch (NullPointerException expected) {
    }
    try {
      builder.put(Maps.immutableEntry((String) null, 1));
      fail();

            

Reported by PMD.

Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 101

                  try {
      builder.put(Maps.immutableEntry("one", (Integer) null));
      fail();
    } catch (NullPointerException expected) {
    }
    try {
      builder.put(Maps.immutableEntry((String) null, 1));
      fail();
    } catch (NullPointerException expected) {

            

Reported by PMD.

guava-tests/test/com/google/common/collect/SetsTest.java
384 issues
Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 571

              
  public void testNewIdentityHashSet() {
    Set<Integer> set = Sets.newIdentityHashSet();
    Integer value1 = new Integer(12357);
    Integer value2 = new Integer(12357);
    assertTrue(set.add(value1));
    assertFalse(set.contains(value2));
    assertTrue(set.contains(value1));
    assertTrue(set.add(value2));

            

Reported by PMD.

Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 572

                public void testNewIdentityHashSet() {
    Set<Integer> set = Sets.newIdentityHashSet();
    Integer value1 = new Integer(12357);
    Integer value2 = new Integer(12357);
    assertTrue(set.add(value1));
    assertFalse(set.contains(value2));
    assertTrue(set.contains(value1));
    assertTrue(set.add(value2));
    assertEquals(2, set.size());

            

Reported by PMD.

A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.collect.Iterables.unmodifiableIterable;
import static com.google.common.collect.Sets.newEnumSet;
import static com.google.common.collect.Sets.newHashSet;
import static com.google.common.collect.Sets.newLinkedHashSet;

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.collect.Iterables.unmodifiableIterable;
import static com.google.common.collect.Sets.newEnumSet;
import static com.google.common.collect.Sets.newHashSet;
import static com.google.common.collect.Sets.newLinkedHashSet;

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 89

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

Avoid really long classes.
Design

Line: 89

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

The class 'SetsTest' has a Modified Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 89

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

Possible God Class (WMC=130, ATFD=117, TCC=1.300%)
Design

Line: 89

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

The class 'SetsTest' has a total cyclomatic complexity of 130 (highest 8).
Design

Line: 89

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

The class 'SetsTest' has a Standard Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 89

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

guava-tests/test/com/google/common/math/StatsAccumulatorTest.java
381 issues
A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.math;

import static com.google.common.math.StatsTesting.ALLOWED_ERROR;
import static com.google.common.math.StatsTesting.ALL_MANY_VALUES;
import static com.google.common.math.StatsTesting.INTEGER_MANY_VALUES;
import static com.google.common.math.StatsTesting.INTEGER_MANY_VALUES_COUNT;

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 71

               *
 * @author Pete Gillin
 */
public class StatsAccumulatorTest extends TestCase {

  private StatsAccumulator emptyAccumulator;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;

            

Reported by PMD.

The class 'StatsAccumulatorTest' has a Modified Cyclomatic Complexity of 4 (Highest = 10).
Design

Line: 71

               *
 * @author Pete Gillin
 */
public class StatsAccumulatorTest extends TestCase {

  private StatsAccumulator emptyAccumulator;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;

            

Reported by PMD.

The class 'StatsAccumulatorTest' has a Standard Cyclomatic Complexity of 4 (Highest = 10).
Design

Line: 71

               *
 * @author Pete Gillin
 */
public class StatsAccumulatorTest extends TestCase {

  private StatsAccumulator emptyAccumulator;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;

            

Reported by PMD.

Too many fields
Design

Line: 71

               *
 * @author Pete Gillin
 */
public class StatsAccumulatorTest extends TestCase {

  private StatsAccumulator emptyAccumulator;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 73

               */
public class StatsAccumulatorTest extends TestCase {

  private StatsAccumulator emptyAccumulator;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;
  private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
  private StatsAccumulator twoValuesAccumulator;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 74

              public class StatsAccumulatorTest extends TestCase {

  private StatsAccumulator emptyAccumulator;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;
  private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
  private StatsAccumulator twoValuesAccumulator;
  private StatsAccumulator twoValuesAccumulatorByAddAllStats;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 75

              
  private StatsAccumulator emptyAccumulator;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;
  private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
  private StatsAccumulator twoValuesAccumulator;
  private StatsAccumulator twoValuesAccumulatorByAddAllStats;
  private StatsAccumulator manyValuesAccumulatorByAddAllIterable;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 76

                private StatsAccumulator emptyAccumulator;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;
  private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
  private StatsAccumulator twoValuesAccumulator;
  private StatsAccumulator twoValuesAccumulatorByAddAllStats;
  private StatsAccumulator manyValuesAccumulatorByAddAllIterable;
  private StatsAccumulator manyValuesAccumulatorByAddAllIterator;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 77

                private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
  private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
  private StatsAccumulator oneValueAccumulator;
  private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
  private StatsAccumulator twoValuesAccumulator;
  private StatsAccumulator twoValuesAccumulatorByAddAllStats;
  private StatsAccumulator manyValuesAccumulatorByAddAllIterable;
  private StatsAccumulator manyValuesAccumulatorByAddAllIterator;
  private StatsAccumulator manyValuesAccumulatorByAddAllVarargs;

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/SetsTest.java
375 issues
Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 559

              
  public void testNewIdentityHashSet() {
    Set<Integer> set = Sets.newIdentityHashSet();
    Integer value1 = new Integer(12357);
    Integer value2 = new Integer(12357);
    assertTrue(set.add(value1));
    assertFalse(set.contains(value2));
    assertTrue(set.contains(value1));
    assertTrue(set.add(value2));

            

Reported by PMD.

Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 560

                public void testNewIdentityHashSet() {
    Set<Integer> set = Sets.newIdentityHashSet();
    Integer value1 = new Integer(12357);
    Integer value2 = new Integer(12357);
    assertTrue(set.add(value1));
    assertFalse(set.contains(value2));
    assertTrue(set.contains(value1));
    assertTrue(set.add(value2));
    assertEquals(2, set.size());

            

Reported by PMD.

A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.collect.Iterables.unmodifiableIterable;
import static com.google.common.collect.Sets.newEnumSet;
import static com.google.common.collect.Sets.newHashSet;
import static com.google.common.collect.Sets.newLinkedHashSet;

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.collect.Iterables.unmodifiableIterable;
import static com.google.common.collect.Sets.newEnumSet;
import static com.google.common.collect.Sets.newHashSet;
import static com.google.common.collect.Sets.newLinkedHashSet;

            

Reported by PMD.

Possible God Class (WMC=128, ATFD=113, TCC=1.352%)
Design

Line: 88

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

The class 'SetsTest' has a Modified Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 88

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

The class 'SetsTest' has a Standard Cyclomatic Complexity of 2 (Highest = 10).
Design

Line: 88

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

The class 'SetsTest' has a total cyclomatic complexity of 128 (highest 8).
Design

Line: 88

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 88

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

Avoid really long classes.
Design

Line: 88

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class SetsTest extends TestCase {

  private static final IteratorTester.KnownOrder KNOWN_ORDER =
      IteratorTester.KnownOrder.KNOWN_ORDER;

  private static final Collection<Integer> EMPTY_COLLECTION = Arrays.<Integer>asList();

            

Reported by PMD.

guava-tests/test/com/google/common/base/CharMatcherTest.java
371 issues
Possible God Class (WMC=70, ATFD=14, TCC=0.000%)
Design

Line: 46

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class CharMatcherTest extends TestCase {

  @GwtIncompatible // NullPointerTester
  public void testStaticNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CharMatcher.class);

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 46

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class CharMatcherTest extends TestCase {

  @GwtIncompatible // NullPointerTester
  public void testStaticNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CharMatcher.class);

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 48

              @GwtCompatible(emulated = true)
public class CharMatcherTest extends TestCase {

  @GwtIncompatible // NullPointerTester
  public void testStaticNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CharMatcher.class);
    tester.testAllPublicInstanceMethods(CharMatcher.any());
    tester.testAllPublicInstanceMethods(CharMatcher.anyOf("abc"));

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 49

              public class CharMatcherTest extends TestCase {

  @GwtIncompatible // NullPointerTester
  public void testStaticNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CharMatcher.class);
    tester.testAllPublicInstanceMethods(CharMatcher.any());
    tester.testAllPublicInstanceMethods(CharMatcher.anyOf("abc"));
  }

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 64

                      }
      };

  public void testAnyAndNone_logicalOps() throws Exception {
    // These are testing behavior that's never promised by the API, but since
    // we're lucky enough that these do pass, it saves us from having to write
    // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 64

                      }
      };

  public void testAnyAndNone_logicalOps() throws Exception {
    // These are testing behavior that's never promised by the API, but since
    // we're lucky enough that these do pass, it saves us from having to write
    // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 69

                  // we're lucky enough that these do pass, it saves us from having to write
    // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());
    assertSame(CharMatcher.none(), CharMatcher.any().negate());

    assertSame(WHATEVER, CharMatcher.any().and(WHATEVER));
    assertSame(CharMatcher.any(), CharMatcher.any().or(WHATEVER));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 69

                  // we're lucky enough that these do pass, it saves us from having to write
    // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());
    assertSame(CharMatcher.none(), CharMatcher.any().negate());

    assertSame(WHATEVER, CharMatcher.any().and(WHATEVER));
    assertSame(CharMatcher.any(), CharMatcher.any().or(WHATEVER));


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 70

                  // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());
    assertSame(CharMatcher.none(), CharMatcher.any().negate());

    assertSame(WHATEVER, CharMatcher.any().and(WHATEVER));
    assertSame(CharMatcher.any(), CharMatcher.any().or(WHATEVER));

    assertSame(CharMatcher.none(), CharMatcher.none().and(WHATEVER));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 70

                  // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());
    assertSame(CharMatcher.none(), CharMatcher.any().negate());

    assertSame(WHATEVER, CharMatcher.any().and(WHATEVER));
    assertSame(CharMatcher.any(), CharMatcher.any().or(WHATEVER));

    assertSame(CharMatcher.none(), CharMatcher.none().and(WHATEVER));

            

Reported by PMD.

android/guava-tests/test/com/google/common/base/CharMatcherTest.java
371 issues
This class has too many methods, consider refactoring it.
Design

Line: 46

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class CharMatcherTest extends TestCase {

  @GwtIncompatible // NullPointerTester
  public void testStaticNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CharMatcher.class);

            

Reported by PMD.

Possible God Class (WMC=70, ATFD=14, TCC=0.000%)
Design

Line: 46

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class CharMatcherTest extends TestCase {

  @GwtIncompatible // NullPointerTester
  public void testStaticNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CharMatcher.class);

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 48

              @GwtCompatible(emulated = true)
public class CharMatcherTest extends TestCase {

  @GwtIncompatible // NullPointerTester
  public void testStaticNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CharMatcher.class);
    tester.testAllPublicInstanceMethods(CharMatcher.any());
    tester.testAllPublicInstanceMethods(CharMatcher.anyOf("abc"));

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 49

              public class CharMatcherTest extends TestCase {

  @GwtIncompatible // NullPointerTester
  public void testStaticNullPointers() throws Exception {
    NullPointerTester tester = new NullPointerTester();
    tester.testAllPublicStaticMethods(CharMatcher.class);
    tester.testAllPublicInstanceMethods(CharMatcher.any());
    tester.testAllPublicInstanceMethods(CharMatcher.anyOf("abc"));
  }

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 64

                      }
      };

  public void testAnyAndNone_logicalOps() throws Exception {
    // These are testing behavior that's never promised by the API, but since
    // we're lucky enough that these do pass, it saves us from having to write
    // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 64

                      }
      };

  public void testAnyAndNone_logicalOps() throws Exception {
    // These are testing behavior that's never promised by the API, but since
    // we're lucky enough that these do pass, it saves us from having to write
    // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 69

                  // we're lucky enough that these do pass, it saves us from having to write
    // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());
    assertSame(CharMatcher.none(), CharMatcher.any().negate());

    assertSame(WHATEVER, CharMatcher.any().and(WHATEVER));
    assertSame(CharMatcher.any(), CharMatcher.any().or(WHATEVER));


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 69

                  // we're lucky enough that these do pass, it saves us from having to write
    // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());
    assertSame(CharMatcher.none(), CharMatcher.any().negate());

    assertSame(WHATEVER, CharMatcher.any().and(WHATEVER));
    assertSame(CharMatcher.any(), CharMatcher.any().or(WHATEVER));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 70

                  // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());
    assertSame(CharMatcher.none(), CharMatcher.any().negate());

    assertSame(WHATEVER, CharMatcher.any().and(WHATEVER));
    assertSame(CharMatcher.any(), CharMatcher.any().or(WHATEVER));

    assertSame(CharMatcher.none(), CharMatcher.none().and(WHATEVER));

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 70

                  // more excruciating tests! Hooray!

    assertSame(CharMatcher.any(), CharMatcher.none().negate());
    assertSame(CharMatcher.none(), CharMatcher.any().negate());

    assertSame(WHATEVER, CharMatcher.any().and(WHATEVER));
    assertSame(CharMatcher.any(), CharMatcher.any().or(WHATEVER));

    assertSame(CharMatcher.none(), CharMatcher.none().and(WHATEVER));

            

Reported by PMD.

android/guava-tests/test/com/google/common/cache/CacheBuilderGwtTest.java
356 issues
This class has too many methods, consider refactoring it.
Design

Line: 41

               * @author Jon Donovan
 */
@GwtCompatible
public class CacheBuilderGwtTest extends TestCase {

  private FakeTicker fakeTicker;

  @Override
  protected void setUp() throws Exception {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 43

              @GwtCompatible
public class CacheBuilderGwtTest extends TestCase {

  private FakeTicker fakeTicker;

  @Override
  protected void setUp() throws Exception {
    super.setUp();


            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 45

              
  private FakeTicker fakeTicker;

  @Override
  protected void setUp() throws Exception {
    super.setUp();

    fakeTicker = new FakeTicker();
  }

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 52

                  fakeTicker = new FakeTicker();
  }

  public void testLoader() throws ExecutionException {

    final Cache<Integer, Integer> cache = CacheBuilder.newBuilder().build();

    Callable<Integer> loader =
        new Callable<Integer>() {

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 52

                  fakeTicker = new FakeTicker();
  }

  public void testLoader() throws ExecutionException {

    final Cache<Integer, Integer> cache = CacheBuilder.newBuilder().build();

    Callable<Integer> loader =
        new Callable<Integer>() {

            

Reported by PMD.

Avoid using redundant field initializer for 'i'
Performance

Line: 58

              
    Callable<Integer> loader =
        new Callable<Integer>() {
          private int i = 0;

          @Override
          public Integer call() throws Exception {
            return ++i;
          }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 66

                        }
        };

    cache.put(0, 10);

    assertEquals(Integer.valueOf(10), cache.get(0, loader));
    assertEquals(Integer.valueOf(1), cache.get(20, loader));
    assertEquals(Integer.valueOf(2), cache.get(34, loader));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 68

              
    cache.put(0, 10);

    assertEquals(Integer.valueOf(10), cache.get(0, loader));
    assertEquals(Integer.valueOf(1), cache.get(20, loader));
    assertEquals(Integer.valueOf(2), cache.get(34, loader));

    cache.invalidate(0);
    assertEquals(Integer.valueOf(3), cache.get(0, loader));

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 68

              
    cache.put(0, 10);

    assertEquals(Integer.valueOf(10), cache.get(0, loader));
    assertEquals(Integer.valueOf(1), cache.get(20, loader));
    assertEquals(Integer.valueOf(2), cache.get(34, loader));

    cache.invalidate(0);
    assertEquals(Integer.valueOf(3), cache.get(0, loader));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 69

                  cache.put(0, 10);

    assertEquals(Integer.valueOf(10), cache.get(0, loader));
    assertEquals(Integer.valueOf(1), cache.get(20, loader));
    assertEquals(Integer.valueOf(2), cache.get(34, loader));

    cache.invalidate(0);
    assertEquals(Integer.valueOf(3), cache.get(0, loader));


            

Reported by PMD.

guava-tests/test/com/google/common/cache/CacheBuilderGwtTest.java
356 issues
This class has too many methods, consider refactoring it.
Design

Line: 41

               * @author Jon Donovan
 */
@GwtCompatible
public class CacheBuilderGwtTest extends TestCase {

  private FakeTicker fakeTicker;

  @Override
  protected void setUp() throws Exception {

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 43

              @GwtCompatible
public class CacheBuilderGwtTest extends TestCase {

  private FakeTicker fakeTicker;

  @Override
  protected void setUp() throws Exception {
    super.setUp();


            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 45

              
  private FakeTicker fakeTicker;

  @Override
  protected void setUp() throws Exception {
    super.setUp();

    fakeTicker = new FakeTicker();
  }

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 52

                  fakeTicker = new FakeTicker();
  }

  public void testLoader() throws ExecutionException {

    final Cache<Integer, Integer> cache = CacheBuilder.newBuilder().build();

    Callable<Integer> loader =
        new Callable<Integer>() {

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 52

                  fakeTicker = new FakeTicker();
  }

  public void testLoader() throws ExecutionException {

    final Cache<Integer, Integer> cache = CacheBuilder.newBuilder().build();

    Callable<Integer> loader =
        new Callable<Integer>() {

            

Reported by PMD.

Avoid using redundant field initializer for 'i'
Performance

Line: 58

              
    Callable<Integer> loader =
        new Callable<Integer>() {
          private int i = 0;

          @Override
          public Integer call() throws Exception {
            return ++i;
          }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 66

                        }
        };

    cache.put(0, 10);

    assertEquals(Integer.valueOf(10), cache.get(0, loader));
    assertEquals(Integer.valueOf(1), cache.get(20, loader));
    assertEquals(Integer.valueOf(2), cache.get(34, loader));


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 68

              
    cache.put(0, 10);

    assertEquals(Integer.valueOf(10), cache.get(0, loader));
    assertEquals(Integer.valueOf(1), cache.get(20, loader));
    assertEquals(Integer.valueOf(2), cache.get(34, loader));

    cache.invalidate(0);
    assertEquals(Integer.valueOf(3), cache.get(0, loader));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 68

              
    cache.put(0, 10);

    assertEquals(Integer.valueOf(10), cache.get(0, loader));
    assertEquals(Integer.valueOf(1), cache.get(20, loader));
    assertEquals(Integer.valueOf(2), cache.get(34, loader));

    cache.invalidate(0);
    assertEquals(Integer.valueOf(3), cache.get(0, loader));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 69

                  cache.put(0, 10);

    assertEquals(Integer.valueOf(10), cache.get(0, loader));
    assertEquals(Integer.valueOf(1), cache.get(20, loader));
    assertEquals(Integer.valueOf(2), cache.get(34, loader));

    cache.invalidate(0);
    assertEquals(Integer.valueOf(3), cache.get(0, loader));


            

Reported by PMD.