The following issues were found

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

Line: 78

                private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {
      return delegate;
    }

            

Reported by PMD.

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

Line: 45

               */
public class SynchronizedMultimapTest extends TestCase {

  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(SynchronizedMultimapTest.class);
    suite.addTest(
        SetMultimapTestSuiteBuilder.using(
                new TestStringSetMultimapGenerator() {

            

Reported by PMD.

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

Line: 76

                }

  private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {

            

Reported by PMD.

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

Line: 77

              
  private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {
      return delegate;

            

Reported by PMD.

Field delegate has the same name as a method
Error

Line: 77

              
  private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {
      return delegate;

            

Reported by PMD.

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

Line: 78

                private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {
      return delegate;
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 87

              
    @Override
    public String toString() {
      assertTrue(Thread.holdsLock(mutex));
      return super.toString();
    }

    @Override
    public boolean equals(@NullableDecl Object o) {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 93

              
    @Override
    public boolean equals(@NullableDecl Object o) {
      assertTrue(Thread.holdsLock(mutex));
      return super.equals(o);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 99

              
    @Override
    public int hashCode() {
      assertTrue(Thread.holdsLock(mutex));
      return super.hashCode();
    }

    @Override
    public int size() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 105

              
    @Override
    public int size() {
      assertTrue(Thread.holdsLock(mutex));
      return super.size();
    }

    @Override
    public boolean isEmpty() {

            

Reported by PMD.

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

Line: 34

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public abstract class AbstractTableReadTest extends TestCase {
  protected Table<String, Integer, Character> table;

  /**
   * Creates a table with the specified data.
   *

            

Reported by PMD.

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

Line: 35

               */
@GwtCompatible(emulated = true)
public abstract class AbstractTableReadTest extends TestCase {
  protected Table<String, Integer, Character> table;

  /**
   * Creates a table with the specified data.
   *
   * @param data the table data, repeating the sequence row key, column key, value once per mapping

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

                protected abstract Table<String, Integer, Character> create(Object... data);

  protected void assertSize(int expectedSize) {
    assertEquals(expectedSize, table.size());
  }

  @Override
  public 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: 50

                  assertEquals(expectedSize, table.size());
  }

  @Override
  public void setUp() throws Exception {
    super.setUp();
    table = create();
  }


            

Reported by PMD.

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

Line: 56

                  table = create();
  }

  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));

            

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: 56

                  table = create();
  }

  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));

            

Reported by PMD.

The String literal 'bar' appears 29 times in this file; the first occurrence is on line 57
Error

Line: 57

                }

  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));
    assertFalse(table.contains("bar", 3));

            

Reported by PMD.

The String literal 'foo' appears 50 times in this file; the first occurrence is on line 57
Error

Line: 57

                }

  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));
    assertFalse(table.contains("bar", 3));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 58

              
  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));
    assertFalse(table.contains("bar", 3));
    assertFalse(table.contains("cat", 1));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 59

                public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));
    assertFalse(table.contains("bar", 3));
    assertFalse(table.contains("cat", 1));
    assertFalse(table.contains("foo", null));

            

Reported by PMD.

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

Line: 34

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public abstract class AbstractTableReadTest extends TestCase {
  protected Table<String, Integer, Character> table;

  /**
   * Creates a table with the specified data.
   *

            

Reported by PMD.

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

Line: 35

               */
@GwtCompatible(emulated = true)
public abstract class AbstractTableReadTest extends TestCase {
  protected Table<String, Integer, Character> table;

  /**
   * Creates a table with the specified data.
   *
   * @param data the table data, repeating the sequence row key, column key, value once per mapping

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

                protected abstract Table<String, Integer, Character> create(Object... data);

  protected void assertSize(int expectedSize) {
    assertEquals(expectedSize, table.size());
  }

  @Override
  public 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: 50

                  assertEquals(expectedSize, table.size());
  }

  @Override
  public void setUp() throws Exception {
    super.setUp();
    table = create();
  }


            

Reported by PMD.

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

Line: 56

                  table = create();
  }

  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));

            

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: 56

                  table = create();
  }

  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));

            

Reported by PMD.

The String literal 'foo' appears 50 times in this file; the first occurrence is on line 57
Error

Line: 57

                }

  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));
    assertFalse(table.contains("bar", 3));

            

Reported by PMD.

The String literal 'bar' appears 29 times in this file; the first occurrence is on line 57
Error

Line: 57

                }

  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));
    assertFalse(table.contains("bar", 3));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 58

              
  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));
    assertFalse(table.contains("bar", 3));
    assertFalse(table.contains("cat", 1));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 59

                public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertFalse(table.contains("foo", 2));
    assertFalse(table.contains("bar", 3));
    assertFalse(table.contains("cat", 1));
    assertFalse(table.contains("foo", null));

            

Reported by PMD.

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

Line: 78

                private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {
      return delegate;
    }

            

Reported by PMD.

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

Line: 45

               */
public class SynchronizedMultimapTest extends TestCase {

  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(SynchronizedMultimapTest.class);
    suite.addTest(
        SetMultimapTestSuiteBuilder.using(
                new TestStringSetMultimapGenerator() {

            

Reported by PMD.

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

Line: 76

                }

  private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {

            

Reported by PMD.

Field delegate has the same name as a method
Error

Line: 77

              
  private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {
      return delegate;

            

Reported by PMD.

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

Line: 77

              
  private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {
      return delegate;

            

Reported by PMD.

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

Line: 78

                private static final class TestMultimap<K, V> extends ForwardingSetMultimap<K, V>
      implements Serializable {
    final SetMultimap<K, V> delegate = HashMultimap.create();
    public final Object mutex = new Integer(1); // something Serializable

    @Override
    protected SetMultimap<K, V> delegate() {
      return delegate;
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 87

              
    @Override
    public String toString() {
      assertTrue(Thread.holdsLock(mutex));
      return super.toString();
    }

    @Override
    public boolean equals(@Nullable Object o) {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 93

              
    @Override
    public boolean equals(@Nullable Object o) {
      assertTrue(Thread.holdsLock(mutex));
      return super.equals(o);
    }

    @Override
    public int hashCode() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 99

              
    @Override
    public int hashCode() {
      assertTrue(Thread.holdsLock(mutex));
      return super.hashCode();
    }

    @Override
    public int size() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 105

              
    @Override
    public int size() {
      assertTrue(Thread.holdsLock(mutex));
      return super.size();
    }

    @Override
    public boolean isEmpty() {

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java
75 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 39

                  }
  }

  public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

                }

  public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

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: 50

                          .result());
  }

  public void testDegenerate() {
    // kinda bogus, but who cares?
    assertEquals(0, ComparisonChain.start().result());
  }

  public void testOneEqual() {

            

Reported by PMD.

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

Line: 52

              
  public void testDegenerate() {
    // kinda bogus, but who cares?
    assertEquals(0, ComparisonChain.start().result());
  }

  public void testOneEqual() {
    assertEquals(0, ComparisonChain.start().compare("a", "a").result());
  }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

              
  public void testDegenerate() {
    // kinda bogus, but who cares?
    assertEquals(0, ComparisonChain.start().result());
  }

  public void testOneEqual() {
    assertEquals(0, ComparisonChain.start().compare("a", "a").result());
  }

            

Reported by PMD.

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

Line: 43

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

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(

            

Reported by PMD.

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

Line: 45

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

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(
        ListMultimapTestSuiteBuilder.using(
                new TestStringListMultimapGenerator() {

            

Reported by PMD.

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

Line: 80

                }

  /** Confirm that get() returns a List implementing RandomAccess. */
  public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);

            

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: 80

                }

  /** Confirm that get() returns a List implementing RandomAccess. */
  public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);

            

Reported by PMD.

The String literal 'foo' appears 18 times in this file; the first occurrence is on line 82
Error

Line: 82

                /** Confirm that get() returns a List implementing RandomAccess. */
  public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }


            

Reported by PMD.

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

Line: 82

                /** Confirm that get() returns a List implementing RandomAccess. */
  public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }


            

Reported by PMD.

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

Line: 83

                public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }

  /** Confirm that removeAll() returns a List implementing RandomAccess. */

            

Reported by PMD.

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

Line: 84

                  Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }

  /** Confirm that removeAll() returns a List implementing RandomAccess. */
  public void testRemoveAllRandomAccess() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 84

                  Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }

  /** Confirm that removeAll() returns a List implementing RandomAccess. */
  public void testRemoveAllRandomAccess() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 85

                  multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }

  /** Confirm that removeAll() returns a List implementing RandomAccess. */
  public void testRemoveAllRandomAccess() {
    Multimap<String, Integer> multimap = create();

            

Reported by PMD.

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

Line: 43

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

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(

            

Reported by PMD.

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

Line: 45

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

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(
        ListMultimapTestSuiteBuilder.using(
                new TestStringListMultimapGenerator() {

            

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: 80

                }

  /** Confirm that get() returns a List implementing RandomAccess. */
  public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);

            

Reported by PMD.

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

Line: 80

                }

  /** Confirm that get() returns a List implementing RandomAccess. */
  public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);

            

Reported by PMD.

The String literal 'foo' appears 18 times in this file; the first occurrence is on line 82
Error

Line: 82

                /** Confirm that get() returns a List implementing RandomAccess. */
  public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }


            

Reported by PMD.

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

Line: 82

                /** Confirm that get() returns a List implementing RandomAccess. */
  public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }


            

Reported by PMD.

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

Line: 83

                public void testGetRandomAccess() {
    Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }

  /** Confirm that removeAll() returns a List implementing RandomAccess. */

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 84

                  Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }

  /** Confirm that removeAll() returns a List implementing RandomAccess. */
  public void testRemoveAllRandomAccess() {

            

Reported by PMD.

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

Line: 84

                  Multimap<String, Integer> multimap = create();
    multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }

  /** Confirm that removeAll() returns a List implementing RandomAccess. */
  public void testRemoveAllRandomAccess() {

            

Reported by PMD.

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

Line: 85

                  multimap.put("foo", 1);
    multimap.put("foo", 3);
    assertTrue(multimap.get("foo") instanceof RandomAccess);
    assertTrue(multimap.get("bar") instanceof RandomAccess);
  }

  /** Confirm that removeAll() returns a List implementing RandomAccess. */
  public void testRemoveAllRandomAccess() {
    Multimap<String, Integer> multimap = create();

            

Reported by PMD.

guava-tests/test/com/google/common/eventbus/EventBusTest.java
75 issues
Avoid throwing raw exception types.
Design

Line: 149

                          new SubscriberExceptionHandler() {
              @Override
              public void handleException(Throwable exception, SubscriberExceptionContext context) {
                throw new RuntimeException();
              }
            });
    final Object subscriber =
        new Object() {
          @Subscribe

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 156

                      new Object() {
          @Subscribe
          public void throwExceptionOn(String message) {
            throw new RuntimeException();
          }
        };
    eventBus.register(subscriber);
    try {
      eventBus.post(EVENT);

            

Reported by PMD.

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

Line: 93

              
    // Two additional event types: Object and Comparable<?> (played by Integer)
    Object objEvent = new Object();
    Object compEvent = new Integer(6);

    bus.post(EVENT);
    bus.post(objEvent);
    bus.post(compEvent);


            

Reported by PMD.

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

Line: 33

               *
 * @author Cliff Biffle
 */
public class EventBusTest extends TestCase {
  private static final String EVENT = "Hello";
  private static final String BUS_IDENTIFIER = "test-bus";

  private EventBus bus;


            

Reported by PMD.

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

Line: 37

                private static final String EVENT = "Hello";
  private static final String BUS_IDENTIFIER = "test-bus";

  private EventBus bus;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    bus = new EventBus(BUS_IDENTIFIER);

            

Reported by PMD.

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

Line: 39

              
  private EventBus bus;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    bus = new EventBus(BUS_IDENTIFIER);
  }


            

Reported by PMD.

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

Line: 45

                  bus = new EventBus(BUS_IDENTIFIER);
  }

  public void testBasicCatcherDistribution() {
    StringCatcher catcher = new StringCatcher();
    bus.register(catcher);
    bus.post(EVENT);

    List<String> events = catcher.getEvents();

            

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: 45

                  bus = new EventBus(BUS_IDENTIFIER);
  }

  public void testBasicCatcherDistribution() {
    StringCatcher catcher = new StringCatcher();
    bus.register(catcher);
    bus.post(EVENT);

    List<String> events = catcher.getEvents();

            

Reported by PMD.

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

Line: 51

                  bus.post(EVENT);

    List<String> events = catcher.getEvents();
    assertEquals("Only one event should be delivered.", 1, events.size());
    assertEquals("Correct string should be delivered.", EVENT, events.get(0));
  }

  /**
   * Tests that events are distributed to any subscribers to their type or any supertype, including

            

Reported by PMD.

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

Line: 52

              
    List<String> events = catcher.getEvents();
    assertEquals("Only one event should be delivered.", 1, events.size());
    assertEquals("Correct string should be delivered.", EVENT, events.get(0));
  }

  /**
   * Tests that events are distributed to any subscribers to their type or any supertype, including
   * interfaces and superclasses.

            

Reported by PMD.

guava-tests/test/com/google/common/collect/ComparisonChainTest.java
75 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 39

                  }
  }

  public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

                }

  public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

Reported by PMD.

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

Line: 42

                public void testCompareBooleans() {
    assertEquals(
        0,
        ComparisonChain.start()
            .compare(true, true)
            .compare(true, Boolean.TRUE)
            .compare(Boolean.TRUE, true)
            .compare(Boolean.TRUE, Boolean.TRUE)
            .result());

            

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: 50

                          .result());
  }

  public void testDegenerate() {
    // kinda bogus, but who cares?
    assertEquals(0, ComparisonChain.start().result());
  }

  public void testOneEqual() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

              
  public void testDegenerate() {
    // kinda bogus, but who cares?
    assertEquals(0, ComparisonChain.start().result());
  }

  public void testOneEqual() {
    assertEquals(0, ComparisonChain.start().compare("a", "a").result());
  }

            

Reported by PMD.

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

Line: 52

              
  public void testDegenerate() {
    // kinda bogus, but who cares?
    assertEquals(0, ComparisonChain.start().result());
  }

  public void testOneEqual() {
    assertEquals(0, ComparisonChain.start().compare("a", "a").result());
  }

            

Reported by PMD.

android/guava-tests/test/com/google/common/eventbus/EventBusTest.java
75 issues
Avoid throwing raw exception types.
Design

Line: 149

                          new SubscriberExceptionHandler() {
              @Override
              public void handleException(Throwable exception, SubscriberExceptionContext context) {
                throw new RuntimeException();
              }
            });
    final Object subscriber =
        new Object() {
          @Subscribe

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 156

                      new Object() {
          @Subscribe
          public void throwExceptionOn(String message) {
            throw new RuntimeException();
          }
        };
    eventBus.register(subscriber);
    try {
      eventBus.post(EVENT);

            

Reported by PMD.

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

Line: 93

              
    // Two additional event types: Object and Comparable<?> (played by Integer)
    Object objEvent = new Object();
    Object compEvent = new Integer(6);

    bus.post(EVENT);
    bus.post(objEvent);
    bus.post(compEvent);


            

Reported by PMD.

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

Line: 33

               *
 * @author Cliff Biffle
 */
public class EventBusTest extends TestCase {
  private static final String EVENT = "Hello";
  private static final String BUS_IDENTIFIER = "test-bus";

  private EventBus bus;


            

Reported by PMD.

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

Line: 37

                private static final String EVENT = "Hello";
  private static final String BUS_IDENTIFIER = "test-bus";

  private EventBus bus;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    bus = new EventBus(BUS_IDENTIFIER);

            

Reported by PMD.

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

Line: 39

              
  private EventBus bus;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    bus = new EventBus(BUS_IDENTIFIER);
  }


            

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: 45

                  bus = new EventBus(BUS_IDENTIFIER);
  }

  public void testBasicCatcherDistribution() {
    StringCatcher catcher = new StringCatcher();
    bus.register(catcher);
    bus.post(EVENT);

    List<String> events = catcher.getEvents();

            

Reported by PMD.

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

Line: 45

                  bus = new EventBus(BUS_IDENTIFIER);
  }

  public void testBasicCatcherDistribution() {
    StringCatcher catcher = new StringCatcher();
    bus.register(catcher);
    bus.post(EVENT);

    List<String> events = catcher.getEvents();

            

Reported by PMD.

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

Line: 51

                  bus.post(EVENT);

    List<String> events = catcher.getEvents();
    assertEquals("Only one event should be delivered.", 1, events.size());
    assertEquals("Correct string should be delivered.", EVENT, events.get(0));
  }

  /**
   * Tests that events are distributed to any subscribers to their type or any supertype, including

            

Reported by PMD.

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

Line: 52

              
    List<String> events = catcher.getEvents();
    assertEquals("Only one event should be delivered.", 1, events.size());
    assertEquals("Correct string should be delivered.", EVENT, events.get(0));
  }

  /**
   * Tests that events are distributed to any subscribers to their type or any supertype, including
   * interfaces and superclasses.

            

Reported by PMD.