The following issues were found

android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionEqualsTester.java
6 issues
Avoid using equals() to compare against null
Error

Line: 40

              
  public void testEquals_null() {
    // noinspection ObjectEqualsNull
    assertFalse("An object should not be equal to null.", collection.equals(null));
  }

  public void testEquals_notACollection() {
    // noinspection EqualsBetweenInconvertibleTypes
    assertFalse(

            

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

              public class CollectionEqualsTester<E> extends AbstractCollectionTester<E> {

  // TODO(cpovirk): Consider using EqualsTester from Guava.
  @SuppressWarnings("SelfEquals")
  public void testEquals_self() {
    assertTrue("An Object should be equal to itself.", collection.equals(collection));
  }

  public void testEquals_null() {

            

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

                  assertTrue("An Object should be equal to itself.", collection.equals(collection));
  }

  public void testEquals_null() {
    // noinspection ObjectEqualsNull
    assertFalse("An object should not be equal to null.", collection.equals(null));
  }

  public void testEquals_notACollection() {

            

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

                  assertFalse("An object should not be equal to null.", collection.equals(null));
  }

  public void testEquals_notACollection() {
    // noinspection EqualsBetweenInconvertibleTypes
    assertFalse(
        "A Collection should never equal an object that is not a Collection.",
        collection.equals("huh?"));
  }

            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 47

                  // noinspection EqualsBetweenInconvertibleTypes
    assertFalse(
        "A Collection should never equal an object that is not a Collection.",
        collection.equals("huh?"));
  }
}

            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 47

                  // noinspection EqualsBetweenInconvertibleTypes
    assertFalse(
        "A Collection should never equal an object that is not a Collection.",
        collection.equals("huh?"));
  }
}

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionToStringTester.java
6 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: 42

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionToStringTester<E> extends AbstractCollectionTester<E> {
  public void testToString_minimal() {
    assertNotNull("toString() should not return null", collection.toString());
  }

  @CollectionSize.Require(ZERO)
  @CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)

            

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

                  assertNotNull("toString() should not return null", collection.toString());
  }

  @CollectionSize.Require(ZERO)
  @CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
  public void testToString_size0() {
    assertEquals("emptyCollection.toString should return []", "[]", collection.toString());
  }


            

Reported by PMD.

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

Line: 52

                  assertEquals("emptyCollection.toString should return []", "[]", collection.toString());
  }

  @CollectionSize.Require(ONE)
  @CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
  public void testToString_size1() {
    assertEquals(
        "size1Collection.toString should return [{element}]",
        "[" + 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: 61

                      collection.toString());
  }

  @CollectionSize.Require(SEVERAL)
  @CollectionFeature.Require(value = KNOWN_ORDER, absent = NON_STANDARD_TOSTRING)
  public void testToString_sizeSeveral() {
    String expected = Helpers.copyToList(getOrderedElements()).toString();
    assertEquals("collection.toString() incorrect", expected, collection.toString());
  }

            

Reported by PMD.

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

Line: 64

                @CollectionSize.Require(SEVERAL)
  @CollectionFeature.Require(value = KNOWN_ORDER, absent = NON_STANDARD_TOSTRING)
  public void testToString_sizeSeveral() {
    String expected = Helpers.copyToList(getOrderedElements()).toString();
    assertEquals("collection.toString() incorrect", expected, collection.toString());
  }

  @CollectionSize.Require(absent = ZERO)
  @CollectionFeature.Require(ALLOWS_NULL_VALUES)

            

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

                  assertEquals("collection.toString() incorrect", expected, collection.toString());
  }

  @CollectionSize.Require(absent = ZERO)
  @CollectionFeature.Require(ALLOWS_NULL_VALUES)
  public void testToString_null() {
    initCollectionWithNullElement();
    testToString_minimal();
  }

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAllTester.java
6 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: 38

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class ListAddAllTester<E> extends AbstractListTester<E> {
  @CollectionFeature.Require(SUPPORTS_ADD)
  @CollectionSize.Require(absent = ZERO)
  public void testAddAll_supportedAllPresent() {
    assertTrue(
        "addAll(allPresent) should return true", getList().addAll(MinimalCollection.of(e0())));
    expectAdded(e0());

            

Reported by PMD.

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

Line: 42

                @CollectionSize.Require(absent = ZERO)
  public void testAddAll_supportedAllPresent() {
    assertTrue(
        "addAll(allPresent) should return true", getList().addAll(MinimalCollection.of(e0())));
    expectAdded(e0());
  }

  @CollectionFeature.Require(absent = SUPPORTS_ADD)
  @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: 46

                  expectAdded(e0());
  }

  @CollectionFeature.Require(absent = SUPPORTS_ADD)
  @CollectionSize.Require(absent = ZERO)
  public void testAddAll_unsupportedAllPresent() {
    try {
      getList().addAll(MinimalCollection.of(e0()));
      fail("addAll(allPresent) should throw");

            

Reported by PMD.

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

Line: 50

                @CollectionSize.Require(absent = ZERO)
  public void testAddAll_unsupportedAllPresent() {
    try {
      getList().addAll(MinimalCollection.of(e0()));
      fail("addAll(allPresent) should throw");
    } catch (UnsupportedOperationException expected) {
    }
    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: 57

                  expectUnchanged();
  }

  @CollectionFeature.Require(SUPPORTS_ADD)
  public void testAddAll_withDuplicates() {
    MinimalCollection<E> elementsToAdd = MinimalCollection.of(e0(), e1(), e0(), e1());
    assertTrue("addAll(hasDuplicates) should return true", getList().addAll(elementsToAdd));
    expectAdded(e0(), e1(), e0(), e1());
  }

            

Reported by PMD.

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

Line: 60

                @CollectionFeature.Require(SUPPORTS_ADD)
  public void testAddAll_withDuplicates() {
    MinimalCollection<E> elementsToAdd = MinimalCollection.of(e0(), e1(), e0(), e1());
    assertTrue("addAll(hasDuplicates) should return true", getList().addAll(elementsToAdd));
    expectAdded(e0(), e1(), e0(), e1());
  }
}

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/testers/QueuePollTester.java
6 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

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class QueuePollTester<E> extends AbstractQueueTester<E> {
  @CollectionFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(ZERO)
  public void testPoll_empty() {
    assertNull("emptyQueue.poll() should return null", getQueue().poll());
    expectUnchanged();
  }

            

Reported by PMD.

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

Line: 43

                @CollectionFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(ZERO)
  public void testPoll_empty() {
    assertNull("emptyQueue.poll() should return null", getQueue().poll());
    expectUnchanged();
  }

  @CollectionFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(ONE)

            

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

                  expectUnchanged();
  }

  @CollectionFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(ONE)
  public void testPoll_size1() {
    assertEquals("size1Queue.poll() should return first element", e0(), getQueue().poll());
    expectMissing(e0());
  }

            

Reported by PMD.

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

Line: 50

                @CollectionFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(ONE)
  public void testPoll_size1() {
    assertEquals("size1Queue.poll() should return first element", e0(), getQueue().poll());
    expectMissing(e0());
  }

  @CollectionFeature.Require({KNOWN_ORDER, SUPPORTS_REMOVE})
  @CollectionSize.Require(SEVERAL)

            

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

                  expectMissing(e0());
  }

  @CollectionFeature.Require({KNOWN_ORDER, SUPPORTS_REMOVE})
  @CollectionSize.Require(SEVERAL)
  public void testPoll_sizeMany() {
    assertEquals("sizeManyQueue.poll() should return first element", e0(), getQueue().poll());
    expectMissing(e0());
  }

            

Reported by PMD.

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

Line: 57

                @CollectionFeature.Require({KNOWN_ORDER, SUPPORTS_REMOVE})
  @CollectionSize.Require(SEVERAL)
  public void testPoll_sizeMany() {
    assertEquals("sizeManyQueue.poll() should return first element", e0(), getQueue().poll());
    expectMissing(e0());
  }
}

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/testers/QueuePeekTester.java
6 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: 38

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class QueuePeekTester<E> extends AbstractQueueTester<E> {
  @CollectionSize.Require(ZERO)
  public void testPeek_empty() {
    assertNull("emptyQueue.peek() should return null", getQueue().peek());
    expectUnchanged();
  }


            

Reported by PMD.

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

Line: 40

              public class QueuePeekTester<E> extends AbstractQueueTester<E> {
  @CollectionSize.Require(ZERO)
  public void testPeek_empty() {
    assertNull("emptyQueue.peek() should return null", getQueue().peek());
    expectUnchanged();
  }

  @CollectionSize.Require(ONE)
  public void testPeek_size1() {

            

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

                  expectUnchanged();
  }

  @CollectionSize.Require(ONE)
  public void testPeek_size1() {
    assertEquals("size1Queue.peek() should return first element", e0(), getQueue().peek());
    expectUnchanged();
  }


            

Reported by PMD.

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

Line: 46

              
  @CollectionSize.Require(ONE)
  public void testPeek_size1() {
    assertEquals("size1Queue.peek() should return first element", e0(), getQueue().peek());
    expectUnchanged();
  }

  @CollectionFeature.Require(KNOWN_ORDER)
  @CollectionSize.Require(SEVERAL)

            

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

                  expectUnchanged();
  }

  @CollectionFeature.Require(KNOWN_ORDER)
  @CollectionSize.Require(SEVERAL)
  public void testPeek_sizeMany() {
    assertEquals("sizeManyQueue.peek() should return first element", e0(), getQueue().peek());
    expectUnchanged();
  }

            

Reported by PMD.

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

Line: 53

                @CollectionFeature.Require(KNOWN_ORDER)
  @CollectionSize.Require(SEVERAL)
  public void testPeek_sizeMany() {
    assertEquals("sizeManyQueue.peek() should return first element", e0(), getQueue().peek());
    expectUnchanged();
  }
}

            

Reported by PMD.

android/guava-tests/benchmark/com/google/common/collect/InternersBenchmark.java
6 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 48

                @Benchmark
  int stringIntern(int reps) {
    for (int i = 0; i < reps; i++) {
      String unused = Double.toHexString(Math.random()).intern();
    }
    return reps;
  }
}

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 48

                @Benchmark
  int stringIntern(int reps) {
    for (int i = 0; i < reps; i++) {
      String unused = Double.toHexString(Math.random()).intern();
    }
    return reps;
  }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'interner' (lines '29'-'34').
Error

Line: 29

              public class InternersBenchmark {
  @Benchmark
  int weakInterner(int reps) {
    Interner<String> interner = Interners.newWeakInterner();
    for (int i = 0; i < reps; i++) {
      interner.intern(Double.toHexString(Math.random()));
    }
    return reps;
  }

            

Reported by PMD.

Found 'DU'-anomaly for variable 'interner' (lines '38'-'43').
Error

Line: 38

              
  @Benchmark
  int strongInterner(int reps) {
    Interner<String> interner = Interners.newStrongInterner();
    for (int i = 0; i < reps; i++) {
      interner.intern(Double.toHexString(Math.random()));
    }
    return reps;
  }

            

Reported by PMD.

Found 'DU'-anomaly for variable 'unused' (lines '48'-'51').
Error

Line: 48

                @Benchmark
  int stringIntern(int reps) {
    for (int i = 0; i < reps; i++) {
      String unused = Double.toHexString(Math.random()).intern();
    }
    return reps;
  }
}

            

Reported by PMD.

Found 'DD'-anomaly for variable 'unused' (lines '48'-'48').
Error

Line: 48

                @Benchmark
  int stringIntern(int reps) {
    for (int i = 0; i < reps; i++) {
      String unused = Double.toHexString(Math.random()).intern();
    }
    return reps;
  }
}

            

Reported by PMD.

android/guava-tests/benchmark/com/google/common/collect/HashMultisetAddPresentBenchmark.java
6 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 31

              public class HashMultisetAddPresentBenchmark {
  private static final int ARRAY_MASK = 0x0ffff;
  private static final int ARRAY_SIZE = 0x10000;
  List<Multiset<Integer>> multisets = new ArrayList<>(0x10000);
  int[] queries = new int[ARRAY_SIZE];

  @BeforeExperiment
  void setUp() {
    Random random = new Random();

            

Reported by PMD.

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

Line: 32

                private static final int ARRAY_MASK = 0x0ffff;
  private static final int ARRAY_SIZE = 0x10000;
  List<Multiset<Integer>> multisets = new ArrayList<>(0x10000);
  int[] queries = new int[ARRAY_SIZE];

  @BeforeExperiment
  void setUp() {
    Random random = new Random();
    multisets.clear();

            

Reported by PMD.

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

Line: 34

                List<Multiset<Integer>> multisets = new ArrayList<>(0x10000);
  int[] queries = new int[ARRAY_SIZE];

  @BeforeExperiment
  void setUp() {
    Random random = new Random();
    multisets.clear();
    for (int i = 0; i < ARRAY_SIZE; i++) {
      HashMultiset<Integer> multiset = HashMultiset.<Integer>create();

            

Reported by PMD.

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

Line: 42

                    HashMultiset<Integer> multiset = HashMultiset.<Integer>create();
      multisets.add(multiset);
      queries[i] = random.nextInt();
      multiset.add(queries[i]);
    }
  }

  @Benchmark
  int add(int reps) {

            

Reported by PMD.

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

Line: 51

                  int tmp = 0;
    for (int i = 0; i < reps; i++) {
      int j = i & ARRAY_MASK;
      tmp += multisets.get(j).add(queries[j], 4);
    }
    return tmp;
  }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'random' (lines '36'-'44').
Error

Line: 36

              
  @BeforeExperiment
  void setUp() {
    Random random = new Random();
    multisets.clear();
    for (int i = 0; i < ARRAY_SIZE; i++) {
      HashMultiset<Integer> multiset = HashMultiset.<Integer>create();
      multisets.add(multiset);
      queries[i] = random.nextInt();

            

Reported by PMD.

android/guava-tests/benchmark/com/google/common/base/SplitterBenchmark.java
6 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 32

              public class SplitterBenchmark {
  // overall size of string
  @Param({"1", "10", "100", "1000"})
  int length;
  // Number of matching strings
  @Param({"xxxx", "xxXx", "xXxX", "XXXX"})
  String text;

  private String input;

            

Reported by PMD.

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

Line: 35

                int length;
  // Number of matching strings
  @Param({"xxxx", "xxXx", "xXxX", "XXXX"})
  String text;

  private String input;

  private static final Splitter CHAR_SPLITTER = Splitter.on('X');
  private static final Splitter STRING_SPLITTER = Splitter.on("X");

            

Reported by PMD.

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

Line: 37

                @Param({"xxxx", "xxXx", "xXxX", "XXXX"})
  String text;

  private String input;

  private static final Splitter CHAR_SPLITTER = Splitter.on('X');
  private static final Splitter STRING_SPLITTER = Splitter.on("X");

  @BeforeExperiment

            

Reported by PMD.

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

Line: 42

                private static final Splitter CHAR_SPLITTER = Splitter.on('X');
  private static final Splitter STRING_SPLITTER = Splitter.on("X");

  @BeforeExperiment
  void setUp() {
    input = Strings.repeat(text, length);
  }

  @Benchmark

            

Reported by PMD.

Found 'DU'-anomaly for variable 'total' (lines '49'-'54').
Error

Line: 49

              
  @Benchmark
  void charSplitter(int reps) {
    int total = 0;

    for (int i = 0; i < reps; i++) {
      total += Iterables.size(CHAR_SPLITTER.split(input));
    }
  }

            

Reported by PMD.

Found 'DU'-anomaly for variable 'total' (lines '58'-'63').
Error

Line: 58

              
  @Benchmark
  void stringSplitter(int reps) {
    int total = 0;

    for (int i = 0; i < reps; i++) {
      total += Iterables.size(STRING_SPLITTER.split(input));
    }
  }

            

Reported by PMD.

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

Line: 33

                static final String FIRST = "one";
  static final Double SECOND = 2.0d;

  final EventBus bus = new EventBus();

  public void testNoReentrantEvents() {
    ReentrantEventsHater hater = new ReentrantEventsHater();
    bus.register(hater);


            

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

              
  final EventBus bus = new EventBus();

  public void testNoReentrantEvents() {
    ReentrantEventsHater hater = new ReentrantEventsHater();
    bus.register(hater);

    bus.post(FIRST);


            

Reported by PMD.

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

Line: 48

                }

  public class ReentrantEventsHater {
    boolean ready = true;
    List<Object> eventsReceived = Lists.newArrayList();

    @Subscribe
    public void listenForStrings(String event) {
      eventsReceived.add(event);

            

Reported by PMD.

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

Line: 49

              
  public class ReentrantEventsHater {
    boolean ready = true;
    List<Object> eventsReceived = Lists.newArrayList();

    @Subscribe
    public void listenForStrings(String event) {
      eventsReceived.add(event);
      ready = 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: 69

                  }
  }

  public void testEventOrderingIsPredictable() {
    EventProcessor processor = new EventProcessor();
    bus.register(processor);

    EventRecorder recorder = new EventRecorder();
    bus.register(recorder);

            

Reported by PMD.

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

Line: 92

                }

  public class EventRecorder {
    List<Object> eventsReceived = Lists.newArrayList();

    @Subscribe
    public void listenForEverything(Object event) {
      eventsReceived.add(event);
    }

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/testers/QueueElementTester.java
6 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 39

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class QueueElementTester<E> extends AbstractQueueTester<E> {
  @CollectionSize.Require(ZERO)
  public void testElement_empty() {
    try {
      getQueue().element();
      fail("emptyQueue.element() should throw");
    } catch (NoSuchElementException expected) {

            

Reported by PMD.

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

Line: 42

                @CollectionSize.Require(ZERO)
  public void testElement_empty() {
    try {
      getQueue().element();
      fail("emptyQueue.element() should throw");
    } catch (NoSuchElementException expected) {
    }
    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: 49

                  expectUnchanged();
  }

  @CollectionSize.Require(ONE)
  public void testElement_size1() {
    assertEquals("size1Queue.element() should return first element", e0(), getQueue().element());
    expectUnchanged();
  }


            

Reported by PMD.

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

Line: 51

              
  @CollectionSize.Require(ONE)
  public void testElement_size1() {
    assertEquals("size1Queue.element() should return first element", e0(), getQueue().element());
    expectUnchanged();
  }

  @CollectionFeature.Require(KNOWN_ORDER)
  @CollectionSize.Require(SEVERAL)

            

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

                  expectUnchanged();
  }

  @CollectionFeature.Require(KNOWN_ORDER)
  @CollectionSize.Require(SEVERAL)
  public void testElement_sizeMany() {
    assertEquals("sizeManyQueue.element() should return first element", e0(), getQueue().element());
    expectUnchanged();
  }

            

Reported by PMD.

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

Line: 58

                @CollectionFeature.Require(KNOWN_ORDER)
  @CollectionSize.Require(SEVERAL)
  public void testElement_sizeMany() {
    assertEquals("sizeManyQueue.element() should return first element", e0(), getQueue().element());
    expectUnchanged();
  }
}

            

Reported by PMD.