The following issues were found

guava-tests/test/com/google/common/collect/AbstractRangeSetTest.java
20 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: 30

               */
@GwtIncompatible // TreeRangeSet
public abstract class AbstractRangeSetTest extends TestCase {
  public static void testInvariants(RangeSet<?> rangeSet) {
    testInvariantsInternal(rangeSet);
    testInvariantsInternal(rangeSet.complement());
  }

  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {

            

Reported by PMD.

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

Line: 35

                  testInvariantsInternal(rangeSet.complement());
  }

  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());


            

Reported by PMD.

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

Line: 36

                }

  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 36

                }

  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

            

Reported by PMD.

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

Line: 37

              
  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

              
  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());


            

Reported by PMD.

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

Line: 38

                private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

    // test that connected ranges are coalesced

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 38

                private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

    // test that connected ranges are coalesced

            

Reported by PMD.

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

Line: 38

                private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

    // test that connected ranges are coalesced

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

                  assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

    // test that connected ranges are coalesced
    for (int i = 0; i + 1 < asRanges.size(); i++) {

            

Reported by PMD.

guava-tests/test/com/google/common/net/HostSpecifierTest.java
20 issues
Do not hard code the IP address
Design

Line: 38

              public final class HostSpecifierTest extends TestCase {

  private static final ImmutableList<String> GOOD_IPS =
      ImmutableList.of("1.2.3.4", "2001:db8::1", "[2001:db8::1]");

  private static final ImmutableList<String> BAD_IPS =
      ImmutableList.of("1.2.3", "2001:db8::1::::::0", "[2001:db8::1", "[::]:80");

  private static final ImmutableList<String> GOOD_DOMAINS =

            

Reported by PMD.

Do not hard code the IP address
Design

Line: 38

              public final class HostSpecifierTest extends TestCase {

  private static final ImmutableList<String> GOOD_IPS =
      ImmutableList.of("1.2.3.4", "2001:db8::1", "[2001:db8::1]");

  private static final ImmutableList<String> BAD_IPS =
      ImmutableList.of("1.2.3", "2001:db8::1::::::0", "[2001:db8::1", "[::]:80");

  private static final ImmutableList<String> GOOD_DOMAINS =

            

Reported by PMD.

The String literal 'google.com' appears 4 times in this file; the first occurrence is on line 44
Error

Line: 44

                    ImmutableList.of("1.2.3", "2001:db8::1::::::0", "[2001:db8::1", "[::]:80");

  private static final ImmutableList<String> GOOD_DOMAINS =
      ImmutableList.of("com", "google.com", "foo.co.uk");

  private static final ImmutableList<String> BAD_DOMAINS =
      ImmutableList.of("foo.blah", "", "[google.com]");

  public void testGoodIpAddresses() throws ParseException {

            

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

                private static final ImmutableList<String> BAD_DOMAINS =
      ImmutableList.of("foo.blah", "", "[google.com]");

  public void testGoodIpAddresses() throws ParseException {
    for (String spec : GOOD_IPS) {
      assertGood(spec);
    }
  }


            

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

                  }
  }

  public void testBadIpAddresses() {
    for (String spec : BAD_IPS) {
      assertBad(spec);
    }
  }


            

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

                  }
  }

  public void testGoodDomains() throws ParseException {
    for (String spec : GOOD_DOMAINS) {
      assertGood(spec);
    }
  }


            

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

                  }
  }

  public void testBadDomains() {
    for (String spec : BAD_DOMAINS) {
      assertBad(spec);
    }
  }


            

Reported by PMD.

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

Line: 73

                  }
  }

  public void testEquality() {
    new EqualsTester()
        .addEqualityGroup(spec("1.2.3.4"), spec("1.2.3.4"))
        .addEqualityGroup(spec("2001:db8::1"), spec("2001:db8::1"), spec("[2001:db8::1]"))
        .addEqualityGroup(spec("2001:db8::2"))
        .addEqualityGroup(spec("google.com"), spec("google.com"))

            

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

                  }
  }

  public void testEquality() {
    new EqualsTester()
        .addEqualityGroup(spec("1.2.3.4"), spec("1.2.3.4"))
        .addEqualityGroup(spec("2001:db8::1"), spec("2001:db8::1"), spec("[2001:db8::1]"))
        .addEqualityGroup(spec("2001:db8::2"))
        .addEqualityGroup(spec("google.com"), spec("google.com"))

            

Reported by PMD.

Do not hard code the IP address
Design

Line: 75

              
  public void testEquality() {
    new EqualsTester()
        .addEqualityGroup(spec("1.2.3.4"), spec("1.2.3.4"))
        .addEqualityGroup(spec("2001:db8::1"), spec("2001:db8::1"), spec("[2001:db8::1]"))
        .addEqualityGroup(spec("2001:db8::2"))
        .addEqualityGroup(spec("google.com"), spec("google.com"))
        .addEqualityGroup(spec("www.google.com"))
        .testEquals();

            

Reported by PMD.

guava-tests/test/com/google/common/net/UrlEscapersTest.java
20 issues
Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 46

                  try {
      e.escape((String) null);
      fail("Escaping null string should throw exception");
    } catch (NullPointerException x) {
      // pass
    }

    // All URL escapers should leave 0-9, A-Z, a-z unescaped
    assertUnescaped(e, 'a');

            

Reported by PMD.

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

Line: 46

                  try {
      e.escape((String) null);
      fail("Escaping null string should throw exception");
    } catch (NullPointerException x) {
      // pass
    }

    // All URL escapers should leave 0-9, A-Z, a-z unescaped
    assertUnescaped(e, 'a');

            

Reported by PMD.

Avoid empty catch blocks
Error

Line: 46

                  try {
      e.escape((String) null);
      fail("Escaping null string should throw exception");
    } catch (NullPointerException x) {
      // pass
    }

    // All URL escapers should leave 0-9, A-Z, a-z unescaped
    assertUnescaped(e, 'a');

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 73

                  assertUnicodeEscaping(e, "%F0%90%80%80", '\uD800', '\uDC00');
    assertUnicodeEscaping(e, "%F4%8F%BF%BF", '\uDBFF', '\uDFFF');

    assertEquals("", e.escape(""));
    assertEquals("safestring", e.escape("safestring"));
    assertEquals("embedded%00null", e.escape("embedded\0null"));
    assertEquals("max%EF%BF%BFchar", e.escape("max\uffffchar"));
  }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 74

                  assertUnicodeEscaping(e, "%F4%8F%BF%BF", '\uDBFF', '\uDFFF');

    assertEquals("", e.escape(""));
    assertEquals("safestring", e.escape("safestring"));
    assertEquals("embedded%00null", e.escape("embedded\0null"));
    assertEquals("max%EF%BF%BFchar", e.escape("max\uffffchar"));
  }

  // Helper to assert common expected behaviour of uri escapers.

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 75

              
    assertEquals("", e.escape(""));
    assertEquals("safestring", e.escape("safestring"));
    assertEquals("embedded%00null", e.escape("embedded\0null"));
    assertEquals("max%EF%BF%BFchar", e.escape("max\uffffchar"));
  }

  // Helper to assert common expected behaviour of uri escapers.
  static void assertBasicUrlEscaper(UnicodeEscaper e) {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 76

                  assertEquals("", e.escape(""));
    assertEquals("safestring", e.escape("safestring"));
    assertEquals("embedded%00null", e.escape("embedded\0null"));
    assertEquals("max%EF%BF%BFchar", e.escape("max\uffffchar"));
  }

  // Helper to assert common expected behaviour of uri escapers.
  static void assertBasicUrlEscaper(UnicodeEscaper e) {
    assertBasicUrlEscaperExceptPercent(e);

            

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

                  assertEscaping(e, "%25", '%');
  }

  public void testUrlFormParameterEscaper() {
    UnicodeEscaper e = (UnicodeEscaper) urlFormParameterEscaper();
    // Verify that these are the same escaper (as documented)
    assertSame(e, urlFormParameterEscaper());
    assertBasicUrlEscaper(e);


            

Reported by PMD.

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

Line: 86

                  assertEscaping(e, "%25", '%');
  }

  public void testUrlFormParameterEscaper() {
    UnicodeEscaper e = (UnicodeEscaper) urlFormParameterEscaper();
    // Verify that these are the same escaper (as documented)
    assertSame(e, urlFormParameterEscaper());
    assertBasicUrlEscaper(e);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 89

                public void testUrlFormParameterEscaper() {
    UnicodeEscaper e = (UnicodeEscaper) urlFormParameterEscaper();
    // Verify that these are the same escaper (as documented)
    assertSame(e, urlFormParameterEscaper());
    assertBasicUrlEscaper(e);

    /*
     * Specified as safe by RFC 2396 but not by java.net.URLEncoder. These tests will start failing
     * when the escaper is made compliant with RFC 2396, but that's a good thing (just change them

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/AbstractRangeSetTest.java
20 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: 30

               */
@GwtIncompatible // TreeRangeSet
public abstract class AbstractRangeSetTest extends TestCase {
  public static void testInvariants(RangeSet<?> rangeSet) {
    testInvariantsInternal(rangeSet);
    testInvariantsInternal(rangeSet.complement());
  }

  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {

            

Reported by PMD.

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

Line: 35

                  testInvariantsInternal(rangeSet.complement());
  }

  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());


            

Reported by PMD.

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

Line: 36

                }

  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 36

                }

  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

            

Reported by PMD.

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

Line: 37

              
  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

              
  private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());


            

Reported by PMD.

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

Line: 38

                private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

    // test that connected ranges are coalesced

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 38

                private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

    // test that connected ranges are coalesced

            

Reported by PMD.

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

Line: 38

                private static <C extends Comparable> void testInvariantsInternal(RangeSet<C> rangeSet) {
    assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

    // test that connected ranges are coalesced

            

Reported by PMD.

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

Line: 39

                  assertEquals(rangeSet.asRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(rangeSet.asDescendingSetOfRanges().isEmpty(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asRanges().iterator().hasNext(), rangeSet.isEmpty());
    assertEquals(!rangeSet.asDescendingSetOfRanges().iterator().hasNext(), rangeSet.isEmpty());

    List<Range<C>> asRanges = ImmutableList.copyOf(rangeSet.asRanges());

    // test that connected ranges are coalesced
    for (int i = 0; i + 1 < asRanges.size(); i++) {

            

Reported by PMD.

android/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java
20 issues
JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 32

              
  static boolean testWasRun;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    testWasRun = 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: 40

              
  @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
  public static final class MyAbstractTester extends AbstractTester<Void> {
    public void testNothing() {
      testWasRun = true;
    }
  }

  private static final class MyTestSuiteBuilder

            

Reported by PMD.

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

Line: 40

              
  @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
  public static final class MyAbstractTester extends AbstractTester<Void> {
    public void testNothing() {
      testWasRun = true;
    }
  }

  private static final class MyTestSuiteBuilder

            

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

                  }
  }

  public void testLifecycle() {
    final boolean setUp[] = {false};
    Runnable setUpRunnable =
        new Runnable() {
          @Override
          public void run() {

            

Reported by PMD.

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

Line: 54

                  }
  }

  public void testLifecycle() {
    final boolean setUp[] = {false};
    Runnable setUpRunnable =
        new Runnable() {
          @Override
          public void run() {

            

Reported by PMD.

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

Line: 75

              
    MyTestSuiteBuilder builder = new MyTestSuiteBuilder();
    Test test =
        builder
            .usingGenerator("yam")
            .named("yam")
            .withFeatures(CollectionFeature.NONE)
            .withSetUp(setUpRunnable)
            .withTearDown(tearDownRunnable)

            

Reported by PMD.

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

Line: 75

              
    MyTestSuiteBuilder builder = new MyTestSuiteBuilder();
    Test test =
        builder
            .usingGenerator("yam")
            .named("yam")
            .withFeatures(CollectionFeature.NONE)
            .withSetUp(setUpRunnable)
            .withTearDown(tearDownRunnable)

            

Reported by PMD.

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

Line: 75

              
    MyTestSuiteBuilder builder = new MyTestSuiteBuilder();
    Test test =
        builder
            .usingGenerator("yam")
            .named("yam")
            .withFeatures(CollectionFeature.NONE)
            .withSetUp(setUpRunnable)
            .withTearDown(tearDownRunnable)

            

Reported by PMD.

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

Line: 75

              
    MyTestSuiteBuilder builder = new MyTestSuiteBuilder();
    Test test =
        builder
            .usingGenerator("yam")
            .named("yam")
            .withFeatures(CollectionFeature.NONE)
            .withSetUp(setUpRunnable)
            .withTearDown(tearDownRunnable)

            

Reported by PMD.

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

Line: 75

              
    MyTestSuiteBuilder builder = new MyTestSuiteBuilder();
    Test test =
        builder
            .usingGenerator("yam")
            .named("yam")
            .withFeatures(CollectionFeature.NONE)
            .withSetUp(setUpRunnable)
            .withTearDown(tearDownRunnable)

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java
20 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: 40

              @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapContainsEntryTester<K, V>
    extends AbstractMultimapTester<K, V, Multimap<K, V>> {
  @CollectionSize.Require(absent = ZERO)
  public void testContainsEntryYes() {
    assertTrue(multimap().containsEntry(k0(), v0()));
  }

  public void testContainsEntryNo() {

            

Reported by PMD.

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

Line: 42

                  extends AbstractMultimapTester<K, V, Multimap<K, V>> {
  @CollectionSize.Require(absent = ZERO)
  public void testContainsEntryYes() {
    assertTrue(multimap().containsEntry(k0(), v0()));
  }

  public void testContainsEntryNo() {
    assertFalse(multimap().containsEntry(k3(), v3()));
  }

            

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

                  assertTrue(multimap().containsEntry(k0(), v0()));
  }

  public void testContainsEntryNo() {
    assertFalse(multimap().containsEntry(k3(), v3()));
  }

  public void testContainsEntryAgreesWithGet() {
    for (K k : sampleKeys()) {

            

Reported by PMD.

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

Line: 46

                }

  public void testContainsEntryNo() {
    assertFalse(multimap().containsEntry(k3(), v3()));
  }

  public void testContainsEntryAgreesWithGet() {
    for (K k : sampleKeys()) {
      for (V v : sampleValues()) {

            

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

                  assertFalse(multimap().containsEntry(k3(), v3()));
  }

  public void testContainsEntryAgreesWithGet() {
    for (K k : sampleKeys()) {
      for (V v : sampleValues()) {
        assertEquals(multimap().get(k).contains(v), multimap().containsEntry(k, v));
      }
    }

            

Reported by PMD.

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

Line: 52

                public void testContainsEntryAgreesWithGet() {
    for (K k : sampleKeys()) {
      for (V v : sampleValues()) {
        assertEquals(multimap().get(k).contains(v), multimap().containsEntry(k, v));
      }
    }
  }

  @CollectionSize.Require(absent = ZERO)

            

Reported by PMD.

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

Line: 52

                public void testContainsEntryAgreesWithGet() {
    for (K k : sampleKeys()) {
      for (V v : sampleValues()) {
        assertEquals(multimap().get(k).contains(v), multimap().containsEntry(k, v));
      }
    }
  }

  @CollectionSize.Require(absent = ZERO)

            

Reported by PMD.

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

Line: 52

                public void testContainsEntryAgreesWithGet() {
    for (K k : sampleKeys()) {
      for (V v : sampleValues()) {
        assertEquals(multimap().get(k).contains(v), multimap().containsEntry(k, v));
      }
    }
  }

  @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: 57

                  }
  }

  @CollectionSize.Require(absent = ZERO)
  @MapFeature.Require({ALLOWS_NULL_KEYS, ALLOWS_NULL_VALUES})
  public void testContainsEntryNullYes() {
    initMultimapWithNullKeyAndValue();
    assertTrue(multimap().containsEntry(null, null));
  }

            

Reported by PMD.

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

Line: 61

                @MapFeature.Require({ALLOWS_NULL_KEYS, ALLOWS_NULL_VALUES})
  public void testContainsEntryNullYes() {
    initMultimapWithNullKeyAndValue();
    assertTrue(multimap().containsEntry(null, null));
  }

  @MapFeature.Require({ALLOWS_NULL_KEY_QUERIES, ALLOWS_NULL_VALUE_QUERIES})
  public void testContainsEntryNullNo() {
    assertFalse(multimap().containsEntry(null, null));

            

Reported by PMD.

android/guava-tests/test/com/google/common/io/ByteSinkTest.java
19 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 37

               */
public class ByteSinkTest extends IoTestCase {

  private final byte[] bytes = newPreFilledByteArray(10000);

  private TestByteSink sink;

  @Override
  protected void setUp() throws Exception {

            

Reported by PMD.

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

Line: 39

              
  private final byte[] bytes = newPreFilledByteArray(10000);

  private TestByteSink sink;

  @Override
  protected void setUp() throws Exception {
    sink = new TestByteSink();
  }

            

Reported by PMD.

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

Line: 41

              
  private TestByteSink sink;

  @Override
  protected void setUp() throws Exception {
    sink = new TestByteSink();
  }

  public void testOpenBufferedStream() throws IOException {

            

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

                  sink = new TestByteSink();
  }

  public void testOpenBufferedStream() throws IOException {
    OutputStream out = sink.openBufferedStream();
    assertTrue(sink.wasStreamOpened());
    assertFalse(sink.wasStreamClosed());

    out.write(new byte[] {1, 2, 3, 4});

            

Reported by PMD.

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

Line: 46

                  sink = new TestByteSink();
  }

  public void testOpenBufferedStream() throws IOException {
    OutputStream out = sink.openBufferedStream();
    assertTrue(sink.wasStreamOpened());
    assertFalse(sink.wasStreamClosed());

    out.write(new byte[] {1, 2, 3, 4});

            

Reported by PMD.

Ensure that resources like this OutputStream object are closed after use
Error

Line: 47

                }

  public void testOpenBufferedStream() throws IOException {
    OutputStream out = sink.openBufferedStream();
    assertTrue(sink.wasStreamOpened());
    assertFalse(sink.wasStreamClosed());

    out.write(new byte[] {1, 2, 3, 4});
    out.close();

            

Reported by PMD.

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

Line: 52

                  assertFalse(sink.wasStreamClosed());

    out.write(new byte[] {1, 2, 3, 4});
    out.close();

    assertTrue(sink.wasStreamClosed());
    assertArrayEquals(new byte[] {1, 2, 3, 4}, sink.getBytes());
  }


            

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

                  assertArrayEquals(new byte[] {1, 2, 3, 4}, sink.getBytes());
  }

  public void testWrite_bytes() throws IOException {
    assertArrayEquals(new byte[0], sink.getBytes());
    sink.write(bytes);

    assertTrue(sink.wasStreamOpened() && sink.wasStreamClosed());
    assertArrayEquals(bytes, sink.getBytes());

            

Reported by PMD.

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

Line: 58

                  assertArrayEquals(new byte[] {1, 2, 3, 4}, sink.getBytes());
  }

  public void testWrite_bytes() throws IOException {
    assertArrayEquals(new byte[0], sink.getBytes());
    sink.write(bytes);

    assertTrue(sink.wasStreamOpened() && sink.wasStreamClosed());
    assertArrayEquals(bytes, sink.getBytes());

            

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

                  assertArrayEquals(bytes, sink.getBytes());
  }

  public void testWriteFrom_inputStream() throws IOException {
    ByteArrayInputStream in = new ByteArrayInputStream(bytes);
    sink.writeFrom(in);

    assertTrue(sink.wasStreamOpened() && sink.wasStreamClosed());
    assertArrayEquals(bytes, sink.getBytes());

            

Reported by PMD.

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

Line: 49

              @SuppressWarnings("unchecked") // too many "unchecked generic array creations"
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionAddAllTester<E> extends AbstractCollectionTester<E> {
  @CollectionFeature.Require(SUPPORTS_ADD)
  public void testAddAll_supportedNothing() {
    assertFalse("addAll(nothing) should return false", collection.addAll(emptyCollection()));
    expectUnchanged();
  }

            

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

              @GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionAddAllTester<E> extends AbstractCollectionTester<E> {
  @CollectionFeature.Require(SUPPORTS_ADD)
  public void testAddAll_supportedNothing() {
    assertFalse("addAll(nothing) should return false", collection.addAll(emptyCollection()));
    expectUnchanged();
  }


            

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

                  expectUnchanged();
  }

  @CollectionFeature.Require(absent = SUPPORTS_ADD)
  public void testAddAll_unsupportedNothing() {
    try {
      assertFalse(
          "addAll(nothing) should return false or throw", collection.addAll(emptyCollection()));
    } catch (UnsupportedOperationException tolerated) {

            

Reported by PMD.

Avoid empty catch blocks
Error

Line: 61

                  try {
      assertFalse(
          "addAll(nothing) should return false or throw", collection.addAll(emptyCollection()));
    } catch (UnsupportedOperationException tolerated) {
    }
    expectUnchanged();
  }

  @CollectionFeature.Require(SUPPORTS_ADD)

            

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

                  expectUnchanged();
  }

  @CollectionFeature.Require(SUPPORTS_ADD)
  public void testAddAll_supportedNonePresent() {
    assertTrue(
        "addAll(nonePresent) should return true", collection.addAll(createDisjointCollection()));
    expectAdded(e3(), e4());
  }

            

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

                  expectAdded(e3(), e4());
  }

  @CollectionFeature.Require(absent = SUPPORTS_ADD)
  public void testAddAll_unsupportedNonePresent() {
    try {
      collection.addAll(createDisjointCollection());
      fail("addAll(nonePresent) should throw");
    } catch (UnsupportedOperationException expected) {

            

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

                  expectMissing(e3(), e4());
  }

  @CollectionFeature.Require(SUPPORTS_ADD)
  @CollectionSize.Require(absent = ZERO)
  public void testAddAll_supportedSomePresent() {
    assertTrue(
        "addAll(somePresent) should return true",
        collection.addAll(MinimalCollection.of(e3(), e0())));

            

Reported by PMD.

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

Line: 86

              
  @CollectionFeature.Require(SUPPORTS_ADD)
  @CollectionSize.Require(absent = ZERO)
  public void testAddAll_supportedSomePresent() {
    assertTrue(
        "addAll(somePresent) should return true",
        collection.addAll(MinimalCollection.of(e3(), e0())));
    assertTrue("should contain " + e3(), collection.contains(e3()));
    assertTrue("should contain " + e0(), collection.contains(e0()));

            

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

                  assertTrue("should contain " + e0(), collection.contains(e0()));
  }

  @CollectionFeature.Require(absent = SUPPORTS_ADD)
  @CollectionSize.Require(absent = ZERO)
  public void testAddAll_unsupportedSomePresent() {
    try {
      collection.addAll(MinimalCollection.of(e3(), e0()));
      fail("addAll(somePresent) should throw");

            

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

                  expectUnchanged();
  }

  @CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
  @CollectionSize.Require(absent = ZERO)
  public void testAddAllConcurrentWithIteration() {
    try {
      Iterator<E> iterator = collection.iterator();
      assertTrue(collection.addAll(MinimalCollection.of(e3(), e0())));

            

Reported by PMD.

android/guava-tests/benchmark/com/google/common/util/concurrent/FuturesGetCheckedBenchmark.java
19 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 100

                        TooManyListenersException.class,
          URISyntaxException.class);

  @Param Validator validator;
  @Param Result result;
  @Param ExceptionType exceptionType;
  /**
   * The number of other exception types in the cache of known-good exceptions and the number of
   * other {@code ClassValue} entries for the exception type to be tested. This lets us evaluate

            

Reported by PMD.

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

Line: 101

                        URISyntaxException.class);

  @Param Validator validator;
  @Param Result result;
  @Param ExceptionType exceptionType;
  /**
   * The number of other exception types in the cache of known-good exceptions and the number of
   * other {@code ClassValue} entries for the exception type to be tested. This lets us evaluate
   * whether our solution scales to use with multiple exception types and to whether it is affected

            

Reported by PMD.

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

Line: 102

              
  @Param Validator validator;
  @Param Result result;
  @Param ExceptionType exceptionType;
  /**
   * The number of other exception types in the cache of known-good exceptions and the number of
   * other {@code ClassValue} entries for the exception type to be tested. This lets us evaluate
   * whether our solution scales to use with multiple exception types and to whether it is affected
   * by other {@code ClassValue} users. Some of the benchmarked implementations don't use one or

            

Reported by PMD.

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

Line: 111

                 * both of these mechanisms, so they will be unaffected.
   */
  @Param({"0", "1", "12"})
  int otherEntriesInDataStructure;

  final List<ClassValue<?>> retainedReferencesToOtherClassValues = newArrayList();

  @BeforeExperiment
  void addOtherEntries() throws Exception {

            

Reported by PMD.

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

Line: 113

                @Param({"0", "1", "12"})
  int otherEntriesInDataStructure;

  final List<ClassValue<?>> retainedReferencesToOtherClassValues = newArrayList();

  @BeforeExperiment
  void addOtherEntries() throws Exception {
    GetCheckedTypeValidator validator = this.validator.validator;
    Class<? extends Exception> exceptionType = this.exceptionType.exceptionType;

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 116

                final List<ClassValue<?>> retainedReferencesToOtherClassValues = newArrayList();

  @BeforeExperiment
  void addOtherEntries() throws Exception {
    GetCheckedTypeValidator validator = this.validator.validator;
    Class<? extends Exception> exceptionType = this.exceptionType.exceptionType;

    for (Class<? extends Exception> exceptionClass :
        OTHER_EXCEPTION_TYPES.asList().subList(0, otherEntriesInDataStructure)) {

            

Reported by PMD.

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

Line: 121

                  Class<? extends Exception> exceptionType = this.exceptionType.exceptionType;

    for (Class<? extends Exception> exceptionClass :
        OTHER_EXCEPTION_TYPES.asList().subList(0, otherEntriesInDataStructure)) {
      getChecked(validator, immediateFuture(""), exceptionClass);
    }

    for (int i = 0; i < otherEntriesInDataStructure; i++) {
      ClassValue<Boolean> classValue =

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 127

              
    for (int i = 0; i < otherEntriesInDataStructure; i++) {
      ClassValue<Boolean> classValue =
          new ClassValue<Boolean>() {
            @Override
            protected Boolean computeValue(Class<?> type) {
              return true;
            }
          };

            

Reported by PMD.

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

Line: 146

                  Class<? extends Exception> exceptionType = this.exceptionType.exceptionType;
    for (int i = 0; i < reps; ++i) {
      try {
        tmp += getChecked(validator, future, exceptionType).hashCode();
      } catch (Exception e) {
        tmp += e.hashCode();
      }
    }
    return tmp;

            

Reported by PMD.

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

Line: 147

                  for (int i = 0; i < reps; ++i) {
      try {
        tmp += getChecked(validator, future, exceptionType).hashCode();
      } catch (Exception e) {
        tmp += e.hashCode();
      }
    }
    return tmp;
  }

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/ForwardingMultisetTest.java
19 issues
This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import com.google.common.base.Function;
import com.google.common.collect.Multiset.Entry;
import com.google.common.collect.testing.SetTestSuiteBuilder;
import com.google.common.collect.testing.TestStringSetGenerator;

            

Reported by PMD.

The class 'ForwardingMultisetTest' has a Modified Cyclomatic Complexity of 8 (Highest = 28).
Design

Line: 43

               * @author Hayward Chan
 * @author Louis Wasserman
 */
public class ForwardingMultisetTest extends TestCase {

  static final class StandardImplForwardingMultiset<T> extends ForwardingMultiset<T> {
    private final Multiset<T> backingCollection;

    StandardImplForwardingMultiset(Multiset<T> backingMultiset) {

            

Reported by PMD.

The class 'ForwardingMultisetTest' has a Standard Cyclomatic Complexity of 8 (Highest = 28).
Design

Line: 43

               * @author Hayward Chan
 * @author Louis Wasserman
 */
public class ForwardingMultisetTest extends TestCase {

  static final class StandardImplForwardingMultiset<T> extends ForwardingMultiset<T> {
    private final Multiset<T> backingCollection;

    StandardImplForwardingMultiset(Multiset<T> backingMultiset) {

            

Reported by PMD.

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

Line: 45

               */
public class ForwardingMultisetTest extends TestCase {

  static final class StandardImplForwardingMultiset<T> extends ForwardingMultiset<T> {
    private final Multiset<T> backingCollection;

    StandardImplForwardingMultiset(Multiset<T> backingMultiset) {
      this.backingCollection = backingMultiset;
    }

            

Reported by PMD.

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

Line: 46

              public class ForwardingMultisetTest extends TestCase {

  static final class StandardImplForwardingMultiset<T> extends ForwardingMultiset<T> {
    private final Multiset<T> backingCollection;

    StandardImplForwardingMultiset(Multiset<T> backingMultiset) {
      this.backingCollection = backingMultiset;
    }


            

Reported by PMD.

Avoid really long methods.
Design

Line: 158

                  }
  }

  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTestSuite(ForwardingMultisetTest.class);
    suite.addTest(
        MultisetTestSuiteBuilder.using(

            

Reported by PMD.

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

Line: 158

                  }
  }

  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTestSuite(ForwardingMultisetTest.class);
    suite.addTest(
        MultisetTestSuiteBuilder.using(

            

Reported by PMD.

The method 'suite' has a Modified Cyclomatic Complexity of 28.
Design

Line: 158

                  }
  }

  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTestSuite(ForwardingMultisetTest.class);
    suite.addTest(
        MultisetTestSuiteBuilder.using(

            

Reported by PMD.

The method 'suite' has a Standard Cyclomatic Complexity of 28.
Design

Line: 158

                  }
  }

  public static Test suite() {
    TestSuite suite = new TestSuite();

    suite.addTestSuite(ForwardingMultisetTest.class);
    suite.addTest(
        MultisetTestSuiteBuilder.using(

            

Reported by PMD.

Avoid really long methods.
Design

Line: 199

                                 * specifically authorized by the elementSet() or hashCode() docs.
                   */
                  @Override
                  protected Set<String> create(String[] elements) {
                    final Multiset<String> inner =
                        LinkedHashMultiset.create(Arrays.asList(elements));
                    return new ForwardingMultiset<String>() {
                      @Override
                      protected Multiset<String> delegate() {

            

Reported by PMD.