The following issues were found

android/guava-tests/test/com/google/common/collect/IteratorsTest.java
825 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.collect.CollectPreconditions.checkRemove;
import static com.google.common.collect.Iterators.advance;
import static com.google.common.collect.Iterators.get;
import static com.google.common.collect.Iterators.getLast;

            

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.collect.CollectPreconditions.checkRemove;
import static com.google.common.collect.Iterators.advance;
import static com.google.common.collect.Iterators.get;
import static com.google.common.collect.Iterators.getLast;

            

Reported by PMD.

The class 'IteratorsTest' has a total cyclomatic complexity of 197 (highest 6).
Design

Line: 67

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());

            

Reported by PMD.

Possible God Class (WMC=197, ATFD=42, TCC=0.000%)
Design

Line: 67

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());

            

Reported by PMD.

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

Line: 67

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());

            

Reported by PMD.

Avoid really long classes.
Design

Line: 67

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());

            

Reported by PMD.

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

Line: 69

              @GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());
    suite.addTestSuite(IteratorsTest.class);
    return suite;

            

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

                  return suite;
  }

  public void testEmptyIterator() {
    Iterator<String> iterator = Iterators.emptyIterator();
    assertFalse(iterator.hasNext());
    try {
      iterator.next();
      fail("no exception thrown");

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 79

              
  public void testEmptyIterator() {
    Iterator<String> iterator = Iterators.emptyIterator();
    assertFalse(iterator.hasNext());
    try {
      iterator.next();
      fail("no exception thrown");
    } catch (NoSuchElementException expected) {
    }

            

Reported by PMD.

The String literal 'no exception thrown' appears 13 times in this file; the first occurrence is on line 82
Error

Line: 82

                  assertFalse(iterator.hasNext());
    try {
      iterator.next();
      fail("no exception thrown");
    } catch (NoSuchElementException expected) {
    }
    try {
      iterator.remove();
      fail("no exception thrown");

            

Reported by PMD.

guava-tests/test/com/google/common/collect/IteratorsTest.java
825 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.collect.CollectPreconditions.checkRemove;
import static com.google.common.collect.Iterators.advance;
import static com.google.common.collect.Iterators.get;
import static com.google.common.collect.Iterators.getLast;

            

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.collect.CollectPreconditions.checkRemove;
import static com.google.common.collect.Iterators.advance;
import static com.google.common.collect.Iterators.get;
import static com.google.common.collect.Iterators.getLast;

            

Reported by PMD.

The class 'IteratorsTest' has a total cyclomatic complexity of 197 (highest 6).
Design

Line: 67

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());

            

Reported by PMD.

Possible God Class (WMC=197, ATFD=42, TCC=0.000%)
Design

Line: 67

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());

            

Reported by PMD.

Avoid really long classes.
Design

Line: 67

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());

            

Reported by PMD.

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

Line: 67

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());

            

Reported by PMD.

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

Line: 69

              @GwtCompatible(emulated = true)
public class IteratorsTest extends TestCase {

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite(IteratorsTest.class.getSimpleName());
    suite.addTest(testsForRemoveAllAndRetainAll());
    suite.addTestSuite(IteratorsTest.class);
    return suite;

            

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

                  return suite;
  }

  public void testEmptyIterator() {
    Iterator<String> iterator = Iterators.emptyIterator();
    assertFalse(iterator.hasNext());
    try {
      iterator.next();
      fail("no exception thrown");

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 79

              
  public void testEmptyIterator() {
    Iterator<String> iterator = Iterators.emptyIterator();
    assertFalse(iterator.hasNext());
    try {
      iterator.next();
      fail("no exception thrown");
    } catch (NoSuchElementException expected) {
    }

            

Reported by PMD.

The String literal 'no exception thrown' appears 13 times in this file; the first occurrence is on line 82
Error

Line: 82

                  assertFalse(iterator.hasNext());
    try {
      iterator.next();
      fail("no exception thrown");
    } catch (NoSuchElementException expected) {
    }
    try {
      iterator.remove();
      fail("no exception thrown");

            

Reported by PMD.

guava-tests/test/com/google/common/collect/MapMakerInternalMapTest.java
638 issues
Possible God Class (WMC=66, ATFD=219, TCC=0.135%)
Design

Line: 35

              
/** @author Charles Fry */
@SuppressWarnings("deprecation") // many tests of deprecated methods
public class MapMakerInternalMapTest extends TestCase {

  static final int SMALL_MAX_SIZE = DRAIN_THRESHOLD * 5;

  private static <K, V>
      MapMakerInternalMap<K, V, ? extends InternalEntry<K, V, ?>, ? extends Segment<K, V, ?, ?>>

            

Reported by PMD.

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

Line: 35

              
/** @author Charles Fry */
@SuppressWarnings("deprecation") // many tests of deprecated methods
public class MapMakerInternalMapTest extends TestCase {

  static final int SMALL_MAX_SIZE = DRAIN_THRESHOLD * 5;

  private static <K, V>
      MapMakerInternalMap<K, V, ? extends InternalEntry<K, V, ?>, ? extends Segment<K, V, ?, ?>>

            

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

              
  // constructor tests

  public void testDefaults() {
    MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);

            

Reported by PMD.

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

Line: 53

              
  // constructor tests

  public void testDefaults() {
    MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);

            

Reported by PMD.

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

Line: 56

                public void testDefaults() {
    MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 56

                public void testDefaults() {
    MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 57

                  MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)
        .isInstanceOf(MapMakerInternalMap.StrongKeyStrongValueEntry.Helper.class);

            

Reported by PMD.

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

Line: 57

                  MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)
        .isInstanceOf(MapMakerInternalMap.StrongKeyStrongValueEntry.Helper.class);

            

Reported by PMD.

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

Line: 58

              
    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)
        .isInstanceOf(MapMakerInternalMap.StrongKeyStrongValueEntry.Helper.class);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 58

              
    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)
        .isInstanceOf(MapMakerInternalMap.StrongKeyStrongValueEntry.Helper.class);


            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/MapMakerInternalMapTest.java
638 issues
This class has too many methods, consider refactoring it.
Design

Line: 35

              
/** @author Charles Fry */
@SuppressWarnings("deprecation") // many tests of deprecated methods
public class MapMakerInternalMapTest extends TestCase {

  static final int SMALL_MAX_SIZE = DRAIN_THRESHOLD * 5;

  private static <K, V>
      MapMakerInternalMap<K, V, ? extends InternalEntry<K, V, ?>, ? extends Segment<K, V, ?, ?>>

            

Reported by PMD.

Possible God Class (WMC=66, ATFD=219, TCC=0.135%)
Design

Line: 35

              
/** @author Charles Fry */
@SuppressWarnings("deprecation") // many tests of deprecated methods
public class MapMakerInternalMapTest extends TestCase {

  static final int SMALL_MAX_SIZE = DRAIN_THRESHOLD * 5;

  private static <K, V>
      MapMakerInternalMap<K, V, ? extends InternalEntry<K, V, ?>, ? extends Segment<K, V, ?, ?>>

            

Reported by PMD.

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

Line: 53

              
  // constructor tests

  public void testDefaults() {
    MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);

            

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

              
  // constructor tests

  public void testDefaults() {
    MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 56

                public void testDefaults() {
    MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)

            

Reported by PMD.

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

Line: 56

                public void testDefaults() {
    MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)

            

Reported by PMD.

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

Line: 57

                  MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)
        .isInstanceOf(MapMakerInternalMap.StrongKeyStrongValueEntry.Helper.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 57

                  MapMakerInternalMap<Object, Object, ?, ?> map = makeMap(createMapMaker());

    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)
        .isInstanceOf(MapMakerInternalMap.StrongKeyStrongValueEntry.Helper.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 58

              
    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)
        .isInstanceOf(MapMakerInternalMap.StrongKeyStrongValueEntry.Helper.class);


            

Reported by PMD.

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

Line: 58

              
    assertSame(Strength.STRONG, map.keyStrength());
    assertSame(Strength.STRONG, map.valueStrength());
    assertSame(map.keyStrength().defaultEquivalence(), map.keyEquivalence);
    assertSame(map.valueStrength().defaultEquivalence(), map.valueEquivalence());

    assertThat(map.entryHelper)
        .isInstanceOf(MapMakerInternalMap.StrongKeyStrongValueEntry.Helper.class);


            

Reported by PMD.

guava-tests/test/com/google/common/collect/IterablesTest.java
636 issues
Avoid using a branching statement as the last in a loop.
Error

Line: 385

                  // always point to "a".
    for (String string : cycle) {
      assertEquals("a", string);
      break;
    }

    assertEquals("[a, b] (cycled)", cycle.toString());
  }


            

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.collect.Iterables.skip;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newLinkedHashSet;
import static com.google.common.collect.testing.IteratorFeature.MODIFIABLE;

            

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.Iterables.skip;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newLinkedHashSet;
import static com.google.common.collect.testing.IteratorFeature.MODIFIABLE;

            

Reported by PMD.

Avoid really long classes.
Design

Line: 58

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

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

            

Reported by PMD.

Possible God Class (WMC=171, ATFD=60, TCC=0.010%)
Design

Line: 58

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

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

            

Reported by PMD.

The class 'IterablesTest' has a total cyclomatic complexity of 171 (highest 5).
Design

Line: 58

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

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

            

Reported by PMD.

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

Line: 58

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

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

            

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

              @GwtCompatible(emulated = true)
public class IterablesTest extends TestCase {

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

  public void testSize1Collection() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 62

              
  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

  public void testSize1Collection() {
    Iterable<String> iterable = Collections.singleton("a");
    assertEquals(1, Iterables.size(iterable));

            

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

                  assertEquals(0, Iterables.size(iterable));
  }

  public void testSize1Collection() {
    Iterable<String> iterable = Collections.singleton("a");
    assertEquals(1, Iterables.size(iterable));
  }

  public void testSize2NonCollection() {

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/IterablesTest.java
617 issues
Avoid using a branching statement as the last in a loop.
Error

Line: 356

                  // always point to "a".
    for (String string : cycle) {
      assertEquals("a", string);
      break;
    }

    assertEquals("[a, b] (cycled)", cycle.toString());
  }


            

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.collect.Iterables.skip;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newLinkedHashSet;
import static com.google.common.collect.testing.IteratorFeature.MODIFIABLE;

            

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.Iterables.skip;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newLinkedHashSet;
import static com.google.common.collect.testing.IteratorFeature.MODIFIABLE;

            

Reported by PMD.

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

Line: 58

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

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

            

Reported by PMD.

The class 'IterablesTest' has a total cyclomatic complexity of 168 (highest 5).
Design

Line: 58

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

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

            

Reported by PMD.

Avoid really long classes.
Design

Line: 58

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

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

            

Reported by PMD.

Possible God Class (WMC=168, ATFD=56, TCC=0.010%)
Design

Line: 58

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

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

            

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

              @GwtCompatible(emulated = true)
public class IterablesTest extends TestCase {

  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

  public void testSize1Collection() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 62

              
  public void testSize0() {
    Iterable<String> iterable = Collections.emptySet();
    assertEquals(0, Iterables.size(iterable));
  }

  public void testSize1Collection() {
    Iterable<String> iterable = Collections.singleton("a");
    assertEquals(1, Iterables.size(iterable));

            

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

                  assertEquals(0, Iterables.size(iterable));
  }

  public void testSize1Collection() {
    Iterable<String> iterable = Collections.singleton("a");
    assertEquals(1, Iterables.size(iterable));
  }

  public void testSize2NonCollection() {

            

Reported by PMD.

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

Line: 851

                  assertEquals(makePopulatedMap(), map);
    assertFalse(map.equals(Collections.emptyMap()));
    // no-inspection ObjectEqualsNull
    assertFalse(map.equals(null));
  }

  public void testEqualsForLargerMap() {
    if (!supportsPut) {
      return;

            

Reported by PMD.

Avoid using equals() to compare against null
Error

Line: 903

                  assertEquals(Collections.emptyMap(), map);
    assertFalse(map.equals(Collections.emptySet()));
    // noinspection ObjectEqualsNull
    assertFalse(map.equals(null));
  }

  public void testGet() {
    final Map<K, V> map;
    try {

            

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.testing;

import static java.util.Collections.singleton;

import com.google.common.annotations.GwtCompatible;
import java.util.Arrays;

            

Reported by PMD.

The class 'MapInterfaceTest' has a total cyclomatic complexity of 247 (highest 10).
Design

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

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

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

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

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

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

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

Avoid really long classes.
Design

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

Possible God Class (WMC=247, ATFD=63, TCC=19.090%)
Design

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

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

Line: 55

                  }
  }

  protected final boolean supportsPut;
  protected final boolean supportsRemove;
  protected final boolean supportsClear;
  protected final boolean allowsNullKeys;
  protected final boolean allowsNullValues;
  protected final boolean supportsIteratorRemove;

            

Reported by PMD.

guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java
614 issues
Avoid using equals() to compare against null
Error

Line: 851

                  assertEquals(makePopulatedMap(), map);
    assertFalse(map.equals(Collections.emptyMap()));
    // no-inspection ObjectEqualsNull
    assertFalse(map.equals(null));
  }

  public void testEqualsForLargerMap() {
    if (!supportsPut) {
      return;

            

Reported by PMD.

Avoid using equals() to compare against null
Error

Line: 903

                  assertEquals(Collections.emptyMap(), map);
    assertFalse(map.equals(Collections.emptySet()));
    // noinspection ObjectEqualsNull
    assertFalse(map.equals(null));
  }

  public void testGet() {
    final Map<K, V> map;
    try {

            

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.testing;

import static java.util.Collections.singleton;

import com.google.common.annotations.GwtCompatible;
import java.util.Arrays;

            

Reported by PMD.

Possible God Class (WMC=247, ATFD=63, TCC=19.090%)
Design

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

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

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

The class 'MapInterfaceTest' has a total cyclomatic complexity of 247 (highest 10).
Design

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

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

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

Avoid really long classes.
Design

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

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

Line: 45

              // check the order if so.
// TODO: Refactor to share code with SetTestBuilder etc.
@GwtCompatible
public abstract class MapInterfaceTest<K, V> extends TestCase {

  /** A key type that is not assignable to any classes but Object. */
  private static final class IncompatibleKeyType {
    @Override
    public String toString() {

            

Reported by PMD.

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

Line: 55

                  }
  }

  protected final boolean supportsPut;
  protected final boolean supportsRemove;
  protected final boolean supportsClear;
  protected final boolean allowsNullKeys;
  protected final boolean allowsNullValues;
  protected final boolean supportsIteratorRemove;

            

Reported by PMD.

android/guava-tests/test/com/google/common/collect/RangeTest.java
579 issues
Possible God Class (WMC=65, ATFD=25, TCC=0.000%)
Design

Line: 42

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class RangeTest extends TestCase {
  public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());

            

Reported by PMD.

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

Line: 42

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class RangeTest extends TestCase {
  public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());

            

Reported by PMD.

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

Line: 43

               */
@GwtCompatible(emulated = true)
public class RangeTest extends TestCase {
  public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());

            

Reported by PMD.

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

Line: 43

               */
@GwtCompatible(emulated = true)
public class RangeTest extends TestCase {
  public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 46

                public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());

            

Reported by PMD.

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

Line: 46

                public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());

            

Reported by PMD.

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

Line: 47

                  Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());
    assertFalse(range.isEmpty());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

                  Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());
    assertFalse(range.isEmpty());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 48

                  checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());
    assertFalse(range.isEmpty());
    assertEquals("(4..8)", range.toString());

            

Reported by PMD.

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

Line: 48

                  checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());
    assertFalse(range.isEmpty());
    assertEquals("(4..8)", range.toString());

            

Reported by PMD.

guava-tests/test/com/google/common/collect/RangeTest.java
579 issues
Possible God Class (WMC=65, ATFD=25, TCC=0.000%)
Design

Line: 42

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class RangeTest extends TestCase {
  public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());

            

Reported by PMD.

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

Line: 42

               * @author Kevin Bourrillion
 */
@GwtCompatible(emulated = true)
public class RangeTest extends TestCase {
  public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());

            

Reported by PMD.

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

Line: 43

               */
@GwtCompatible(emulated = true)
public class RangeTest extends TestCase {
  public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());

            

Reported by PMD.

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

Line: 43

               */
@GwtCompatible(emulated = true)
public class RangeTest extends TestCase {
  public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());

            

Reported by PMD.

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

Line: 46

                public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 46

                public void testOpen() {
    Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());

            

Reported by PMD.

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

Line: 47

                  Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());
    assertFalse(range.isEmpty());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

                  Range<Integer> range = Range.open(4, 8);
    checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());
    assertFalse(range.isEmpty());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 48

                  checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());
    assertFalse(range.isEmpty());
    assertEquals("(4..8)", range.toString());

            

Reported by PMD.

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

Line: 48

                  checkContains(range);
    assertTrue(range.hasLowerBound());
    assertEquals(4, (int) range.lowerEndpoint());
    assertEquals(OPEN, range.lowerBoundType());
    assertTrue(range.hasUpperBound());
    assertEquals(8, (int) range.upperEndpoint());
    assertEquals(OPEN, range.upperBoundType());
    assertFalse(range.isEmpty());
    assertEquals("(4..8)", range.toString());

            

Reported by PMD.