The following issues were found

guava-testlib/test/com/google/common/testing/AbstractPackageSanityTestsTest.java
38 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 48

                 */
  public static final class ConcretePackageSanityTests extends AbstractPackageSanityTests {}

  private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests();

  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();

            

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

              
  private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests();

  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

            

Reported by PMD.

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

Line: 50

              
  private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests();

  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

            

Reported by PMD.

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

Line: 51

                private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests();

  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }


            

Reported by PMD.

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

Line: 52

              
  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {

            

Reported by PMD.

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

Line: 53

                public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);

            

Reported by PMD.

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

Line: 54

                  assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);
    assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.class)))

            

Reported by PMD.

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

Line: 57

                  assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);
    assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.class)))
        .containsExactly(Foo.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: 57

                  assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);
    assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.class)))
        .containsExactly(Foo.class);
  }


            

Reported by PMD.

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

Line: 58

                }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);
    assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.class)))
        .containsExactly(Foo.class);
  }

  public void testFindClassesToTest_publicApiOnly() {

            

Reported by PMD.

guava-tests/test/com/google/common/collect/HashMultimapTest.java
38 issues
JUnit 4 indicates test suites via annotations, not the suite method.
Design

Line: 39

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

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

            

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

                 * The behavior of toString() is tested by TreeMultimap, which shares a
   * lot of code with HashMultimap and has deterministic iteration order.
   */
  public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));

            

Reported by PMD.

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

Line: 73

                 * The behavior of toString() is tested by TreeMultimap, which shares a
   * lot of code with HashMultimap and has deterministic iteration order.
   */
  public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));

            

Reported by PMD.

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

Line: 75

                 */
  public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

            

Reported by PMD.

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

Line: 75

                 */
  public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

            

Reported by PMD.

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

Line: 76

                public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }


            

Reported by PMD.

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

Line: 77

                  HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

  public void testCreateFromMultimap() {

            

Reported by PMD.

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

Line: 78

                  multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

  public void testCreateFromMultimap() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 78

                  multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

  public void testCreateFromMultimap() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 79

                  multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

  public void testCreateFromMultimap() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);

            

Reported by PMD.

android/guava-testlib/test/com/google/common/testing/AbstractPackageSanityTestsTest.java
38 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 48

                 */
  public static final class ConcretePackageSanityTests extends AbstractPackageSanityTests {}

  private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests();

  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();

            

Reported by PMD.

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

Line: 50

              
  private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests();

  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

            

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

              
  private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests();

  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

            

Reported by PMD.

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

Line: 51

                private final AbstractPackageSanityTests sanityTests = new ConcretePackageSanityTests();

  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }


            

Reported by PMD.

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

Line: 52

              
  public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {

            

Reported by PMD.

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

Line: 53

                public void testFindClassesToTest_testClass() {
    assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);

            

Reported by PMD.

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

Line: 54

                  assertThat(findClassesToTest(ImmutableList.of(EmptyTest.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTests.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestCase.class))).isEmpty();
    assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);
    assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.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: 57

                  assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);
    assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.class)))
        .containsExactly(Foo.class);
  }


            

Reported by PMD.

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

Line: 57

                  assertThat(findClassesToTest(ImmutableList.of(EmptyTestSuite.class))).isEmpty();
  }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);
    assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.class)))
        .containsExactly(Foo.class);
  }


            

Reported by PMD.

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

Line: 58

                }

  public void testFindClassesToTest_noCorrespondingTestClass() {
    assertThat(findClassesToTest(ImmutableList.of(Foo.class))).containsExactly(Foo.class);
    assertThat(findClassesToTest(ImmutableList.of(Foo.class, Foo2Test.class)))
        .containsExactly(Foo.class);
  }

  public void testFindClassesToTest_publicApiOnly() {

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/HashMultimapTest.java
38 issues
JUnit 4 indicates test suites via annotations, not the suite method.
Design

Line: 39

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

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

            

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

                 * The behavior of toString() is tested by TreeMultimap, which shares a
   * lot of code with HashMultimap and has deterministic iteration order.
   */
  public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));

            

Reported by PMD.

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

Line: 73

                 * The behavior of toString() is tested by TreeMultimap, which shares a
   * lot of code with HashMultimap and has deterministic iteration order.
   */
  public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));

            

Reported by PMD.

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

Line: 75

                 */
  public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

            

Reported by PMD.

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

Line: 75

                 */
  public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

            

Reported by PMD.

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

Line: 76

                public void testCreate() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }


            

Reported by PMD.

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

Line: 77

                  HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

  public void testCreateFromMultimap() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 78

                  multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

  public void testCreateFromMultimap() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();

            

Reported by PMD.

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

Line: 78

                  multimap.put("foo", 1);
    multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

  public void testCreateFromMultimap() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 79

                  multimap.put("bar", 2);
    multimap.put("foo", 3);
    assertEquals(ImmutableSet.of(1, 3), multimap.get("foo"));
    assertEquals(2, multimap.expectedValuesPerKey);
  }

  public void testCreateFromMultimap() {
    HashMultimap<String, Integer> multimap = HashMultimap.create();
    multimap.put("foo", 1);

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java
38 issues
This class has too many methods, consider refactoring it.
Design

Line: 40

               */
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ConcurrentMapReplaceEntryTester<K, V> extends AbstractMapTester<K, V> {
  @Override
  protected ConcurrentMap<K, V> getMap() {
    return (ConcurrentMap<K, V>) super.getMap();
  }


            

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

                  return (ConcurrentMap<K, V>) super.getMap();
  }

  @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplaceEntry_supportedPresent() {
    assertTrue(getMap().replace(k0(), v0(), v3()));
    expectReplacement(entry(k0(), v3()));
  }

            

Reported by PMD.

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

Line: 49

                @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplaceEntry_supportedPresent() {
    assertTrue(getMap().replace(k0(), v0(), v3()));
    expectReplacement(entry(k0(), v3()));
  }

  @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)

            

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

                  expectReplacement(entry(k0(), v3()));
  }

  @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplaceEntry_supportedPresentUnchanged() {
    assertTrue(getMap().replace(k0(), v0(), v0()));
    expectUnchanged();
  }

            

Reported by PMD.

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

Line: 56

                @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplaceEntry_supportedPresentUnchanged() {
    assertTrue(getMap().replace(k0(), v0(), v0()));
    expectUnchanged();
  }

  @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)

            

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

                  expectUnchanged();
  }

  @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplaceEntry_supportedWrongValue() {
    assertFalse(getMap().replace(k0(), v3(), v4()));
    expectUnchanged();
  }

            

Reported by PMD.

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

Line: 63

                @MapFeature.Require(SUPPORTS_PUT)
  @CollectionSize.Require(absent = ZERO)
  public void testReplaceEntry_supportedWrongValue() {
    assertFalse(getMap().replace(k0(), v3(), v4()));
    expectUnchanged();
  }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testReplaceEntry_supportedAbsentKey() {

            

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

                  expectUnchanged();
  }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testReplaceEntry_supportedAbsentKey() {
    assertFalse(getMap().replace(k3(), v3(), v4()));
    expectUnchanged();
  }


            

Reported by PMD.

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

Line: 69

              
  @MapFeature.Require(SUPPORTS_PUT)
  public void testReplaceEntry_supportedAbsentKey() {
    assertFalse(getMap().replace(k3(), v3(), v4()));
    expectUnchanged();
  }

  @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
  @CollectionSize.Require(absent = ZERO)

            

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

                  expectUnchanged();
  }

  @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
  @CollectionSize.Require(absent = ZERO)
  public void testReplaceEntry_presentNullValueUnsupported() {
    try {
      getMap().replace(k0(), v0(), null);
      fail("Expected NullPointerException");

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/google/MultisetReadsTester.java
37 issues
This class has too many methods, consider refactoring it.
Design

Line: 37

               */
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetReadsTester<E> extends AbstractMultisetTester<E> {

  @CollectionSize.Require(absent = ZERO)
  public void testElementSet_contains() {
    assertTrue(
        "multiset.elementSet().contains(present) returned false",

            

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

              @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetReadsTester<E> extends AbstractMultisetTester<E> {

  @CollectionSize.Require(absent = ZERO)
  public void testElementSet_contains() {
    assertTrue(
        "multiset.elementSet().contains(present) returned false",
        getMultiset().elementSet().contains(e0()));
  }

            

Reported by PMD.

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

Line: 43

                public void testElementSet_contains() {
    assertTrue(
        "multiset.elementSet().contains(present) returned false",
        getMultiset().elementSet().contains(e0()));
  }

  @CollectionSize.Require(absent = ZERO)
  public void testEntrySet_contains() {
    assertTrue(

            

Reported by PMD.

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

Line: 43

                public void testElementSet_contains() {
    assertTrue(
        "multiset.elementSet().contains(present) returned false",
        getMultiset().elementSet().contains(e0()));
  }

  @CollectionSize.Require(absent = ZERO)
  public void testEntrySet_contains() {
    assertTrue(

            

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

                      getMultiset().elementSet().contains(e0()));
  }

  @CollectionSize.Require(absent = ZERO)
  public void testEntrySet_contains() {
    assertTrue(
        "multiset.entrySet() didn't contain [present, 1]",
        getMultiset().entrySet().contains(Multisets.immutableEntry(e0(), 1)));
  }

            

Reported by PMD.

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

Line: 50

                public void testEntrySet_contains() {
    assertTrue(
        "multiset.entrySet() didn't contain [present, 1]",
        getMultiset().entrySet().contains(Multisets.immutableEntry(e0(), 1)));
  }

  public void testEntrySet_contains_count0() {
    assertFalse(
        "multiset.entrySet() contains [missing, 0]",

            

Reported by PMD.

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

Line: 50

                public void testEntrySet_contains() {
    assertTrue(
        "multiset.entrySet() didn't contain [present, 1]",
        getMultiset().entrySet().contains(Multisets.immutableEntry(e0(), 1)));
  }

  public void testEntrySet_contains_count0() {
    assertFalse(
        "multiset.entrySet() contains [missing, 0]",

            

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

                      getMultiset().entrySet().contains(Multisets.immutableEntry(e0(), 1)));
  }

  public void testEntrySet_contains_count0() {
    assertFalse(
        "multiset.entrySet() contains [missing, 0]",
        getMultiset().entrySet().contains(Multisets.immutableEntry(e3(), 0)));
  }


            

Reported by PMD.

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

Line: 56

                public void testEntrySet_contains_count0() {
    assertFalse(
        "multiset.entrySet() contains [missing, 0]",
        getMultiset().entrySet().contains(Multisets.immutableEntry(e3(), 0)));
  }

  public void testEntrySet_contains_nonentry() {
    assertFalse(
        "multiset.entrySet() contains a non-entry", getMultiset().entrySet().contains(e0()));

            

Reported by PMD.

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

Line: 56

                public void testEntrySet_contains_count0() {
    assertFalse(
        "multiset.entrySet() contains [missing, 0]",
        getMultiset().entrySet().contains(Multisets.immutableEntry(e3(), 0)));
  }

  public void testEntrySet_contains_nonentry() {
    assertFalse(
        "multiset.entrySet() contains a non-entry", getMultiset().entrySet().contains(e0()));

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java
37 issues
This class has too many methods, consider refactoring it.
Design

Line: 40

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>>
    extends AbstractContainerTester<M, Entry<K, V>> {

  private M multimap;

  protected M multimap() {
    return multimap;

            

Reported by PMD.

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

Line: 42

              public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>>
    extends AbstractContainerTester<M, Entry<K, V>> {

  private M multimap;

  protected M multimap() {
    return multimap;
  }


            

Reported by PMD.

Field multimap has the same name as a method
Error

Line: 42

              public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>>
    extends AbstractContainerTester<M, Entry<K, V>> {

  private M multimap;

  protected M multimap() {
    return multimap;
  }


            

Reported by PMD.

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

Line: 53

                  Entry<K, V>[] array = createSamplesArray();
    final int nullKeyLocation = getNullLocation();
    final Entry<K, V> oldEntry = array[nullKeyLocation];
    array[nullKeyLocation] = Helpers.mapEntry(null, oldEntry.getValue());
    return array;
  }

  /** @return an array of the proper size with {@code null} as the value of the middle element. */
  protected Entry<K, V>[] createArrayWithNullValue() {

            

Reported by PMD.

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

Line: 62

                  Entry<K, V>[] array = createSamplesArray();
    final int nullValueLocation = getNullLocation();
    final Entry<K, V> oldEntry = array[nullValueLocation];
    array[nullValueLocation] = Helpers.mapEntry(oldEntry.getKey(), null);
    return array;
  }

  /**
   * @return an array of the proper size with {@code null} as the key and value of the middle

            

Reported by PMD.

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

Line: 78

                }

  protected V getValueForNullKey() {
    return getEntryNullReplaces().getValue();
  }

  protected K getKeyForNullValue() {
    return getEntryNullReplaces().getKey();
  }

            

Reported by PMD.

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

Line: 82

                }

  protected K getKeyForNullValue() {
    return getEntryNullReplaces().getKey();
  }

  private Entry<K, V> getEntryNullReplaces() {
    Iterator<Entry<K, V>> entries = getSampleElements().iterator();
    for (int i = 0; i < getNullLocation(); i++) {

            

Reported by PMD.

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

Line: 86

                }

  private Entry<K, V> getEntryNullReplaces() {
    Iterator<Entry<K, V>> entries = getSampleElements().iterator();
    for (int i = 0; i < getNullLocation(); i++) {
      entries.next();
    }
    return entries.next();
  }

            

Reported by PMD.

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

Line: 107

              
  protected SampleElements<K> sampleKeys() {
    return ((TestMultimapGenerator<K, V, ? extends Multimap<K, V>>)
            getSubjectGenerator().getInnerGenerator())
        .sampleKeys();
  }

  protected SampleElements<V> sampleValues() {
    return ((TestMultimapGenerator<K, V, ? extends Multimap<K, V>>)

            

Reported by PMD.

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

Line: 113

              
  protected SampleElements<V> sampleValues() {
    return ((TestMultimapGenerator<K, V, ? extends Multimap<K, V>>)
            getSubjectGenerator().getInnerGenerator())
        .sampleValues();
  }

  @Override
  protected Collection<Entry<K, V>> actualContents() {

            

Reported by PMD.

android/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java
37 issues
Avoid throwing raw exception types.
Design

Line: 42

                    new ListenerCallQueue.Event<Object>() {
        @Override
        public void call(Object object) {
          throw new RuntimeException();
        }

        @Override
        public String toString() {
          return "throwing()";

            

Reported by PMD.

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

Line: 36

              import junit.framework.TestCase;

/** Tests for {@link ListenerCallQueue}. */
public class ListenerCallQueueTest extends TestCase {

  private static final ListenerCallQueue.Event<Object> THROWING_EVENT =
      new ListenerCallQueue.Event<Object>() {
        @Override
        public void call(Object object) {

            

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

                      }
      };

  public void testEnqueueAndDispatch() {
    Object listener = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();
    queue.addListener(listener, directExecutor());

    Multiset<Object> counters = ConcurrentHashMultiset.create();

            

Reported by PMD.

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

Line: 51

                      }
      };

  public void testEnqueueAndDispatch() {
    Object listener = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();
    queue.addListener(listener, directExecutor());

    Multiset<Object> counters = ConcurrentHashMultiset.create();

            

Reported by PMD.

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

Line: 61

                  queue.enqueue(incrementingEvent(counters, listener, 2));
    queue.enqueue(incrementingEvent(counters, listener, 3));
    queue.enqueue(incrementingEvent(counters, listener, 4));
    assertEquals(0, counters.size());
    queue.dispatch();
    assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 61

                  queue.enqueue(incrementingEvent(counters, listener, 2));
    queue.enqueue(incrementingEvent(counters, listener, 3));
    queue.enqueue(incrementingEvent(counters, listener, 4));
    assertEquals(0, counters.size());
    queue.dispatch();
    assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 63

                  queue.enqueue(incrementingEvent(counters, listener, 4));
    assertEquals(0, counters.size());
    queue.dispatch();
    assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {
    Object listener1 = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();

            

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

                  assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {
    Object listener1 = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();
    queue.addListener(listener1, directExecutor());

    Multiset<Object> counters = ConcurrentHashMultiset.create();

            

Reported by PMD.

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

Line: 66

                  assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {
    Object listener1 = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();
    queue.addListener(listener1, directExecutor());

    Multiset<Object> counters = ConcurrentHashMultiset.create();

            

Reported by PMD.

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

Line: 79

                  queue.addListener(listener2, directExecutor());
    queue.enqueue(incrementingEvent(counters, multiset(listener1, 3, listener2, 1)));
    queue.enqueue(incrementingEvent(counters, multiset(listener1, 4, listener2, 2)));
    assertEquals(0, counters.size());
    queue.dispatch();
    assertEquals(multiset(listener1, 4, listener2, 2), counters);
  }

  public void testEnqueueAndDispatch_withExceptions() {

            

Reported by PMD.

guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java
37 issues
This class has too many methods, consider refactoring it.
Design

Line: 40

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>>
    extends AbstractContainerTester<M, Entry<K, V>> {

  private M multimap;

  protected M multimap() {
    return multimap;

            

Reported by PMD.

Field multimap has the same name as a method
Error

Line: 42

              public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>>
    extends AbstractContainerTester<M, Entry<K, V>> {

  private M multimap;

  protected M multimap() {
    return multimap;
  }


            

Reported by PMD.

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

Line: 42

              public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>>
    extends AbstractContainerTester<M, Entry<K, V>> {

  private M multimap;

  protected M multimap() {
    return multimap;
  }


            

Reported by PMD.

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

Line: 53

                  Entry<K, V>[] array = createSamplesArray();
    final int nullKeyLocation = getNullLocation();
    final Entry<K, V> oldEntry = array[nullKeyLocation];
    array[nullKeyLocation] = Helpers.mapEntry(null, oldEntry.getValue());
    return array;
  }

  /** @return an array of the proper size with {@code null} as the value of the middle element. */
  protected Entry<K, V>[] createArrayWithNullValue() {

            

Reported by PMD.

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

Line: 62

                  Entry<K, V>[] array = createSamplesArray();
    final int nullValueLocation = getNullLocation();
    final Entry<K, V> oldEntry = array[nullValueLocation];
    array[nullValueLocation] = Helpers.mapEntry(oldEntry.getKey(), null);
    return array;
  }

  /**
   * @return an array of the proper size with {@code null} as the key and value of the middle

            

Reported by PMD.

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

Line: 78

                }

  protected V getValueForNullKey() {
    return getEntryNullReplaces().getValue();
  }

  protected K getKeyForNullValue() {
    return getEntryNullReplaces().getKey();
  }

            

Reported by PMD.

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

Line: 82

                }

  protected K getKeyForNullValue() {
    return getEntryNullReplaces().getKey();
  }

  private Entry<K, V> getEntryNullReplaces() {
    Iterator<Entry<K, V>> entries = getSampleElements().iterator();
    for (int i = 0; i < getNullLocation(); i++) {

            

Reported by PMD.

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

Line: 86

                }

  private Entry<K, V> getEntryNullReplaces() {
    Iterator<Entry<K, V>> entries = getSampleElements().iterator();
    for (int i = 0; i < getNullLocation(); i++) {
      entries.next();
    }
    return entries.next();
  }

            

Reported by PMD.

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

Line: 107

              
  protected SampleElements<K> sampleKeys() {
    return ((TestMultimapGenerator<K, V, ? extends Multimap<K, V>>)
            getSubjectGenerator().getInnerGenerator())
        .sampleKeys();
  }

  protected SampleElements<V> sampleValues() {
    return ((TestMultimapGenerator<K, V, ? extends Multimap<K, V>>)

            

Reported by PMD.

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

Line: 113

              
  protected SampleElements<V> sampleValues() {
    return ((TestMultimapGenerator<K, V, ? extends Multimap<K, V>>)
            getSubjectGenerator().getInnerGenerator())
        .sampleValues();
  }

  @Override
  protected Collection<Entry<K, V>> actualContents() {

            

Reported by PMD.

guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java
37 issues
Avoid throwing raw exception types.
Design

Line: 42

                    new ListenerCallQueue.Event<Object>() {
        @Override
        public void call(Object object) {
          throw new RuntimeException();
        }

        @Override
        public String toString() {
          return "throwing()";

            

Reported by PMD.

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

Line: 36

              import junit.framework.TestCase;

/** Tests for {@link ListenerCallQueue}. */
public class ListenerCallQueueTest extends TestCase {

  private static final ListenerCallQueue.Event<Object> THROWING_EVENT =
      new ListenerCallQueue.Event<Object>() {
        @Override
        public void call(Object object) {

            

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

                      }
      };

  public void testEnqueueAndDispatch() {
    Object listener = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();
    queue.addListener(listener, directExecutor());

    Multiset<Object> counters = ConcurrentHashMultiset.create();

            

Reported by PMD.

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

Line: 51

                      }
      };

  public void testEnqueueAndDispatch() {
    Object listener = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();
    queue.addListener(listener, directExecutor());

    Multiset<Object> counters = ConcurrentHashMultiset.create();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 61

                  queue.enqueue(incrementingEvent(counters, listener, 2));
    queue.enqueue(incrementingEvent(counters, listener, 3));
    queue.enqueue(incrementingEvent(counters, listener, 4));
    assertEquals(0, counters.size());
    queue.dispatch();
    assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {

            

Reported by PMD.

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

Line: 61

                  queue.enqueue(incrementingEvent(counters, listener, 2));
    queue.enqueue(incrementingEvent(counters, listener, 3));
    queue.enqueue(incrementingEvent(counters, listener, 4));
    assertEquals(0, counters.size());
    queue.dispatch();
    assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 63

                  queue.enqueue(incrementingEvent(counters, listener, 4));
    assertEquals(0, counters.size());
    queue.dispatch();
    assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {
    Object listener1 = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();

            

Reported by PMD.

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

Line: 66

                  assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {
    Object listener1 = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();
    queue.addListener(listener1, directExecutor());

    Multiset<Object> counters = ConcurrentHashMultiset.create();

            

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

                  assertEquals(multiset(listener, 4), counters);
  }

  public void testEnqueueAndDispatch_multipleListeners() {
    Object listener1 = new Object();
    ListenerCallQueue<Object> queue = new ListenerCallQueue<>();
    queue.addListener(listener1, directExecutor());

    Multiset<Object> counters = ConcurrentHashMultiset.create();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 79

                  queue.addListener(listener2, directExecutor());
    queue.enqueue(incrementingEvent(counters, multiset(listener1, 3, listener2, 1)));
    queue.enqueue(incrementingEvent(counters, multiset(listener1, 4, listener2, 2)));
    assertEquals(0, counters.size());
    queue.dispatch();
    assertEquals(multiset(listener1, 4, listener2, 2), counters);
  }

  public void testEnqueueAndDispatch_withExceptions() {

            

Reported by PMD.