The following issues were found

guava-tests/test/com/google/common/io/CountingOutputStreamTest.java
2 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 28

               */
public class CountingOutputStreamTest extends IoTestCase {

  public void testCount() throws Exception {
    int written = 0;
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    CountingOutputStream counter = new CountingOutputStream(out);
    assertEquals(written, out.size());
    assertEquals(written, counter.getCount());

            

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

               */
public class CountingOutputStreamTest extends IoTestCase {

  public void testCount() throws Exception {
    int written = 0;
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    CountingOutputStream counter = new CountingOutputStream(out);
    assertEquals(written, out.size());
    assertEquals(written, counter.getCount());

            

Reported by PMD.

guava-tests/test/com/google/common/eventbus/outside/OutsideEventBusTest.java
2 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 37

                 * That is, even if exactly the same method works from inside the common.eventbus package tests,
   * it can fail here.
   */
  public void testAnonymous() {
    final AtomicReference<String> holder = new AtomicReference<>();
    final AtomicInteger deliveries = new AtomicInteger();
    EventBus bus = new EventBus();
    bus.register(
        new 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: 37

                 * That is, even if exactly the same method works from inside the common.eventbus package tests,
   * it can fail here.
   */
  public void testAnonymous() {
    final AtomicReference<String> holder = new AtomicReference<>();
    final AtomicInteger deliveries = new AtomicInteger();
    EventBus bus = new EventBus();
    bus.register(
        new Object() {

            

Reported by PMD.

guava-tests/test/com/google/common/cache/TestingWeighers.java
2 issues
All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 22

               *
 * @author Charles Fry
 */
public class TestingWeighers {

  /** Returns a {@link Weigher} that returns the given {@code constant} for every request. */
  static Weigher<Object, Object> constantWeigher(int constant) {
    return new ConstantWeigher(constant);
  }

            

Reported by PMD.

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

Line: 40

                }

  static final class ConstantWeigher implements Weigher<Object, Object> {
    private final int constant;

    ConstantWeigher(int constant) {
      this.constant = constant;
    }


            

Reported by PMD.

guava-testlib/test/com/google/common/collect/testing/OpenJdk6Tests.java
2 issues
This class name ends with Test but contains no test cases
Error

Line: 30

               *
 * @author Kevin Bourrillion
 */
public class OpenJdk6Tests extends TestCase {
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(OpenJdk6SetTests.suite());
    suite.addTest(OpenJdk6ListTests.suite());
    suite.addTest(OpenJdk6QueueTests.suite());

            

Reported by PMD.

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

Line: 31

               * @author Kevin Bourrillion
 */
public class OpenJdk6Tests extends TestCase {
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(OpenJdk6SetTests.suite());
    suite.addTest(OpenJdk6ListTests.suite());
    suite.addTest(OpenJdk6QueueTests.suite());
    suite.addTest(OpenJdk6MapTests.suite());

            

Reported by PMD.

guava-tests/test/com/google/common/collect/BenchmarkHelpers.java
2 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 256

                    @Override
      public <K extends Comparable<K>, V> SortedMap<K, V> create(Map<K, V> map) {
        SortedMap<K, V> result = Maps.newTreeMap();
        result.putAll(map);
        return result;
      }
    },
    ConcurrentSkipListImpl {
      @Override

            

Reported by PMD.

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

Line: 356

                    <R extends Comparable<R>, C extends Comparable<C>, V> Table<R, C, V> create(
          Table<R, C, V> contents) {
        Table<R, C, V> table = TreeBasedTable.create();
        table.putAll(contents);
        return table;
      }
    },
    ArrayTableImpl {
      @Override

            

Reported by PMD.

guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java
2 issues
JUnit tests should include assert() or fail()
Design

Line: 31

                 * RegularImmutableAsList should assume its input is null-free without checking, because it only
   * gets invoked from other immutable collections.
   */
  public void testDoesntCheckForNull() {
    ImmutableSet<Integer> set = ImmutableSet.of(1, 2, 3);
    new RegularImmutableAsList<Integer>(set, new Object[] {null, null, null});
    // shouldn't 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: 31

                 * RegularImmutableAsList should assume its input is null-free without checking, because it only
   * gets invoked from other immutable collections.
   */
  public void testDoesntCheckForNull() {
    ImmutableSet<Integer> set = ImmutableSet.of(1, 2, 3);
    new RegularImmutableAsList<Integer>(set, new Object[] {null, null, null});
    // shouldn't throw!
  }
}

            

Reported by PMD.

guava-tests/test/com/google/common/collect/SpecialRandom.java
2 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 34

                  return (s.length() == 0) ? new SpecialRandom() : new SpecialRandom(Long.parseLong(s));
  }

  private final boolean hasSeed;
  private final long seed;

  public SpecialRandom() {
    this.hasSeed = false;
    this.seed = 0;

            

Reported by PMD.

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

Line: 35

                }

  private final boolean hasSeed;
  private final long seed;

  public SpecialRandom() {
    this.hasSeed = false;
    this.seed = 0;
  }

            

Reported by PMD.

guava-tests/benchmark/com/google/common/eventbus/EventBusBenchmark.java
2 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 29

               */
public class EventBusBenchmark {

  private EventBus eventBus;

  @BeforeExperiment
  void setUp() {
    eventBus = new EventBus("for benchmarking purposes");
    eventBus.register(this);

            

Reported by PMD.

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

Line: 31

              
  private EventBus eventBus;

  @BeforeExperiment
  void setUp() {
    eventBus = new EventBus("for benchmarking purposes");
    eventBus.register(this);
  }


            

Reported by PMD.

guava-tests/test/com/google/common/math/TestPlatform.java
2 issues
All methods are static. Consider using a utility class instead. Alternatively, you could add a private constructor or make the class abstract to silence this warning.
Design

Line: 23

              
/** @author Chris Povirk */
@GwtCompatible(emulated = true)
class TestPlatform {
  static boolean intsCanGoOutOfRange() {
    return false;
  }

  static boolean isAndroid() {

            

Reported by PMD.

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

Line: 29

                }

  static boolean isAndroid() {
    return System.getProperty("java.runtime.name").contains("Android");
  }
}

            

Reported by PMD.

guava-testlib/src/com/google/common/collect/testing/testers/MapSizeTester.java
2 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: 32

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapSizeTester<K, V> extends AbstractMapTester<K, V> {
  public void testSize() {
    assertEquals("size():", getNumElements(), getMap().size());
  }
}

            

Reported by PMD.

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

Line: 33

              @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapSizeTester<K, V> extends AbstractMapTester<K, V> {
  public void testSize() {
    assertEquals("size():", getNumElements(), getMap().size());
  }
}

            

Reported by PMD.