The following issues were found

guava-tests/test/com/google/common/primitives/DoublesTest.java
316 issues
Avoid reassigning parameters such as 'input'
Design

Line: 343

                  testReverse(new double[] {-1, 1, -2, 2}, new double[] {2, -2, 1, -1});
  }

  private static void testReverse(double[] input, double[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Doubles.reverse(input);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 350

                }

  private static void testReverse(
      double[] input, int fromIndex, int toIndex, double[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Doubles.reverse(input, fromIndex, toIndex);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 376

                      new double[] {Double.NaN, 2, 1, 0, -0, -1, -2});
  }

  private static void testSortDescending(double[] input, double[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Doubles.sortDescending(input);
    // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
    for (int i = 0; i < input.length; i++) {
      assertEquals(0, Double.compare(expectedOutput[i], input[i]));

            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 386

                }

  private static void testSortDescending(
      double[] input, int fromIndex, int toIndex, double[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Doubles.sortDescending(input, fromIndex, toIndex);
    // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
    for (int i = 0; i < input.length; i++) {
      assertEquals(0, Double.compare(expectedOutput[i], input[i]));

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.primitives;

import static com.google.common.truth.Truth.assertThat;
import static java.lang.Double.NaN;

import com.google.common.annotations.GwtCompatible;

            

Reported by PMD.

Possible God Class (WMC=92, ATFD=37, TCC=6.821%)
Design

Line: 44

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class DoublesTest extends TestCase {
  private static final double[] EMPTY = {};
  private static final double[] ARRAY1 = {(double) 1};
  private static final double[] ARRAY234 = {(double) 2, (double) 3, (double) 4};

  private static final double LEAST = Double.NEGATIVE_INFINITY;

            

Reported by PMD.

The class 'DoublesTest' has a total cyclomatic complexity of 92 (highest 8).
Design

Line: 44

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class DoublesTest extends TestCase {
  private static final double[] EMPTY = {};
  private static final double[] ARRAY1 = {(double) 1};
  private static final double[] ARRAY234 = {(double) 2, (double) 3, (double) 4};

  private static final double LEAST = Double.NEGATIVE_INFINITY;

            

Reported by PMD.

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

Line: 44

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class DoublesTest extends TestCase {
  private static final double[] EMPTY = {};
  private static final double[] ARRAY1 = {(double) 1};
  private static final double[] ARRAY234 = {(double) 2, (double) 3, (double) 4};

  private static final double LEAST = Double.NEGATIVE_INFINITY;

            

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

              
  private static final double[] VALUES = Doubles.concat(NUMBERS, new double[] {NaN});

  public void testHashCode() {
    for (double value : VALUES) {
      assertEquals(((Double) value).hashCode(), Doubles.hashCode(value));
    }
  }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 80

              
  public void testHashCode() {
    for (double value : VALUES) {
      assertEquals(((Double) value).hashCode(), Doubles.hashCode(value));
    }
  }

  public void testIsFinite() {
    for (double value : NUMBERS) {

            

Reported by PMD.

android/guava-tests/test/com/google/common/primitives/LongsTest.java
315 issues
Avoid reassigning parameters such as 'input'
Design

Line: 329

                  testReverse(new long[] {-1, 1, -2, 2}, new long[] {2, -2, 1, -1});
  }

  private static void testReverse(long[] input, long[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Longs.reverse(input);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 335

                  assertTrue(Arrays.equals(expectedOutput, input));
  }

  private static void testReverse(long[] input, int fromIndex, int toIndex, long[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Longs.reverse(input, fromIndex, toIndex);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 358

                  testSortDescending(new long[] {-1, 1, -2, 2}, new long[] {2, 1, -1, -2});
  }

  private static void testSortDescending(long[] input, long[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Longs.sortDescending(input);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 365

                }

  private static void testSortDescending(
      long[] input, int fromIndex, int toIndex, long[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Longs.sortDescending(input, fromIndex, toIndex);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.primitives;

import static java.lang.Long.MAX_VALUE;
import static java.lang.Long.MIN_VALUE;

import com.google.common.annotations.GwtCompatible;

            

Reported by PMD.

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

Line: 44

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class LongsTest extends TestCase {
  private static final long[] EMPTY = {};
  private static final long[] ARRAY1 = {(long) 1};
  private static final long[] ARRAY234 = {(long) 2, (long) 3, (long) 4};

  private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};

            

Reported by PMD.

Possible God Class (WMC=72, ATFD=24, TCC=3.411%)
Design

Line: 44

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class LongsTest extends TestCase {
  private static final long[] EMPTY = {};
  private static final long[] ARRAY1 = {(long) 1};
  private static final long[] ARRAY234 = {(long) 2, (long) 3, (long) 4};

  private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};

            

Reported by PMD.

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

Line: 51

              
  private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};

  @GwtIncompatible // Long.hashCode returns different values in GWT.
  public void testHashCode() {
    for (long value : VALUES) {
      assertEquals("hashCode for " + value, ((Long) value).hashCode(), Longs.hashCode(value));
    }
  }

            

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 testCompare() {
    for (long x : VALUES) {
      for (long y : VALUES) {
        // note: spec requires only that the sign is the same
        assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
      }

            

Reported by PMD.

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

Line: 62

                  for (long x : VALUES) {
      for (long y : VALUES) {
        // note: spec requires only that the sign is the same
        assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
      }
    }
  }

  public void testContains() {

            

Reported by PMD.

guava-tests/test/com/google/common/primitives/LongsTest.java
315 issues
Avoid reassigning parameters such as 'input'
Design

Line: 329

                  testReverse(new long[] {-1, 1, -2, 2}, new long[] {2, -2, 1, -1});
  }

  private static void testReverse(long[] input, long[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Longs.reverse(input);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 335

                  assertTrue(Arrays.equals(expectedOutput, input));
  }

  private static void testReverse(long[] input, int fromIndex, int toIndex, long[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Longs.reverse(input, fromIndex, toIndex);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 358

                  testSortDescending(new long[] {-1, 1, -2, 2}, new long[] {2, 1, -1, -2});
  }

  private static void testSortDescending(long[] input, long[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Longs.sortDescending(input);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 365

                }

  private static void testSortDescending(
      long[] input, int fromIndex, int toIndex, long[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Longs.sortDescending(input, fromIndex, toIndex);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.primitives;

import static java.lang.Long.MAX_VALUE;
import static java.lang.Long.MIN_VALUE;

import com.google.common.annotations.GwtCompatible;

            

Reported by PMD.

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

Line: 44

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class LongsTest extends TestCase {
  private static final long[] EMPTY = {};
  private static final long[] ARRAY1 = {(long) 1};
  private static final long[] ARRAY234 = {(long) 2, (long) 3, (long) 4};

  private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};

            

Reported by PMD.

Possible God Class (WMC=72, ATFD=24, TCC=3.411%)
Design

Line: 44

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class LongsTest extends TestCase {
  private static final long[] EMPTY = {};
  private static final long[] ARRAY1 = {(long) 1};
  private static final long[] ARRAY234 = {(long) 2, (long) 3, (long) 4};

  private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};

            

Reported by PMD.

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

Line: 51

              
  private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};

  @GwtIncompatible // Long.hashCode returns different values in GWT.
  public void testHashCode() {
    for (long value : VALUES) {
      assertEquals("hashCode for " + value, ((Long) value).hashCode(), Longs.hashCode(value));
    }
  }

            

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 testCompare() {
    for (long x : VALUES) {
      for (long y : VALUES) {
        // note: spec requires only that the sign is the same
        assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
      }

            

Reported by PMD.

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

Line: 62

                  for (long x : VALUES) {
      for (long y : VALUES) {
        // note: spec requires only that the sign is the same
        assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
      }
    }
  }

  public void testContains() {

            

Reported by PMD.

android/guava-tests/test/com/google/common/math/StatsTest.java
314 issues
A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.math;

import static com.google.common.math.StatsTesting.ALLOWED_ERROR;
import static com.google.common.math.StatsTesting.ALL_MANY_VALUES;
import static com.google.common.math.StatsTesting.ALL_STATS;
import static com.google.common.math.StatsTesting.EMPTY_STATS_ITERABLE;

            

Reported by PMD.

Possible God Class (WMC=61, ATFD=12, TCC=0.000%)
Design

Line: 89

               *
 * @author Pete Gillin
 */
public class StatsTest extends TestCase {

  public void testCount() {
    assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
    assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);

            

Reported by PMD.

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

Line: 89

               *
 * @author Pete Gillin
 */
public class StatsTest extends TestCase {

  public void testCount() {
    assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
    assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);

            

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

               */
public class StatsTest extends TestCase {

  public void testCount() {
    assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
    assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
    assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
    assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);

            

Reported by PMD.

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

Line: 91

               */
public class StatsTest extends TestCase {

  public void testCount() {
    assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
    assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
    assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
    assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);

            

Reported by PMD.

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

Line: 92

              public class StatsTest extends TestCase {

  public void testCount() {
    assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
    assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
    assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
    assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);

            

Reported by PMD.

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

Line: 93

              
  public void testCount() {
    assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
    assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
    assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
    assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERATOR.count()).isEqualTo(MANY_VALUES_COUNT);

            

Reported by PMD.

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

Line: 94

                public void testCount() {
    assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
    assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
    assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
    assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERATOR.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_SNAPSHOT.count()).isEqualTo(MANY_VALUES_COUNT);

            

Reported by PMD.

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

Line: 95

                  assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
    assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
    assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
    assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERATOR.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_SNAPSHOT.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(INTEGER_MANY_VALUES_STATS_VARARGS.count()).isEqualTo(INTEGER_MANY_VALUES_COUNT);

            

Reported by PMD.

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

Line: 96

                  assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
    assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
    assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
    assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_ITERATOR.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(MANY_VALUES_STATS_SNAPSHOT.count()).isEqualTo(MANY_VALUES_COUNT);
    assertThat(INTEGER_MANY_VALUES_STATS_VARARGS.count()).isEqualTo(INTEGER_MANY_VALUES_COUNT);
    assertThat(INTEGER_MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(INTEGER_MANY_VALUES_COUNT);

            

Reported by PMD.

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

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.collect.testing.Helpers.mapEntry;
import static com.google.common.truth.Truth.assertThat;

import com.google.common.annotations.GwtCompatible;

            

Reported by PMD.

A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.collect.testing.Helpers.mapEntry;
import static com.google.common.truth.Truth.assertThat;

import com.google.common.annotations.GwtCompatible;

            

Reported by PMD.

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

Line: 65

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ImmutableSortedMapTest extends TestCase {
  // TODO: Avoid duplicating code in ImmutableMapTest

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();

            

Reported by PMD.

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

Line: 68

              public class ImmutableSortedMapTest extends TestCase {
  // TODO: Avoid duplicating code in ImmutableMapTest

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ImmutableSortedMapTest.class);

    suite.addTest(

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 143

                  protected void assertMoreInvariants(Map<K, V> map) {
      // TODO: can these be moved to MapInterfaceTest?
      for (Entry<K, V> entry : map.entrySet()) {
        assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
      }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 146

                      assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
      }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());

            

Reported by PMD.

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

Line: 147

                    }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 147

                    }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());

            

Reported by PMD.

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

Line: 148

              
      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 148

              
      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
    }

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java
307 issues
A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.truth.Truth.assertThat;

import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.truth.Truth.assertThat;

import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;

            

Reported by PMD.

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

Line: 59

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ImmutableSortedMapTest extends TestCase {
  // TODO: Avoid duplicating code in ImmutableMapTest

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();

            

Reported by PMD.

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

Line: 62

              public class ImmutableSortedMapTest extends TestCase {
  // TODO: Avoid duplicating code in ImmutableMapTest

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ImmutableSortedMapTest.class);

    suite.addTest(

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 137

                  protected void assertMoreInvariants(Map<K, V> map) {
      // TODO: can these be moved to MapInterfaceTest?
      for (Entry<K, V> entry : map.entrySet()) {
        assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
      }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 140

                      assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
      }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 141

                    }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());

            

Reported by PMD.

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

Line: 141

                    }

      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 142

              
      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
    }

            

Reported by PMD.

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

Line: 142

              
      assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
      assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
      assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
      assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());

      assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
      assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
    }

            

Reported by PMD.

guava-tests/test/com/google/common/collect/ListsTest.java
301 issues
A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;

            

Reported by PMD.

Possible God Class (WMC=84, ATFD=96, TCC=4.638%)
Design

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

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

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

The class 'ListsTest' has a total cyclomatic complexity of 84 (highest 7).
Design

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

The class 'ListsTest' has a Standard Cyclomatic Complexity of 2 (Highest = 17).
Design

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

The class 'ListsTest' has a Modified Cyclomatic Complexity of 2 (Highest = 17).
Design

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 68

              
  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();

  private static final class RemoveFirstFunction implements Function<String, String>, Serializable {
    @Override
    public String apply(String from) {
      return (from.length() == 0) ? from : from.substring(1);
    }
  }

            

Reported by PMD.

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

Line: 101

                  private static final long serialVersionUID = 0;
  }

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ListsTest.class);

    suite.addTest(

            

Reported by PMD.

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

Line: 102

                }

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ListsTest.class);

    suite.addTest(
        ListTestSuiteBuilder.using(

            

Reported by PMD.

guava-tests/test/com/google/common/primitives/FloatsTest.java
301 issues
Avoid reassigning parameters such as 'input'
Design

Line: 325

                  testReverse(new float[] {-1, 1, -2, 2}, new float[] {2, -2, 1, -1});
  }

  private static void testReverse(float[] input, float[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Floats.reverse(input);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 332

                }

  private static void testReverse(
      float[] input, int fromIndex, int toIndex, float[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Floats.reverse(input, fromIndex, toIndex);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 357

                      new float[] {-1, 1, Float.NaN, -2, -0, 0, 2}, new float[] {Float.NaN, 2, 1, 0, -0, -1, -2});
  }

  private static void testSortDescending(float[] input, float[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Floats.sortDescending(input);
    // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
    for (int i = 0; i < input.length; i++) {
      assertEquals(0, Float.compare(expectedOutput[i], input[i]));

            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 367

                }

  private static void testSortDescending(
      float[] input, int fromIndex, int toIndex, float[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Floats.sortDescending(input, fromIndex, toIndex);
    // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
    for (int i = 0; i < input.length; i++) {
      assertEquals(0, Float.compare(expectedOutput[i], input[i]));

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.primitives;

import static com.google.common.truth.Truth.assertThat;
import static java.lang.Float.NaN;

import com.google.common.annotations.GwtCompatible;

            

Reported by PMD.

The class 'FloatsTest' has a total cyclomatic complexity of 86 (highest 8).
Design

Line: 43

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
  private static final float[] EMPTY = {};
  private static final float[] ARRAY1 = {(float) 1};
  private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};

  private static final float LEAST = Float.NEGATIVE_INFINITY;

            

Reported by PMD.

Possible God Class (WMC=86, ATFD=35, TCC=6.410%)
Design

Line: 43

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
  private static final float[] EMPTY = {};
  private static final float[] ARRAY1 = {(float) 1};
  private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};

  private static final float LEAST = Float.NEGATIVE_INFINITY;

            

Reported by PMD.

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

Line: 43

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
  private static final float[] EMPTY = {};
  private static final float[] ARRAY1 = {(float) 1};
  private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};

  private static final float LEAST = Float.NEGATIVE_INFINITY;

            

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

              
  private static final float[] VALUES = Floats.concat(NUMBERS, new float[] {NaN});

  public void testHashCode() {
    for (float value : VALUES) {
      assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
    }
  }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 75

              
  public void testHashCode() {
    for (float value : VALUES) {
      assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
    }
  }

  public void testIsFinite() {
    for (float value : NUMBERS) {

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/ListsTest.java
301 issues
A high number of imports can indicate a high degree of coupling within an object.
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;

            

Reported by PMD.

Possible God Class (WMC=84, ATFD=96, TCC=4.638%)
Design

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

The class 'ListsTest' has a Modified Cyclomatic Complexity of 2 (Highest = 17).
Design

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

The class 'ListsTest' has a Standard Cyclomatic Complexity of 2 (Highest = 17).
Design

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

The class 'ListsTest' has a total cyclomatic complexity of 84 (highest 7).
Design

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

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

Line: 62

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {

  private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);

  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();


            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 68

              
  private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();

  private static final class RemoveFirstFunction implements Function<String, String>, Serializable {
    @Override
    public String apply(String from) {
      return (from.length() == 0) ? from : from.substring(1);
    }
  }

            

Reported by PMD.

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

Line: 101

                  private static final long serialVersionUID = 0;
  }

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ListsTest.class);

    suite.addTest(

            

Reported by PMD.

Avoid really long methods.
Design

Line: 102

                }

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ListsTest.class);

    suite.addTest(
        ListTestSuiteBuilder.using(

            

Reported by PMD.

android/guava-tests/test/com/google/common/primitives/FloatsTest.java
301 issues
Avoid reassigning parameters such as 'input'
Design

Line: 325

                  testReverse(new float[] {-1, 1, -2, 2}, new float[] {2, -2, 1, -1});
  }

  private static void testReverse(float[] input, float[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Floats.reverse(input);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 332

                }

  private static void testReverse(
      float[] input, int fromIndex, int toIndex, float[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Floats.reverse(input, fromIndex, toIndex);
    assertTrue(Arrays.equals(expectedOutput, input));
  }


            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 357

                      new float[] {-1, 1, Float.NaN, -2, -0, 0, 2}, new float[] {Float.NaN, 2, 1, 0, -0, -1, -2});
  }

  private static void testSortDescending(float[] input, float[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Floats.sortDescending(input);
    // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
    for (int i = 0; i < input.length; i++) {
      assertEquals(0, Float.compare(expectedOutput[i], input[i]));

            

Reported by PMD.

Avoid reassigning parameters such as 'input'
Design

Line: 367

                }

  private static void testSortDescending(
      float[] input, int fromIndex, int toIndex, float[] expectedOutput) {
    input = Arrays.copyOf(input, input.length);
    Floats.sortDescending(input, fromIndex, toIndex);
    // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
    for (int i = 0; i < input.length; i++) {
      assertEquals(0, Float.compare(expectedOutput[i], input[i]));

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.primitives;

import static com.google.common.truth.Truth.assertThat;
import static java.lang.Float.NaN;

import com.google.common.annotations.GwtCompatible;

            

Reported by PMD.

Possible God Class (WMC=86, ATFD=35, TCC=6.410%)
Design

Line: 43

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
  private static final float[] EMPTY = {};
  private static final float[] ARRAY1 = {(float) 1};
  private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};

  private static final float LEAST = Float.NEGATIVE_INFINITY;

            

Reported by PMD.

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

Line: 43

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
  private static final float[] EMPTY = {};
  private static final float[] ARRAY1 = {(float) 1};
  private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};

  private static final float LEAST = Float.NEGATIVE_INFINITY;

            

Reported by PMD.

The class 'FloatsTest' has a total cyclomatic complexity of 86 (highest 8).
Design

Line: 43

               */
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
  private static final float[] EMPTY = {};
  private static final float[] ARRAY1 = {(float) 1};
  private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};

  private static final float LEAST = Float.NEGATIVE_INFINITY;

            

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

              
  private static final float[] VALUES = Floats.concat(NUMBERS, new float[] {NaN});

  public void testHashCode() {
    for (float value : VALUES) {
      assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
    }
  }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 75

              
  public void testHashCode() {
    for (float value : VALUES) {
      assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
    }
  }

  public void testIsFinite() {
    for (float value : NUMBERS) {

            

Reported by PMD.