The following issues were found

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

Line: 46

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class TreeBasedTableTest extends AbstractTableTest {
  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(TreeBasedTableTest.class);
    suite.addTestSuite(TreeRowTest.class);

            

Reported by PMD.

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

Line: 47

               */
@GwtCompatible(emulated = true)
public class TreeBasedTableTest extends AbstractTableTest {
  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(TreeBasedTableTest.class);
    suite.addTestSuite(TreeRowTest.class);
    suite.addTest(

            

Reported by PMD.

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

Line: 58

                                @Override
                  protected SortedMap<String, String> create(Entry<String, String>[] entries) {
                    TreeBasedTable<String, String, String> table = TreeBasedTable.create();
                    table.put("a", "b", "c");
                    table.put("c", "b", "a");
                    table.put("a", "a", "d");
                    for (Entry<String, String> entry : entries) {
                      table.put("b", entry.getKey(), entry.getValue());
                    }

            

Reported by PMD.

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

Line: 59

                                protected SortedMap<String, String> create(Entry<String, String>[] entries) {
                    TreeBasedTable<String, String, String> table = TreeBasedTable.create();
                    table.put("a", "b", "c");
                    table.put("c", "b", "a");
                    table.put("a", "a", "d");
                    for (Entry<String, String> entry : entries) {
                      table.put("b", entry.getKey(), entry.getValue());
                    }
                    return table.row("b");

            

Reported by PMD.

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

Line: 60

                                  TreeBasedTable<String, String, String> table = TreeBasedTable.create();
                    table.put("a", "b", "c");
                    table.put("c", "b", "a");
                    table.put("a", "a", "d");
                    for (Entry<String, String> entry : entries) {
                      table.put("b", entry.getKey(), entry.getValue());
                    }
                    return table.row("b");
                  }

            

Reported by PMD.

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

Line: 64

                                  for (Entry<String, String> entry : entries) {
                      table.put("b", entry.getKey(), entry.getValue());
                    }
                    return table.row("b");
                  }
                })
            .withFeatures(
                MapFeature.GENERAL_PURPOSE,
                CollectionFeature.SUPPORTS_ITERATOR_REMOVE,

            

Reported by PMD.

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

Line: 84

                  @Override
    protected SortedMap<String, String> makeEmptyMap() {
      TreeBasedTable<String, String, String> table = TreeBasedTable.create();
      table.put("a", "b", "c");
      table.put("c", "b", "a");
      table.put("a", "a", "d");
      return table.row("b");
    }


            

Reported by PMD.

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

Line: 85

                  protected SortedMap<String, String> makeEmptyMap() {
      TreeBasedTable<String, String, String> table = TreeBasedTable.create();
      table.put("a", "b", "c");
      table.put("c", "b", "a");
      table.put("a", "a", "d");
      return table.row("b");
    }

    @Override

            

Reported by PMD.

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

Line: 86

                    TreeBasedTable<String, String, String> table = TreeBasedTable.create();
      table.put("a", "b", "c");
      table.put("c", "b", "a");
      table.put("a", "a", "d");
      return table.row("b");
    }

    @Override
    protected SortedMap<String, String> makePopulatedMap() {

            

Reported by PMD.

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

Line: 87

                    table.put("a", "b", "c");
      table.put("c", "b", "a");
      table.put("a", "a", "d");
      return table.row("b");
    }

    @Override
    protected SortedMap<String, String> makePopulatedMap() {
      TreeBasedTable<String, String, String> table = TreeBasedTable.create();

            

Reported by PMD.

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

Line: 46

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class TreeBasedTableTest extends AbstractTableTest {
  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(TreeBasedTableTest.class);
    suite.addTestSuite(TreeRowTest.class);

            

Reported by PMD.

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

Line: 47

               */
@GwtCompatible(emulated = true)
public class TreeBasedTableTest extends AbstractTableTest {
  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(TreeBasedTableTest.class);
    suite.addTestSuite(TreeRowTest.class);
    suite.addTest(

            

Reported by PMD.

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

Line: 58

                                @Override
                  protected SortedMap<String, String> create(Entry<String, String>[] entries) {
                    TreeBasedTable<String, String, String> table = TreeBasedTable.create();
                    table.put("a", "b", "c");
                    table.put("c", "b", "a");
                    table.put("a", "a", "d");
                    for (Entry<String, String> entry : entries) {
                      table.put("b", entry.getKey(), entry.getValue());
                    }

            

Reported by PMD.

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

Line: 59

                                protected SortedMap<String, String> create(Entry<String, String>[] entries) {
                    TreeBasedTable<String, String, String> table = TreeBasedTable.create();
                    table.put("a", "b", "c");
                    table.put("c", "b", "a");
                    table.put("a", "a", "d");
                    for (Entry<String, String> entry : entries) {
                      table.put("b", entry.getKey(), entry.getValue());
                    }
                    return table.row("b");

            

Reported by PMD.

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

Line: 60

                                  TreeBasedTable<String, String, String> table = TreeBasedTable.create();
                    table.put("a", "b", "c");
                    table.put("c", "b", "a");
                    table.put("a", "a", "d");
                    for (Entry<String, String> entry : entries) {
                      table.put("b", entry.getKey(), entry.getValue());
                    }
                    return table.row("b");
                  }

            

Reported by PMD.

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

Line: 64

                                  for (Entry<String, String> entry : entries) {
                      table.put("b", entry.getKey(), entry.getValue());
                    }
                    return table.row("b");
                  }
                })
            .withFeatures(
                MapFeature.GENERAL_PURPOSE,
                CollectionFeature.SUPPORTS_ITERATOR_REMOVE,

            

Reported by PMD.

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

Line: 84

                  @Override
    protected SortedMap<String, String> makeEmptyMap() {
      TreeBasedTable<String, String, String> table = TreeBasedTable.create();
      table.put("a", "b", "c");
      table.put("c", "b", "a");
      table.put("a", "a", "d");
      return table.row("b");
    }


            

Reported by PMD.

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

Line: 85

                  protected SortedMap<String, String> makeEmptyMap() {
      TreeBasedTable<String, String, String> table = TreeBasedTable.create();
      table.put("a", "b", "c");
      table.put("c", "b", "a");
      table.put("a", "a", "d");
      return table.row("b");
    }

    @Override

            

Reported by PMD.

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

Line: 86

                    TreeBasedTable<String, String, String> table = TreeBasedTable.create();
      table.put("a", "b", "c");
      table.put("c", "b", "a");
      table.put("a", "a", "d");
      return table.row("b");
    }

    @Override
    protected SortedMap<String, String> makePopulatedMap() {

            

Reported by PMD.

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

Line: 87

                    table.put("a", "b", "c");
      table.put("c", "b", "a");
      table.put("a", "a", "d");
      return table.row("b");
    }

    @Override
    protected SortedMap<String, String> makePopulatedMap() {
      TreeBasedTable<String, String, String> table = TreeBasedTable.create();

            

Reported by PMD.

android/guava-tests/test/com/google/common/graph/AbstractStandardDirectedGraphTest.java
179 issues
This class has too many methods, consider refactoring it.
Design

Line: 31

              /**
 * Abstract base class for testing directed {@link Graph} implementations defined in this package.
 */
public abstract class AbstractStandardDirectedGraphTest extends AbstractGraphTest {

  @Override
  @Test
  public void nodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

            

Reported by PMD.

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

Line: 36

                @Override
  @Test
  public void nodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    Set<Integer> nodes = graph.nodes();
    try {
      nodes.add(N2);
      fail(ERROR_MODIFIABLE_SET);

            

Reported by PMD.

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

Line: 36

                @Override
  @Test
  public void nodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    Set<Integer> nodes = graph.nodes();
    try {
      nodes.add(N2);
      fail(ERROR_MODIFIABLE_SET);

            

Reported by PMD.

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

Line: 44

                    fail(ERROR_MODIFIABLE_SET);
    } catch (UnsupportedOperationException e) {
      addNode(N1);
      assertThat(graph.nodes()).containsExactlyElementsIn(nodes);
    }
  }

  @Override
  @Test

            

Reported by PMD.

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

Line: 51

                @Override
  @Test
  public void adjacentNodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    addNode(N1);
    Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
    try {
      adjacentNodes.add(N2);

            

Reported by PMD.

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

Line: 51

                @Override
  @Test
  public void adjacentNodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    addNode(N1);
    Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
    try {
      adjacentNodes.add(N2);

            

Reported by PMD.

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

Line: 60

                    fail(ERROR_MODIFIABLE_SET);
    } catch (UnsupportedOperationException e) {
      putEdge(N1, N2);
      assertThat(graph.adjacentNodes(N1)).containsExactlyElementsIn(adjacentNodes);
    }
  }

  @Override
  @Test

            

Reported by PMD.

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

Line: 67

                @Override
  @Test
  public void predecessors_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    addNode(N2);
    Set<Integer> predecessors = graph.predecessors(N2);
    try {
      predecessors.add(N1);

            

Reported by PMD.

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

Line: 67

                @Override
  @Test
  public void predecessors_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    addNode(N2);
    Set<Integer> predecessors = graph.predecessors(N2);
    try {
      predecessors.add(N1);

            

Reported by PMD.

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

Line: 76

                    fail(ERROR_MODIFIABLE_SET);
    } catch (UnsupportedOperationException e) {
      putEdge(N1, N2);
      assertThat(graph.predecessors(N2)).containsExactlyElementsIn(predecessors);
    }
  }

  @Override
  @Test

            

Reported by PMD.

guava-tests/test/com/google/common/graph/AbstractStandardDirectedGraphTest.java
179 issues
This class has too many methods, consider refactoring it.
Design

Line: 31

              /**
 * Abstract base class for testing directed {@link Graph} implementations defined in this package.
 */
public abstract class AbstractStandardDirectedGraphTest extends AbstractGraphTest {

  @Override
  @Test
  public void nodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

            

Reported by PMD.

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

Line: 36

                @Override
  @Test
  public void nodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    Set<Integer> nodes = graph.nodes();
    try {
      nodes.add(N2);
      fail(ERROR_MODIFIABLE_SET);

            

Reported by PMD.

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

Line: 36

                @Override
  @Test
  public void nodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    Set<Integer> nodes = graph.nodes();
    try {
      nodes.add(N2);
      fail(ERROR_MODIFIABLE_SET);

            

Reported by PMD.

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

Line: 44

                    fail(ERROR_MODIFIABLE_SET);
    } catch (UnsupportedOperationException e) {
      addNode(N1);
      assertThat(graph.nodes()).containsExactlyElementsIn(nodes);
    }
  }

  @Override
  @Test

            

Reported by PMD.

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

Line: 51

                @Override
  @Test
  public void adjacentNodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    addNode(N1);
    Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
    try {
      adjacentNodes.add(N2);

            

Reported by PMD.

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

Line: 51

                @Override
  @Test
  public void adjacentNodes_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    addNode(N1);
    Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
    try {
      adjacentNodes.add(N2);

            

Reported by PMD.

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

Line: 60

                    fail(ERROR_MODIFIABLE_SET);
    } catch (UnsupportedOperationException e) {
      putEdge(N1, N2);
      assertThat(graph.adjacentNodes(N1)).containsExactlyElementsIn(adjacentNodes);
    }
  }

  @Override
  @Test

            

Reported by PMD.

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

Line: 67

                @Override
  @Test
  public void predecessors_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    addNode(N2);
    Set<Integer> predecessors = graph.predecessors(N2);
    try {
      predecessors.add(N1);

            

Reported by PMD.

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

Line: 67

                @Override
  @Test
  public void predecessors_checkReturnedSetMutability() {
    assume().that(graphIsMutable()).isTrue();

    addNode(N2);
    Set<Integer> predecessors = graph.predecessors(N2);
    try {
      predecessors.add(N1);

            

Reported by PMD.

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

Line: 76

                    fail(ERROR_MODIFIABLE_SET);
    } catch (UnsupportedOperationException e) {
      putEdge(N1, N2);
      assertThat(graph.predecessors(N2)).containsExactlyElementsIn(predecessors);
    }
  }

  @Override
  @Test

            

Reported by PMD.

android/guava-tests/test/com/google/common/net/InternetDomainNameTest.java
179 issues
Possible God Class (WMC=47, ATFD=35, TCC=1.449%)
Design

Line: 36

               * @author Craig Berry
 */
@GwtCompatible(emulated = true)
public final class InternetDomainNameTest extends TestCase {
  private static final InternetDomainName UNICODE_EXAMPLE =
      InternetDomainName.from("j\u00f8rpeland.no");
  private static final InternetDomainName PUNYCODE_EXAMPLE =
      InternetDomainName.from("xn--jrpeland-54a.no");


            

Reported by PMD.

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

Line: 36

               * @author Craig Berry
 */
@GwtCompatible(emulated = true)
public final class InternetDomainNameTest extends TestCase {
  private static final InternetDomainName UNICODE_EXAMPLE =
      InternetDomainName.from("j\u00f8rpeland.no");
  private static final InternetDomainName PUNYCODE_EXAMPLE =
      InternetDomainName.from("xn--jrpeland-54a.no");


            

Reported by PMD.

Do not hard code the IP address
Design

Line: 77

                    ImmutableSet.of(
          "",
          " ",
          "127.0.0.1",
          "::1",
          "13",
          "abc.12c",
          "foo-.com",
          "_bar.quux",

            

Reported by PMD.

Do not hard code the IP address
Design

Line: 78

                        "",
          " ",
          "127.0.0.1",
          "::1",
          "13",
          "abc.12c",
          "foo-.com",
          "_bar.quux",
          "foo+bar.com",

            

Reported by PMD.

The String literal 'com' appears 6 times in this file; the first occurrence is on line 95
Error

Line: 95

                        "...",
          "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com",
          "a" + DELTA + " .com",
          ALMOST_TOO_MANY_LEVELS + "com",
          ALMOST_TOO_LONG + ".c");

  private static final ImmutableSet<String> RS =
      ImmutableSet.of(
          "com",

            

Reported by PMD.

The String literal 'google.com' appears 9 times in this file; the first occurrence is on line 151
Error

Line: 151

                    ImmutableSet.<String>builder().addAll(NON_PS).addAll(PS_NOT_RS).build();

  private static final ImmutableSet<String> TOP_UNDER_REGISTRY_SUFFIX =
      ImmutableSet.of("google.com", "foo.Co.uk", "foo.ca.us.");

  private static final ImmutableSet<String> TOP_PRIVATE_DOMAIN =
      ImmutableSet.of("google.com", "foo.Co.uk", "foo.ca.us.", "foo.blogspot.com");

  private static final ImmutableSet<String> UNDER_TOP_UNDER_REGISTRY_SUFFIX =

            

Reported by PMD.

Do not hard code the IP address
Design

Line: 163

                    ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");

  private static final ImmutableSet<String> VALID_IP_ADDRS =
      ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");

  private static final ImmutableSet<String> INVALID_IP_ADDRS =
      ImmutableSet.of(
          "", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");


            

Reported by PMD.

Do not hard code the IP address
Design

Line: 163

                    ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");

  private static final ImmutableSet<String> VALID_IP_ADDRS =
      ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");

  private static final ImmutableSet<String> INVALID_IP_ADDRS =
      ImmutableSet.of(
          "", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");


            

Reported by PMD.

Do not hard code the IP address
Design

Line: 163

                    ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");

  private static final ImmutableSet<String> VALID_IP_ADDRS =
      ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");

  private static final ImmutableSet<String> INVALID_IP_ADDRS =
      ImmutableSet.of(
          "", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");


            

Reported by PMD.

Do not hard code the IP address
Design

Line: 163

                    ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");

  private static final ImmutableSet<String> VALID_IP_ADDRS =
      ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");

  private static final ImmutableSet<String> INVALID_IP_ADDRS =
      ImmutableSet.of(
          "", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");


            

Reported by PMD.

guava-tests/test/com/google/common/net/InternetDomainNameTest.java
179 issues
Possible God Class (WMC=47, ATFD=35, TCC=1.449%)
Design

Line: 36

               * @author Craig Berry
 */
@GwtCompatible(emulated = true)
public final class InternetDomainNameTest extends TestCase {
  private static final InternetDomainName UNICODE_EXAMPLE =
      InternetDomainName.from("j\u00f8rpeland.no");
  private static final InternetDomainName PUNYCODE_EXAMPLE =
      InternetDomainName.from("xn--jrpeland-54a.no");


            

Reported by PMD.

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

Line: 36

               * @author Craig Berry
 */
@GwtCompatible(emulated = true)
public final class InternetDomainNameTest extends TestCase {
  private static final InternetDomainName UNICODE_EXAMPLE =
      InternetDomainName.from("j\u00f8rpeland.no");
  private static final InternetDomainName PUNYCODE_EXAMPLE =
      InternetDomainName.from("xn--jrpeland-54a.no");


            

Reported by PMD.

Do not hard code the IP address
Design

Line: 77

                    ImmutableSet.of(
          "",
          " ",
          "127.0.0.1",
          "::1",
          "13",
          "abc.12c",
          "foo-.com",
          "_bar.quux",

            

Reported by PMD.

Do not hard code the IP address
Design

Line: 78

                        "",
          " ",
          "127.0.0.1",
          "::1",
          "13",
          "abc.12c",
          "foo-.com",
          "_bar.quux",
          "foo+bar.com",

            

Reported by PMD.

The String literal 'com' appears 6 times in this file; the first occurrence is on line 95
Error

Line: 95

                        "...",
          "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com",
          "a" + DELTA + " .com",
          ALMOST_TOO_MANY_LEVELS + "com",
          ALMOST_TOO_LONG + ".c");

  private static final ImmutableSet<String> RS =
      ImmutableSet.of(
          "com",

            

Reported by PMD.

The String literal 'google.com' appears 9 times in this file; the first occurrence is on line 151
Error

Line: 151

                    ImmutableSet.<String>builder().addAll(NON_PS).addAll(PS_NOT_RS).build();

  private static final ImmutableSet<String> TOP_UNDER_REGISTRY_SUFFIX =
      ImmutableSet.of("google.com", "foo.Co.uk", "foo.ca.us.");

  private static final ImmutableSet<String> TOP_PRIVATE_DOMAIN =
      ImmutableSet.of("google.com", "foo.Co.uk", "foo.ca.us.", "foo.blogspot.com");

  private static final ImmutableSet<String> UNDER_TOP_UNDER_REGISTRY_SUFFIX =

            

Reported by PMD.

Do not hard code the IP address
Design

Line: 163

                    ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");

  private static final ImmutableSet<String> VALID_IP_ADDRS =
      ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");

  private static final ImmutableSet<String> INVALID_IP_ADDRS =
      ImmutableSet.of(
          "", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");


            

Reported by PMD.

Do not hard code the IP address
Design

Line: 163

                    ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");

  private static final ImmutableSet<String> VALID_IP_ADDRS =
      ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");

  private static final ImmutableSet<String> INVALID_IP_ADDRS =
      ImmutableSet.of(
          "", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");


            

Reported by PMD.

Do not hard code the IP address
Design

Line: 163

                    ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");

  private static final ImmutableSet<String> VALID_IP_ADDRS =
      ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");

  private static final ImmutableSet<String> INVALID_IP_ADDRS =
      ImmutableSet.of(
          "", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");


            

Reported by PMD.

Do not hard code the IP address
Design

Line: 163

                    ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");

  private static final ImmutableSet<String> VALID_IP_ADDRS =
      ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");

  private static final ImmutableSet<String> INVALID_IP_ADDRS =
      ImmutableSet.of(
          "", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");


            

Reported by PMD.

android/guava-tests/test/com/google/common/hash/HashCodeTest.java
177 issues
Possible God Class (WMC=52, ATFD=23, TCC=4.286%)
Design

Line: 34

               * @author Dimitris Andreou
 * @author Kurt Alfred Kluever
 */
public class HashCodeTest extends TestCase {
  // note: asInt(), asLong() are in little endian
  private static final ImmutableList<ExpectedHashCode> expectedHashCodes =
      ImmutableList.of(
          new ExpectedHashCode(
              new byte[] {

            

Reported by PMD.

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

Line: 34

               * @author Dimitris Andreou
 * @author Kurt Alfred Kluever
 */
public class HashCodeTest extends TestCase {
  // note: asInt(), asLong() are in little endian
  private static final ImmutableList<ExpectedHashCode> expectedHashCodes =
      ImmutableList.of(
          new ExpectedHashCode(
              new byte[] {

            

Reported by PMD.

The String literal 'cdab0000' appears 4 times in this file; the first occurrence is on line 66
Error

Line: 66

                            new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00},
              0x0000abcd,
              null,
              "cdab0000"),
          new ExpectedHashCode(
              new byte[] {
                (byte) 0xef, (byte) 0xcd, (byte) 0xab, (byte) 0x00,
                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
              },

            

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

                            "efcdab0000000000"));

  // expectedHashCodes must contain at least one hash code with 4 bytes
  public void testFromInt() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      if (expected.bytes.length == 4) {
        HashCode fromInt = HashCode.fromInt(expected.asInt);
        assertExpectedHashCode(expected, fromInt);
      }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 79

                // expectedHashCodes must contain at least one hash code with 4 bytes
  public void testFromInt() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      if (expected.bytes.length == 4) {
        HashCode fromInt = HashCode.fromInt(expected.asInt);
        assertExpectedHashCode(expected, fromInt);
      }
    }
  }

            

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

                }

  // expectedHashCodes must contain at least one hash code with 8 bytes
  public void testFromLong() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      if (expected.bytes.length == 8) {
        HashCode fromLong = HashCode.fromLong(expected.asLong);
        assertExpectedHashCode(expected, fromLong);
      }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 89

                // expectedHashCodes must contain at least one hash code with 8 bytes
  public void testFromLong() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      if (expected.bytes.length == 8) {
        HashCode fromLong = HashCode.fromLong(expected.asLong);
        assertExpectedHashCode(expected, fromLong);
      }
    }
  }

            

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

                  }
  }

  public void testFromBytes() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      HashCode fromBytes = HashCode.fromBytes(expected.bytes);
      assertExpectedHashCode(expected, fromBytes);
    }
  }

            

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

                  }
  }

  public void testFromBytes_copyOccurs() {
    byte[] bytes = new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00};
    HashCode hashCode = HashCode.fromBytes(bytes);
    int expectedInt = 0x0000abcd;
    String expectedToString = "cdab0000";


            

Reported by PMD.

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

Line: 103

                  }
  }

  public void testFromBytes_copyOccurs() {
    byte[] bytes = new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00};
    HashCode hashCode = HashCode.fromBytes(bytes);
    int expectedInt = 0x0000abcd;
    String expectedToString = "cdab0000";


            

Reported by PMD.

guava-tests/test/com/google/common/hash/HashCodeTest.java
177 issues
Possible God Class (WMC=52, ATFD=23, TCC=4.286%)
Design

Line: 34

               * @author Dimitris Andreou
 * @author Kurt Alfred Kluever
 */
public class HashCodeTest extends TestCase {
  // note: asInt(), asLong() are in little endian
  private static final ImmutableList<ExpectedHashCode> expectedHashCodes =
      ImmutableList.of(
          new ExpectedHashCode(
              new byte[] {

            

Reported by PMD.

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

Line: 34

               * @author Dimitris Andreou
 * @author Kurt Alfred Kluever
 */
public class HashCodeTest extends TestCase {
  // note: asInt(), asLong() are in little endian
  private static final ImmutableList<ExpectedHashCode> expectedHashCodes =
      ImmutableList.of(
          new ExpectedHashCode(
              new byte[] {

            

Reported by PMD.

The String literal 'cdab0000' appears 4 times in this file; the first occurrence is on line 66
Error

Line: 66

                            new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00},
              0x0000abcd,
              null,
              "cdab0000"),
          new ExpectedHashCode(
              new byte[] {
                (byte) 0xef, (byte) 0xcd, (byte) 0xab, (byte) 0x00,
                (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
              },

            

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

                            "efcdab0000000000"));

  // expectedHashCodes must contain at least one hash code with 4 bytes
  public void testFromInt() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      if (expected.bytes.length == 4) {
        HashCode fromInt = HashCode.fromInt(expected.asInt);
        assertExpectedHashCode(expected, fromInt);
      }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 79

                // expectedHashCodes must contain at least one hash code with 4 bytes
  public void testFromInt() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      if (expected.bytes.length == 4) {
        HashCode fromInt = HashCode.fromInt(expected.asInt);
        assertExpectedHashCode(expected, fromInt);
      }
    }
  }

            

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

                }

  // expectedHashCodes must contain at least one hash code with 8 bytes
  public void testFromLong() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      if (expected.bytes.length == 8) {
        HashCode fromLong = HashCode.fromLong(expected.asLong);
        assertExpectedHashCode(expected, fromLong);
      }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 89

                // expectedHashCodes must contain at least one hash code with 8 bytes
  public void testFromLong() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      if (expected.bytes.length == 8) {
        HashCode fromLong = HashCode.fromLong(expected.asLong);
        assertExpectedHashCode(expected, fromLong);
      }
    }
  }

            

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

                  }
  }

  public void testFromBytes() {
    for (ExpectedHashCode expected : expectedHashCodes) {
      HashCode fromBytes = HashCode.fromBytes(expected.bytes);
      assertExpectedHashCode(expected, fromBytes);
    }
  }

            

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

                  }
  }

  public void testFromBytes_copyOccurs() {
    byte[] bytes = new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00};
    HashCode hashCode = HashCode.fromBytes(bytes);
    int expectedInt = 0x0000abcd;
    String expectedToString = "cdab0000";


            

Reported by PMD.

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

Line: 103

                  }
  }

  public void testFromBytes_copyOccurs() {
    byte[] bytes = new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00};
    HashCode hashCode = HashCode.fromBytes(bytes);
    int expectedInt = 0x0000abcd;
    String expectedToString = "cdab0000";


            

Reported by PMD.

android/guava-tests/test/com/google/common/io/FilesTest.java
176 issues
This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.io;

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

import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;

            

Reported by PMD.

Possible God Class (WMC=62, ATFD=101, TCC=0.000%)
Design

Line: 50

               * @author Chris Nokleberg
 */

public class FilesTest extends IoTestCase {

  public static TestSuite suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(
        ByteSourceTester.tests(

            

Reported by PMD.

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

Line: 50

               * @author Chris Nokleberg
 */

public class FilesTest extends IoTestCase {

  public static TestSuite suite() {
    TestSuite suite = new TestSuite();
    suite.addTest(
        ByteSourceTester.tests(

            

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

                  return suite;
  }

  public void testRoundTripSources() throws Exception {
    File asciiFile = getTestFile("ascii.txt");
    ByteSource byteSource = Files.asByteSource(asciiFile);
    assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
  }


            

Reported by PMD.

The String literal 'ascii.txt' appears 11 times in this file; the first occurrence is on line 79
Error

Line: 79

                }

  public void testRoundTripSources() throws Exception {
    File asciiFile = getTestFile("ascii.txt");
    ByteSource byteSource = Files.asByteSource(asciiFile);
    assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
  }

  public void testToByteArray() throws IOException {

            

Reported by PMD.

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

Line: 81

                public void testRoundTripSources() throws Exception {
    File asciiFile = getTestFile("ascii.txt");
    ByteSource byteSource = Files.asByteSource(asciiFile);
    assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
  }

  public void testToByteArray() throws IOException {
    File asciiFile = getTestFile("ascii.txt");
    File i18nFile = getTestFile("i18n.txt");

            

Reported by PMD.

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

Line: 81

                public void testRoundTripSources() throws Exception {
    File asciiFile = getTestFile("ascii.txt");
    ByteSource byteSource = Files.asByteSource(asciiFile);
    assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
  }

  public void testToByteArray() throws IOException {
    File asciiFile = getTestFile("ascii.txt");
    File i18nFile = getTestFile("i18n.txt");

            

Reported by PMD.

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

Line: 84

                  assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
  }

  public void testToByteArray() throws IOException {
    File asciiFile = getTestFile("ascii.txt");
    File i18nFile = getTestFile("i18n.txt");
    assertTrue(Arrays.equals(ASCII.getBytes(Charsets.US_ASCII), Files.toByteArray(asciiFile)));
    assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.toByteArray(i18nFile)));
    assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.asByteSource(i18nFile).read()));

            

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

                  assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
  }

  public void testToByteArray() throws IOException {
    File asciiFile = getTestFile("ascii.txt");
    File i18nFile = getTestFile("i18n.txt");
    assertTrue(Arrays.equals(ASCII.getBytes(Charsets.US_ASCII), Files.toByteArray(asciiFile)));
    assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.toByteArray(i18nFile)));
    assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.asByteSource(i18nFile).read()));

            

Reported by PMD.

The String literal 'i18n.txt' appears 10 times in this file; the first occurrence is on line 86
Error

Line: 86

              
  public void testToByteArray() throws IOException {
    File asciiFile = getTestFile("ascii.txt");
    File i18nFile = getTestFile("i18n.txt");
    assertTrue(Arrays.equals(ASCII.getBytes(Charsets.US_ASCII), Files.toByteArray(asciiFile)));
    assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.toByteArray(i18nFile)));
    assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.asByteSource(i18nFile).read()));
  }


            

Reported by PMD.

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

Line: 38

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

  @Override
  protected ArrayTable<String, Integer, Character> create(Object... data) {
    // TODO: Specify different numbers of rows and columns, to detect problems
    // that arise when the wrong size is used.

            

Reported by PMD.

Possible God Class (WMC=66, ATFD=30, TCC=0.000%)
Design

Line: 38

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

  @Override
  protected ArrayTable<String, Integer, Character> create(Object... data) {
    // TODO: Specify different numbers of rows and columns, to detect problems
    // that arise when the wrong size is used.

            

Reported by PMD.

The String literal 'bar' appears 59 times in this file; the first occurrence is on line 45
Error

Line: 45

                  // TODO: Specify different numbers of rows and columns, to detect problems
    // that arise when the wrong size is used.
    ArrayTable<String, Integer, Character> table =
        ArrayTable.create(asList("foo", "bar", "cat"), asList(1, 2, 3));
    populate(table, data);
    return table;
  }

  @Override

            

Reported by PMD.

The String literal 'cat' appears 6 times in this file; the first occurrence is on line 45
Error

Line: 45

                  // TODO: Specify different numbers of rows and columns, to detect problems
    // that arise when the wrong size is used.
    ArrayTable<String, Integer, Character> table =
        ArrayTable.create(asList("foo", "bar", "cat"), asList(1, 2, 3));
    populate(table, data);
    return table;
  }

  @Override

            

Reported by PMD.

The String literal 'foo' appears 108 times in this file; the first occurrence is on line 45
Error

Line: 45

                  // TODO: Specify different numbers of rows and columns, to detect problems
    // that arise when the wrong size is used.
    ArrayTable<String, Integer, Character> table =
        ArrayTable.create(asList("foo", "bar", "cat"), asList(1, 2, 3));
    populate(table, data);
    return table;
  }

  @Override

            

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

              
  // Overriding tests of behavior that differs for ArrayTable.

  @Override
  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));

            

Reported by PMD.

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

Line: 68

                // Overriding tests of behavior that differs for ArrayTable.

  @Override
  public void testContains() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.contains("foo", 1));
    assertTrue(table.contains("bar", 1));
    assertTrue(table.contains("foo", 3));
    assertTrue(table.contains("foo", 2));

            

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

                  assertFalse(table.contains(null, null));
  }

  @Override
  public void testContainsRow() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.containsRow("foo"));
    assertTrue(table.containsRow("bar"));
    assertTrue(table.containsRow("cat"));

            

Reported by PMD.

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

Line: 85

                }

  @Override
  public void testContainsRow() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.containsRow("foo"));
    assertTrue(table.containsRow("bar"));
    assertTrue(table.containsRow("cat"));
    assertFalse(table.containsRow("bad"));

            

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

                  assertFalse(table.containsRow(null));
  }

  @Override
  public void testContainsColumn() {
    table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
    assertTrue(table.containsColumn(1));
    assertTrue(table.containsColumn(3));
    assertTrue(table.containsColumn(2));

            

Reported by PMD.