The following issues were found

guava-testlib/src/com/google/common/collect/testing/google/MultimapPutAllMultimapTester.java
41 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 MultimapPutAllMultimapTester<K, V>
    extends AbstractMultimapTester<K, V, Multimap<K, V>> {
  @MapFeature.Require(absent = SUPPORTS_PUT)
  public void testPutUnsupported() {
    try {
      multimap().putAll(getSubjectGenerator().create(Helpers.mapEntry(k3(), v3())));
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException expected) {

            

Reported by PMD.

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

Line: 43

                @MapFeature.Require(absent = SUPPORTS_PUT)
  public void testPutUnsupported() {
    try {
      multimap().putAll(getSubjectGenerator().create(Helpers.mapEntry(k3(), v3())));
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException expected) {
    }
  }


            

Reported by PMD.

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

Line: 43

                @MapFeature.Require(absent = SUPPORTS_PUT)
  public void testPutUnsupported() {
    try {
      multimap().putAll(getSubjectGenerator().create(Helpers.mapEntry(k3(), v3())));
      fail("Expected UnsupportedOperationException");
    } 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: 49

                  }
  }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }

            

Reported by PMD.

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

Line: 50

                }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }


            

Reported by PMD.

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

Line: 51

              
  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }

  @MapFeature.Require(SUPPORTS_PUT)

            

Reported by PMD.

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

Line: 52

                @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }

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

            

Reported by PMD.

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

Line: 52

                @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }

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

            

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

                  assertEquals(multimap(), target);
  }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAll() {
    Multimap<K, V> source =
        getSubjectGenerator().create(Helpers.mapEntry(k0(), v3()), Helpers.mapEntry(k3(), v3()));
    assertTrue(multimap().putAll(source));
    assertTrue(multimap().containsEntry(k0(), v3()));

            

Reported by PMD.

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

Line: 57

                }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAll() {
    Multimap<K, V> source =
        getSubjectGenerator().create(Helpers.mapEntry(k0(), v3()), Helpers.mapEntry(k3(), v3()));
    assertTrue(multimap().putAll(source));
    assertTrue(multimap().containsEntry(k0(), v3()));
    assertTrue(multimap().containsEntry(k3(), v3()));

            

Reported by PMD.

guava-tests/benchmark/com/google/common/math/ApacheBenchmark.java
41 issues
The class 'ApacheBenchmark' has a Modified Cyclomatic Complexity of 4 (Highest = 11).
Design

Line: 36

               *
 * @author Louis Wasserman
 */
public class ApacheBenchmark {
  private enum Impl {
    GUAVA {
      @Override
      public double factorialDouble(int n) {
        return DoubleMath.factorial(n);

            

Reported by PMD.

The class 'ApacheBenchmark' has a Standard Cyclomatic Complexity of 4 (Highest = 11).
Design

Line: 36

               *
 * @author Louis Wasserman
 */
public class ApacheBenchmark {
  private enum Impl {
    GUAVA {
      @Override
      public double factorialDouble(int n) {
        return DoubleMath.factorial(n);

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 62

                    @Override
      public boolean noAddOverflow(int a, int b) {
        try {
          int unused = IntMath.checkedAdd(a, b);
          return true;
        } catch (ArithmeticException e) {
          return false;
        }
      }

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 72

                    @Override
      public boolean noAddOverflow(long a, long b) {
        try {
          long unused = LongMath.checkedAdd(a, b);
          return true;
        } catch (ArithmeticException e) {
          return false;
        }
      }

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 82

                    @Override
      public boolean noMulOverflow(int a, int b) {
        try {
          int unused = IntMath.checkedMultiply(a, b);
          return true;
        } catch (ArithmeticException e) {
          return false;
        }
      }

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 92

                    @Override
      public boolean noMulOverflow(long a, long b) {
        try {
          long unused = LongMath.checkedMultiply(a, b);
          return true;
        } catch (ArithmeticException e) {
          return false;
        }
      }

            

Reported by PMD.

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

Line: 117

                  public abstract boolean noMulOverflow(long a, long b);
  }

  private final int[] factorials = new int[ARRAY_SIZE];
  private final int[][] binomials = new int[ARRAY_SIZE][2];
  private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
  private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
  private final int[][] intsToAdd = new int[ARRAY_SIZE][2];
  private final int[][] intsToMul = new int[ARRAY_SIZE][2];

            

Reported by PMD.

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

Line: 118

                }

  private final int[] factorials = new int[ARRAY_SIZE];
  private final int[][] binomials = new int[ARRAY_SIZE][2];
  private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
  private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
  private final int[][] intsToAdd = new int[ARRAY_SIZE][2];
  private final int[][] intsToMul = new int[ARRAY_SIZE][2];
  private final long[][] longsToAdd = new long[ARRAY_SIZE][2];

            

Reported by PMD.

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

Line: 119

              
  private final int[] factorials = new int[ARRAY_SIZE];
  private final int[][] binomials = new int[ARRAY_SIZE][2];
  private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
  private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
  private final int[][] intsToAdd = new int[ARRAY_SIZE][2];
  private final int[][] intsToMul = new int[ARRAY_SIZE][2];
  private final long[][] longsToAdd = new long[ARRAY_SIZE][2];
  private final long[][] longsToMul = new long[ARRAY_SIZE][2];

            

Reported by PMD.

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

Line: 120

                private final int[] factorials = new int[ARRAY_SIZE];
  private final int[][] binomials = new int[ARRAY_SIZE][2];
  private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
  private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
  private final int[][] intsToAdd = new int[ARRAY_SIZE][2];
  private final int[][] intsToMul = new int[ARRAY_SIZE][2];
  private final long[][] longsToAdd = new long[ARRAY_SIZE][2];
  private final long[][] longsToMul = new long[ARRAY_SIZE][2];


            

Reported by PMD.

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

Line: 44

               */
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionToArrayTester<E> extends AbstractCollectionTester<E> {
  public void testToArray_noArgs() {
    Object[] array = collection.toArray();
    expectArrayContentsAnyOrder(createSamplesArray(), array);
  }


            

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

              @GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionToArrayTester<E> extends AbstractCollectionTester<E> {
  public void testToArray_noArgs() {
    Object[] array = collection.toArray();
    expectArrayContentsAnyOrder(createSamplesArray(), array);
  }

  /**

            

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

                 * <p>For maximum effect, the collection under test should be created from an element array of a
   * type other than {@code Object[]}.
   */
  public void testToArray_isPlainObjectArray() {
    Object[] array = collection.toArray();
    assertEquals(Object[].class, array.getClass());
  }

  public void testToArray_emptyArray() {

            

Reported by PMD.

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

Line: 59

                 */
  public void testToArray_isPlainObjectArray() {
    Object[] array = collection.toArray();
    assertEquals(Object[].class, array.getClass());
  }

  public void testToArray_emptyArray() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);

            

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

                  assertEquals(Object[].class, array.getClass());
  }

  public void testToArray_emptyArray() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);

            

Reported by PMD.

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

Line: 62

                  assertEquals(Object[].class, array.getClass());
  }

  public void testToArray_emptyArray() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);

            

Reported by PMD.

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

Line: 63

                }

  public void testToArray_emptyArray() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);
    expectArrayContentsAnyOrder(createSamplesArray(), array);

            

Reported by PMD.

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

Line: 66

                  E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);
    expectArrayContentsAnyOrder(createSamplesArray(), array);
  }

  @CollectionFeature.Require(KNOWN_ORDER)

            

Reported by PMD.

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

Line: 66

                  E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);
    expectArrayContentsAnyOrder(createSamplesArray(), array);
  }

  @CollectionFeature.Require(KNOWN_ORDER)

            

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

                  expectArrayContentsAnyOrder(createSamplesArray(), array);
  }

  @CollectionFeature.Require(KNOWN_ORDER)
  public void testToArray_emptyArray_ordered() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());

            

Reported by PMD.

guava-tests/test/com/google/common/io/CharSourceTester.java
41 issues
This class has too many methods, consider refactoring it.
Design

Line: 45

               * @author Colin Decker
 */
@AndroidIncompatible // Android doesn't understand tests that lack default constructors.
public class CharSourceTester extends SourceSinkTester<CharSource, String, CharSourceFactory> {

  private static final ImmutableList<Method> testMethods = getTestMethods(CharSourceTester.class);

  static TestSuite tests(String name, CharSourceFactory factory, boolean testAsByteSource) {
    TestSuite suite = new TestSuite(name);

            

Reported by PMD.

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

Line: 55

                    if (testAsByteSource) {
        suite.addTest(
            suiteForBytes(
                factory, entry.getValue().getBytes(Charsets.UTF_8), name, entry.getKey(), true));
      } else {
        suite.addTest(suiteForString(factory, entry.getValue(), name, entry.getKey()));
      }
    }
    return suite;

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 77

                    CharSourceFactory factory, String string, String name, String desc) {
    TestSuite suite = new TestSuite(name + " [" + desc + "]");
    for (Method method : testMethods) {
      suite.addTest(new CharSourceTester(factory, string, name, desc, method));
    }
    return suite;
  }

  private final ImmutableList<String> expectedLines;

            

Reported by PMD.

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

Line: 82

                  return suite;
  }

  private final ImmutableList<String> expectedLines;

  private CharSource source;

  public CharSourceTester(
      CharSourceFactory factory, String string, String suiteName, String caseDesc, Method method) {

            

Reported by PMD.

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

Line: 84

              
  private final ImmutableList<String> expectedLines;

  private CharSource source;

  public CharSourceTester(
      CharSourceFactory factory, String string, String suiteName, String caseDesc, Method method) {
    super(factory, string, suiteName, caseDesc, method);
    this.expectedLines = getLines(expected);

            

Reported by PMD.

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

Line: 92

                  this.expectedLines = getLines(expected);
  }

  @Override
  protected void setUp() throws Exception {
    this.source = factory.createSource(data);
  }

  public void testOpenStream() 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: 97

                  this.source = factory.createSource(data);
  }

  public void testOpenStream() throws IOException {
    Reader reader = source.openStream();

    StringWriter writer = new StringWriter();
    char[] buf = new char[64];
    int read;

            

Reported by PMD.

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

Line: 98

                }

  public void testOpenStream() throws IOException {
    Reader reader = source.openStream();

    StringWriter writer = new StringWriter();
    char[] buf = new char[64];
    int read;
    while ((read = reader.read(buf)) != -1) {

            

Reported by PMD.

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

Line: 103

                  StringWriter writer = new StringWriter();
    char[] buf = new char[64];
    int read;
    while ((read = reader.read(buf)) != -1) {
      writer.write(buf, 0, read);
    }
    reader.close();
    writer.close();


            

Reported by PMD.

Avoid assignments in operands
Error

Line: 103

                  StringWriter writer = new StringWriter();
    char[] buf = new char[64];
    int read;
    while ((read = reader.read(buf)) != -1) {
      writer.write(buf, 0, read);
    }
    reader.close();
    writer.close();


            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutAllMultimapTester.java
41 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 MultimapPutAllMultimapTester<K, V>
    extends AbstractMultimapTester<K, V, Multimap<K, V>> {
  @MapFeature.Require(absent = SUPPORTS_PUT)
  public void testPutUnsupported() {
    try {
      multimap().putAll(getSubjectGenerator().create(Helpers.mapEntry(k3(), v3())));
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException expected) {

            

Reported by PMD.

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

Line: 43

                @MapFeature.Require(absent = SUPPORTS_PUT)
  public void testPutUnsupported() {
    try {
      multimap().putAll(getSubjectGenerator().create(Helpers.mapEntry(k3(), v3())));
      fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException expected) {
    }
  }


            

Reported by PMD.

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

Line: 43

                @MapFeature.Require(absent = SUPPORTS_PUT)
  public void testPutUnsupported() {
    try {
      multimap().putAll(getSubjectGenerator().create(Helpers.mapEntry(k3(), v3())));
      fail("Expected UnsupportedOperationException");
    } 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: 49

                  }
  }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }

            

Reported by PMD.

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

Line: 50

                }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }


            

Reported by PMD.

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

Line: 51

              
  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }

  @MapFeature.Require(SUPPORTS_PUT)

            

Reported by PMD.

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

Line: 52

                @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }

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

            

Reported by PMD.

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

Line: 52

                @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAllIntoEmpty() {
    Multimap<K, V> target = getSubjectGenerator().create();
    assertEquals(!multimap().isEmpty(), target.putAll(multimap()));
    assertEquals(multimap(), target);
  }

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

            

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

                  assertEquals(multimap(), target);
  }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAll() {
    Multimap<K, V> source =
        getSubjectGenerator().create(Helpers.mapEntry(k0(), v3()), Helpers.mapEntry(k3(), v3()));
    assertTrue(multimap().putAll(source));
    assertTrue(multimap().containsEntry(k0(), v3()));

            

Reported by PMD.

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

Line: 57

                }

  @MapFeature.Require(SUPPORTS_PUT)
  public void testPutAll() {
    Multimap<K, V> source =
        getSubjectGenerator().create(Helpers.mapEntry(k0(), v3()), Helpers.mapEntry(k3(), v3()));
    assertTrue(multimap().putAll(source));
    assertTrue(multimap().containsEntry(k0(), v3()));
    assertTrue(multimap().containsEntry(k3(), v3()));

            

Reported by PMD.

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

Line: 44

               */
@GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionToArrayTester<E> extends AbstractCollectionTester<E> {
  public void testToArray_noArgs() {
    Object[] array = collection.toArray();
    expectArrayContentsAnyOrder(createSamplesArray(), array);
  }


            

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

              @GwtCompatible(emulated = true)
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class CollectionToArrayTester<E> extends AbstractCollectionTester<E> {
  public void testToArray_noArgs() {
    Object[] array = collection.toArray();
    expectArrayContentsAnyOrder(createSamplesArray(), array);
  }

  /**

            

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

                 * <p>For maximum effect, the collection under test should be created from an element array of a
   * type other than {@code Object[]}.
   */
  public void testToArray_isPlainObjectArray() {
    Object[] array = collection.toArray();
    assertEquals(Object[].class, array.getClass());
  }

  public void testToArray_emptyArray() {

            

Reported by PMD.

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

Line: 59

                 */
  public void testToArray_isPlainObjectArray() {
    Object[] array = collection.toArray();
    assertEquals(Object[].class, array.getClass());
  }

  public void testToArray_emptyArray() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);

            

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

                  assertEquals(Object[].class, array.getClass());
  }

  public void testToArray_emptyArray() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);

            

Reported by PMD.

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

Line: 62

                  assertEquals(Object[].class, array.getClass());
  }

  public void testToArray_emptyArray() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);

            

Reported by PMD.

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

Line: 63

                }

  public void testToArray_emptyArray() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);
    expectArrayContentsAnyOrder(createSamplesArray(), array);

            

Reported by PMD.

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

Line: 66

                  E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);
    expectArrayContentsAnyOrder(createSamplesArray(), array);
  }

  @CollectionFeature.Require(KNOWN_ORDER)

            

Reported by PMD.

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

Line: 66

                  E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());
    assertEquals("toArray(emptyT[]).length:", getNumElements(), array.length);
    expectArrayContentsAnyOrder(createSamplesArray(), array);
  }

  @CollectionFeature.Require(KNOWN_ORDER)

            

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

                  expectArrayContentsAnyOrder(createSamplesArray(), array);
  }

  @CollectionFeature.Require(KNOWN_ORDER)
  public void testToArray_emptyArray_ordered() {
    E[] empty = getSubjectGenerator().createArray(0);
    E[] array = collection.toArray(empty);
    assertEquals(
        "toArray(emptyT[]) should return an array of type T", empty.getClass(), array.getClass());

            

Reported by PMD.

android/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java
41 issues
A method or constructor should not explicitly declare unchecked exceptions in its 'throws' clause
Design

Line: 44

                }

  @Override
  protected abstract SortedMap<K, V> makeEmptyMap() throws UnsupportedOperationException;

  @Override
  protected abstract SortedMap<K, V> makePopulatedMap() throws UnsupportedOperationException;

  @Override

            

Reported by PMD.

A method or constructor should not explicitly declare unchecked exceptions in its 'throws' clause
Design

Line: 47

                protected abstract SortedMap<K, V> makeEmptyMap() throws UnsupportedOperationException;

  @Override
  protected abstract SortedMap<K, V> makePopulatedMap() throws UnsupportedOperationException;

  @Override
  protected SortedMap<K, V> makeEitherMap() {
    try {
      return makePopulatedMap();

            

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

                  }
  }

  public void testTailMapWriteThrough() {
    final SortedMap<K, V> map;
    try {
      map = makePopulatedMap();
    } catch (UnsupportedOperationException e) {
      return;

            

Reported by PMD.

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

Line: 58

                  }
  }

  public void testTailMapWriteThrough() {
    final SortedMap<K, V> map;
    try {
      map = makePopulatedMap();
    } catch (UnsupportedOperationException e) {
      return;

            

Reported by PMD.

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

Line: 65

                  } catch (UnsupportedOperationException e) {
      return;
    }
    if (map.size() < 2 || !supportsPut) {
      return;
    }
    Iterator<Entry<K, V>> iterator = map.entrySet().iterator();
    Entry<K, V> firstEntry = iterator.next();
    Entry<K, V> secondEntry = iterator.next();

            

Reported by PMD.

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

Line: 68

                  if (map.size() < 2 || !supportsPut) {
      return;
    }
    Iterator<Entry<K, V>> iterator = map.entrySet().iterator();
    Entry<K, V> firstEntry = iterator.next();
    Entry<K, V> secondEntry = iterator.next();
    K key = secondEntry.getKey();
    SortedMap<K, V> subMap = map.tailMap(key);
    V value = getValueNotInPopulatedMap();

            

Reported by PMD.

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

Line: 68

                  if (map.size() < 2 || !supportsPut) {
      return;
    }
    Iterator<Entry<K, V>> iterator = map.entrySet().iterator();
    Entry<K, V> firstEntry = iterator.next();
    Entry<K, V> secondEntry = iterator.next();
    K key = secondEntry.getKey();
    SortedMap<K, V> subMap = map.tailMap(key);
    V value = getValueNotInPopulatedMap();

            

Reported by PMD.

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

Line: 71

                  Iterator<Entry<K, V>> iterator = map.entrySet().iterator();
    Entry<K, V> firstEntry = iterator.next();
    Entry<K, V> secondEntry = iterator.next();
    K key = secondEntry.getKey();
    SortedMap<K, V> subMap = map.tailMap(key);
    V value = getValueNotInPopulatedMap();
    subMap.put(key, value);
    assertEquals(secondEntry.getValue(), value);
    assertEquals(map.get(key), value);

            

Reported by PMD.

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

Line: 72

                  Entry<K, V> firstEntry = iterator.next();
    Entry<K, V> secondEntry = iterator.next();
    K key = secondEntry.getKey();
    SortedMap<K, V> subMap = map.tailMap(key);
    V value = getValueNotInPopulatedMap();
    subMap.put(key, value);
    assertEquals(secondEntry.getValue(), value);
    assertEquals(map.get(key), value);
    try {

            

Reported by PMD.

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

Line: 74

                  K key = secondEntry.getKey();
    SortedMap<K, V> subMap = map.tailMap(key);
    V value = getValueNotInPopulatedMap();
    subMap.put(key, value);
    assertEquals(secondEntry.getValue(), value);
    assertEquals(map.get(key), value);
    try {
      subMap.put(firstEntry.getKey(), value);
      fail("Expected IllegalArgumentException");

            

Reported by PMD.

android/guava-tests/benchmark/com/google/common/math/ApacheBenchmark.java
41 issues
The class 'ApacheBenchmark' has a Standard Cyclomatic Complexity of 4 (Highest = 11).
Design

Line: 36

               *
 * @author Louis Wasserman
 */
public class ApacheBenchmark {
  private enum Impl {
    GUAVA {
      @Override
      public double factorialDouble(int n) {
        return DoubleMath.factorial(n);

            

Reported by PMD.

The class 'ApacheBenchmark' has a Modified Cyclomatic Complexity of 4 (Highest = 11).
Design

Line: 36

               *
 * @author Louis Wasserman
 */
public class ApacheBenchmark {
  private enum Impl {
    GUAVA {
      @Override
      public double factorialDouble(int n) {
        return DoubleMath.factorial(n);

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 62

                    @Override
      public boolean noAddOverflow(int a, int b) {
        try {
          int unused = IntMath.checkedAdd(a, b);
          return true;
        } catch (ArithmeticException e) {
          return false;
        }
      }

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 72

                    @Override
      public boolean noAddOverflow(long a, long b) {
        try {
          long unused = LongMath.checkedAdd(a, b);
          return true;
        } catch (ArithmeticException e) {
          return false;
        }
      }

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 82

                    @Override
      public boolean noMulOverflow(int a, int b) {
        try {
          int unused = IntMath.checkedMultiply(a, b);
          return true;
        } catch (ArithmeticException e) {
          return false;
        }
      }

            

Reported by PMD.

Avoid unused local variables such as 'unused'.
Design

Line: 92

                    @Override
      public boolean noMulOverflow(long a, long b) {
        try {
          long unused = LongMath.checkedMultiply(a, b);
          return true;
        } catch (ArithmeticException e) {
          return false;
        }
      }

            

Reported by PMD.

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

Line: 117

                  public abstract boolean noMulOverflow(long a, long b);
  }

  private final int[] factorials = new int[ARRAY_SIZE];
  private final int[][] binomials = new int[ARRAY_SIZE][2];
  private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
  private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
  private final int[][] intsToAdd = new int[ARRAY_SIZE][2];
  private final int[][] intsToMul = new int[ARRAY_SIZE][2];

            

Reported by PMD.

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

Line: 118

                }

  private final int[] factorials = new int[ARRAY_SIZE];
  private final int[][] binomials = new int[ARRAY_SIZE][2];
  private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
  private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
  private final int[][] intsToAdd = new int[ARRAY_SIZE][2];
  private final int[][] intsToMul = new int[ARRAY_SIZE][2];
  private final long[][] longsToAdd = new long[ARRAY_SIZE][2];

            

Reported by PMD.

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

Line: 119

              
  private final int[] factorials = new int[ARRAY_SIZE];
  private final int[][] binomials = new int[ARRAY_SIZE][2];
  private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
  private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
  private final int[][] intsToAdd = new int[ARRAY_SIZE][2];
  private final int[][] intsToMul = new int[ARRAY_SIZE][2];
  private final long[][] longsToAdd = new long[ARRAY_SIZE][2];
  private final long[][] longsToMul = new long[ARRAY_SIZE][2];

            

Reported by PMD.

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

Line: 120

                private final int[] factorials = new int[ARRAY_SIZE];
  private final int[][] binomials = new int[ARRAY_SIZE][2];
  private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
  private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
  private final int[][] intsToAdd = new int[ARRAY_SIZE][2];
  private final int[][] intsToMul = new int[ARRAY_SIZE][2];
  private final long[][] longsToAdd = new long[ARRAY_SIZE][2];
  private final long[][] longsToMul = new long[ARRAY_SIZE][2];


            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/ComparatorsTest.java
41 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: 36

               */
@GwtCompatible
public class ComparatorsTest extends TestCase {
  @SuppressWarnings("unchecked") // dang varargs
  public void testLexicographical() {
    Comparator<String> comparator = Ordering.natural();
    Comparator<Iterable<String>> lexy = Comparators.lexicographical(comparator);

    ImmutableList<String> empty = ImmutableList.of();

            

Reported by PMD.

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

Line: 37

              @GwtCompatible
public class ComparatorsTest extends TestCase {
  @SuppressWarnings("unchecked") // dang varargs
  public void testLexicographical() {
    Comparator<String> comparator = Ordering.natural();
    Comparator<Iterable<String>> lexy = Comparators.lexicographical(comparator);

    ImmutableList<String> empty = ImmutableList.of();
    ImmutableList<String> a = ImmutableList.of("a");

            

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

                      .testEquals();
  }

  public void testIsInOrder() {
    assertFalse(Comparators.isInOrder(asList(5, 3, 0, 9), Ordering.natural()));
    assertFalse(Comparators.isInOrder(asList(0, 5, 3, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3, 5, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 0, 3, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3), Ordering.natural()));

            

Reported by PMD.

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

Line: 56

                      .testEquals();
  }

  public void testIsInOrder() {
    assertFalse(Comparators.isInOrder(asList(5, 3, 0, 9), Ordering.natural()));
    assertFalse(Comparators.isInOrder(asList(0, 5, 3, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3, 5, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 0, 3, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3), Ordering.natural()));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 57

                }

  public void testIsInOrder() {
    assertFalse(Comparators.isInOrder(asList(5, 3, 0, 9), Ordering.natural()));
    assertFalse(Comparators.isInOrder(asList(0, 5, 3, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3, 5, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 0, 3, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.singleton(1), Ordering.natural()));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 58

              
  public void testIsInOrder() {
    assertFalse(Comparators.isInOrder(asList(5, 3, 0, 9), Ordering.natural()));
    assertFalse(Comparators.isInOrder(asList(0, 5, 3, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3, 5, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 0, 3, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.singleton(1), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.<Integer>emptyList(), Ordering.natural()));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 59

                public void testIsInOrder() {
    assertFalse(Comparators.isInOrder(asList(5, 3, 0, 9), Ordering.natural()));
    assertFalse(Comparators.isInOrder(asList(0, 5, 3, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3, 5, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 0, 3, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.singleton(1), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.<Integer>emptyList(), Ordering.natural()));
  }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 60

                  assertFalse(Comparators.isInOrder(asList(5, 3, 0, 9), Ordering.natural()));
    assertFalse(Comparators.isInOrder(asList(0, 5, 3, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3, 5, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 0, 3, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.singleton(1), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.<Integer>emptyList(), Ordering.natural()));
  }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 61

                  assertFalse(Comparators.isInOrder(asList(0, 5, 3, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3, 5, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 0, 3, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.singleton(1), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.<Integer>emptyList(), Ordering.natural()));
  }

  public void testIsInStrictOrder() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 62

                  assertTrue(Comparators.isInOrder(asList(0, 3, 5, 9), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 0, 3, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(asList(0, 3), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.singleton(1), Ordering.natural()));
    assertTrue(Comparators.isInOrder(Collections.<Integer>emptyList(), Ordering.natural()));
  }

  public void testIsInStrictOrder() {
    assertFalse(Comparators.isInStrictOrder(asList(5, 3, 0, 9), Ordering.natural()));

            

Reported by PMD.

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

Line: 46

              @SuppressWarnings("unchecked") // too many "unchecked generic array creations"
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
  @MapFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(absent = ZERO)
  public void testRemove_present() {
    int initialSize = getMap().size();
    assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));

            

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

              @GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
  @MapFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(absent = ZERO)
  public void testRemove_present() {
    int initialSize = getMap().size();
    assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
    assertEquals(

            

Reported by PMD.

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

Line: 49

              public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
  @MapFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(absent = ZERO)
  public void testRemove_present() {
    int initialSize = getMap().size();
    assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
    assertEquals(
        "remove(present) should decrease a map's size by one.", initialSize - 1, getMap().size());
    expectMissing(e0());

            

Reported by PMD.

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

Line: 50

                @MapFeature.Require(SUPPORTS_REMOVE)
  @CollectionSize.Require(absent = ZERO)
  public void testRemove_present() {
    int initialSize = getMap().size();
    assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
    assertEquals(
        "remove(present) should decrease a map's size by one.", initialSize - 1, getMap().size());
    expectMissing(e0());
  }

            

Reported by PMD.

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

Line: 51

                @CollectionSize.Require(absent = ZERO)
  public void testRemove_present() {
    int initialSize = getMap().size();
    assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
    assertEquals(
        "remove(present) should decrease a map's size by one.", initialSize - 1, getMap().size());
    expectMissing(e0());
  }


            

Reported by PMD.

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

Line: 53

                  int initialSize = getMap().size();
    assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
    assertEquals(
        "remove(present) should decrease a map's size by one.", initialSize - 1, getMap().size());
    expectMissing(e0());
  }

  @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, 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: 57

                  expectMissing(e0());
  }

  @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
  @CollectionSize.Require(SEVERAL)
  public void testRemovePresentConcurrentWithEntrySetIteration() {
    try {
      Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
      getMap().remove(k0());

            

Reported by PMD.

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

Line: 61

                @CollectionSize.Require(SEVERAL)
  public void testRemovePresentConcurrentWithEntrySetIteration() {
    try {
      Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
      getMap().remove(k0());
      iterator.next();
      fail("Expected ConcurrentModificationException");
    } catch (ConcurrentModificationException expected) {
      // success

            

Reported by PMD.

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

Line: 61

                @CollectionSize.Require(SEVERAL)
  public void testRemovePresentConcurrentWithEntrySetIteration() {
    try {
      Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
      getMap().remove(k0());
      iterator.next();
      fail("Expected ConcurrentModificationException");
    } catch (ConcurrentModificationException expected) {
      // success

            

Reported by PMD.

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

Line: 62

                public void testRemovePresentConcurrentWithEntrySetIteration() {
    try {
      Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
      getMap().remove(k0());
      iterator.next();
      fail("Expected ConcurrentModificationException");
    } catch (ConcurrentModificationException expected) {
      // success
    }

            

Reported by PMD.