The following issues were found

android/guava-tests/test/com/google/common/collect/TableCollectionTest.java
176 issues
High amount of different objects as members denotes a high coupling
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.collect;

import static com.google.common.base.Preconditions.checkNotNull;

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

            

Reported by PMD.

This class name ends with Test but contains no test cases
Error

Line: 57

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class TableCollectionTest extends TestCase {

  private static final Feature<?>[] COLLECTION_FEATURES = {
    CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES
  };


            

Reported by PMD.

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

Line: 57

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class TableCollectionTest extends TestCase {

  private static final Feature<?>[] COLLECTION_FEATURES = {
    CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES
  };


            

Reported by PMD.

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

Line: 57

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class TableCollectionTest extends TestCase {

  private static final Feature<?>[] COLLECTION_FEATURES = {
    CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES
  };


            

Reported by PMD.

Avoid really long classes.
Design

Line: 57

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class TableCollectionTest extends TestCase {

  private static final Feature<?>[] COLLECTION_FEATURES = {
    CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES
  };


            

Reported by PMD.

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

Line: 78

                  CollectionFeature.ALLOWS_NULL_QUERIES
  };

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

            

Reported by PMD.

The method 'suite()' has a NCSS line count of 64.
Design

Line: 79

                };

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ArrayRowTests.class);
    suite.addTestSuite(HashRowTests.class);
    suite.addTestSuite(TreeRowTests.class);
    suite.addTestSuite(TransposeRowTests.class);

            

Reported by PMD.

Avoid really long methods.
Design

Line: 79

                };

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ArrayRowTests.class);
    suite.addTestSuite(HashRowTests.class);
    suite.addTestSuite(TreeRowTests.class);
    suite.addTestSuite(TransposeRowTests.class);

            

Reported by PMD.

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

Line: 79

                };

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ArrayRowTests.class);
    suite.addTestSuite(HashRowTests.class);
    suite.addTestSuite(TreeRowTests.class);
    suite.addTestSuite(TransposeRowTests.class);

            

Reported by PMD.

The method 'suite' has a Modified Cyclomatic Complexity of 49.
Design

Line: 79

                };

  @GwtIncompatible // suite
  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(ArrayRowTests.class);
    suite.addTestSuite(HashRowTests.class);
    suite.addTestSuite(TreeRowTests.class);
    suite.addTestSuite(TransposeRowTests.class);

            

Reported by PMD.

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.

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.

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.

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 (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.

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.

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.

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.

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/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.

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.

android/guava-tests/test/com/google/common/math/IntMathTest.java
175 issues
This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.math;

import static com.google.common.math.MathTesting.ALL_INTEGER_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
import static com.google.common.math.MathTesting.ALL_SAFE_ROUNDING_MODES;
import static com.google.common.math.MathTesting.EXPONENTS;

            

Reported by PMD.

Possible God Class (WMC=183, ATFD=43, TCC=0.000%)
Design

Line: 46

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;

            

Reported by PMD.

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

Line: 46

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;

            

Reported by PMD.

The class 'IntMathTest' has a total cyclomatic complexity of 183 (highest 7).
Design

Line: 46

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;

            

Reported by PMD.

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

Line: 47

               */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;
    assertFalse(IntMath.isPowerOfTwo((int) 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: 47

               */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;
    assertFalse(IntMath.isPowerOfTwo((int) value));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 48

              @GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;
    assertFalse(IntMath.isPowerOfTwo((int) value));
  }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

              
    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;
    assertFalse(IntMath.isPowerOfTwo((int) value));
  }

  public void testCeilingPowerOfTwo() {
    for (int x : POSITIVE_INTEGER_CANDIDATES) {
      BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));

            

Reported by PMD.

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

Line: 55

                  assertFalse(IntMath.isPowerOfTwo((int) value));
  }

  public void testCeilingPowerOfTwo() {
    for (int x : POSITIVE_INTEGER_CANDIDATES) {
      BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));
      if (fitsInInt(expectedResult)) {
        assertEquals(expectedResult.intValue(), IntMath.ceilingPowerOfTwo(x));
      } else {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 59

                  for (int x : POSITIVE_INTEGER_CANDIDATES) {
      BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));
      if (fitsInInt(expectedResult)) {
        assertEquals(expectedResult.intValue(), IntMath.ceilingPowerOfTwo(x));
      } else {
        try {
          IntMath.ceilingPowerOfTwo(x);
          fail("Expected ArithmeticException");
        } catch (ArithmeticException expected) {

            

Reported by PMD.

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

Line: 34

               *
 * @author Pablo Bellver
 */
public class FilesSimplifyPathTest extends TestCase {

  public void testSimplifyEmptyString() {
    assertEquals(".", simplifyPath(""));
  }


            

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

               */
public class FilesSimplifyPathTest extends TestCase {

  public void testSimplifyEmptyString() {
    assertEquals(".", simplifyPath(""));
  }

  public void testSimplifyDot() {
    assertEquals(".", simplifyPath("."));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

              public class FilesSimplifyPathTest extends TestCase {

  public void testSimplifyEmptyString() {
    assertEquals(".", simplifyPath(""));
  }

  public void testSimplifyDot() {
    assertEquals(".", simplifyPath("."));
  }

            

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

                  assertEquals(".", simplifyPath(""));
  }

  public void testSimplifyDot() {
    assertEquals(".", simplifyPath("."));
  }

  public void testSimplifyWhiteSpace() {
    assertEquals(" ", simplifyPath(" "));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

                }

  public void testSimplifyDot() {
    assertEquals(".", simplifyPath("."));
  }

  public void testSimplifyWhiteSpace() {
    assertEquals(" ", simplifyPath(" "));
  }

            

Reported by PMD.

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

Line: 44

                  assertEquals(".", simplifyPath("."));
  }

  public void testSimplifyWhiteSpace() {
    assertEquals(" ", simplifyPath(" "));
  }

  public void testSimplify2() {
    assertEquals("x", simplifyPath("x"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 45

                }

  public void testSimplifyWhiteSpace() {
    assertEquals(" ", simplifyPath(" "));
  }

  public void testSimplify2() {
    assertEquals("x", simplifyPath("x"));
  }

            

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

                  assertEquals(" ", simplifyPath(" "));
  }

  public void testSimplify2() {
    assertEquals("x", simplifyPath("x"));
  }

  public void testSimplify3() {
    assertEquals("/a/b/c/d", simplifyPath("/a/b/c/d"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 49

                }

  public void testSimplify2() {
    assertEquals("x", simplifyPath("x"));
  }

  public void testSimplify3() {
    assertEquals("/a/b/c/d", simplifyPath("/a/b/c/d"));
  }

            

Reported by PMD.

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

Line: 52

                  assertEquals("x", simplifyPath("x"));
  }

  public void testSimplify3() {
    assertEquals("/a/b/c/d", simplifyPath("/a/b/c/d"));
  }

  public void testSimplify4() {
    assertEquals("/a/b/c/d", simplifyPath("/a/b/c/d/"));

            

Reported by PMD.

guava-tests/test/com/google/common/math/IntMathTest.java
175 issues
This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.math;

import static com.google.common.math.MathTesting.ALL_INTEGER_CANDIDATES;
import static com.google.common.math.MathTesting.ALL_ROUNDING_MODES;
import static com.google.common.math.MathTesting.ALL_SAFE_ROUNDING_MODES;
import static com.google.common.math.MathTesting.EXPONENTS;

            

Reported by PMD.

Possible God Class (WMC=183, ATFD=43, TCC=0.000%)
Design

Line: 46

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;

            

Reported by PMD.

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

Line: 46

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;

            

Reported by PMD.

The class 'IntMathTest' has a total cyclomatic complexity of 183 (highest 7).
Design

Line: 46

               * @author Louis Wasserman
 */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;

            

Reported by PMD.

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

Line: 47

               */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;
    assertFalse(IntMath.isPowerOfTwo((int) 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: 47

               */
@GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;
    assertFalse(IntMath.isPowerOfTwo((int) value));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 48

              @GwtCompatible(emulated = true)
public class IntMathTest extends TestCase {
  public void testMaxSignedPowerOfTwo() {
    assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO));

    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;
    assertFalse(IntMath.isPowerOfTwo((int) value));
  }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

              
    // Extra work required to make GWT happy.
    long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L;
    assertFalse(IntMath.isPowerOfTwo((int) value));
  }

  public void testCeilingPowerOfTwo() {
    for (int x : POSITIVE_INTEGER_CANDIDATES) {
      BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));

            

Reported by PMD.

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

Line: 55

                  assertFalse(IntMath.isPowerOfTwo((int) value));
  }

  public void testCeilingPowerOfTwo() {
    for (int x : POSITIVE_INTEGER_CANDIDATES) {
      BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));
      if (fitsInInt(expectedResult)) {
        assertEquals(expectedResult.intValue(), IntMath.ceilingPowerOfTwo(x));
      } else {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 59

                  for (int x : POSITIVE_INTEGER_CANDIDATES) {
      BigInteger expectedResult = BigIntegerMath.ceilingPowerOfTwo(BigInteger.valueOf(x));
      if (fitsInInt(expectedResult)) {
        assertEquals(expectedResult.intValue(), IntMath.ceilingPowerOfTwo(x));
      } else {
        try {
          IntMath.ceilingPowerOfTwo(x);
          fail("Expected ArithmeticException");
        } catch (ArithmeticException expected) {

            

Reported by PMD.

guava-tests/test/com/google/common/base/PreconditionsTest.java
175 issues
Do not use the short type
Performance

Line: 535

                  Preconditions.checkState(aBoolean, "", aBoolean ? "" : anInt, (Object) anInt);

    // ambiguous without the .booleanValue() call since the boxing forces us into phase 2 resolution
    short s = 2;
    Preconditions.checkState(boxedBoolean.booleanValue(), "", s);
  }

  @GwtIncompatible // NullPointerTester
  public void testNullPointers() {

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.base;

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

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

            

Reported by PMD.

Possible God Class (WMC=98, ATFD=20, TCC=1.398%)
Design

Line: 42

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {

            

Reported by PMD.

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

Line: 42

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {

            

Reported by PMD.

The class 'PreconditionsTest' has a total cyclomatic complexity of 98 (highest 4).
Design

Line: 42

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {

            

Reported by PMD.

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

Line: 43

               */
@GwtCompatible(emulated = true)
public class PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {
    try {

            

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 PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {
    try {

            

Reported by PMD.

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

Line: 47

                  Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {
    try {
      Preconditions.checkArgument(false);
      fail("no exception thrown");
    } catch (IllegalArgumentException expected) {
    }

            

Reported by PMD.

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

Line: 50

                public void testCheckArgument_simple_failure() {
    try {
      Preconditions.checkArgument(false);
      fail("no exception thrown");
    } catch (IllegalArgumentException expected) {
    }
  }

  public void testCheckArgument_simpleMessage_success() {

            

Reported by PMD.

In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 50

                public void testCheckArgument_simple_failure() {
    try {
      Preconditions.checkArgument(false);
      fail("no exception thrown");
    } catch (IllegalArgumentException expected) {
    }
  }

  public void testCheckArgument_simpleMessage_success() {

            

Reported by PMD.

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

Line: 34

               *
 * @author Pablo Bellver
 */
public class FilesSimplifyPathTest extends TestCase {

  public void testSimplifyEmptyString() {
    assertEquals(".", simplifyPath(""));
  }


            

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

               */
public class FilesSimplifyPathTest extends TestCase {

  public void testSimplifyEmptyString() {
    assertEquals(".", simplifyPath(""));
  }

  public void testSimplifyDot() {
    assertEquals(".", simplifyPath("."));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

              public class FilesSimplifyPathTest extends TestCase {

  public void testSimplifyEmptyString() {
    assertEquals(".", simplifyPath(""));
  }

  public void testSimplifyDot() {
    assertEquals(".", simplifyPath("."));
  }

            

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

                  assertEquals(".", simplifyPath(""));
  }

  public void testSimplifyDot() {
    assertEquals(".", simplifyPath("."));
  }

  public void testSimplifyWhiteSpace() {
    assertEquals(" ", simplifyPath(" "));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

                }

  public void testSimplifyDot() {
    assertEquals(".", simplifyPath("."));
  }

  public void testSimplifyWhiteSpace() {
    assertEquals(" ", simplifyPath(" "));
  }

            

Reported by PMD.

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

Line: 44

                  assertEquals(".", simplifyPath("."));
  }

  public void testSimplifyWhiteSpace() {
    assertEquals(" ", simplifyPath(" "));
  }

  public void testSimplify2() {
    assertEquals("x", simplifyPath("x"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 45

                }

  public void testSimplifyWhiteSpace() {
    assertEquals(" ", simplifyPath(" "));
  }

  public void testSimplify2() {
    assertEquals("x", simplifyPath("x"));
  }

            

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

                  assertEquals(" ", simplifyPath(" "));
  }

  public void testSimplify2() {
    assertEquals("x", simplifyPath("x"));
  }

  public void testSimplify3() {
    assertEquals("/a/b/c/d", simplifyPath("/a/b/c/d"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 49

                }

  public void testSimplify2() {
    assertEquals("x", simplifyPath("x"));
  }

  public void testSimplify3() {
    assertEquals("/a/b/c/d", simplifyPath("/a/b/c/d"));
  }

            

Reported by PMD.

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

Line: 52

                  assertEquals("x", simplifyPath("x"));
  }

  public void testSimplify3() {
    assertEquals("/a/b/c/d", simplifyPath("/a/b/c/d"));
  }

  public void testSimplify4() {
    assertEquals("/a/b/c/d", simplifyPath("/a/b/c/d/"));

            

Reported by PMD.

android/guava-tests/test/com/google/common/base/PreconditionsTest.java
175 issues
Do not use the short type
Performance

Line: 535

                  Preconditions.checkState(aBoolean, "", aBoolean ? "" : anInt, (Object) anInt);

    // ambiguous without the .booleanValue() call since the boxing forces us into phase 2 resolution
    short s = 2;
    Preconditions.checkState(boxedBoolean.booleanValue(), "", s);
  }

  @GwtIncompatible // NullPointerTester
  public void testNullPointers() {

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 17

               * limitations under the License.
 */

package com.google.common.base;

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

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {

            

Reported by PMD.

The class 'PreconditionsTest' has a total cyclomatic complexity of 98 (highest 4).
Design

Line: 42

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {

            

Reported by PMD.

Possible God Class (WMC=98, ATFD=20, TCC=1.398%)
Design

Line: 42

               * @author Jared Levy
 */
@GwtCompatible(emulated = true)
public class PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {

            

Reported by PMD.

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

Line: 43

               */
@GwtCompatible(emulated = true)
public class PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {
    try {

            

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 PreconditionsTest extends TestCase {
  public void testCheckArgument_simple_success() {
    Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {
    try {

            

Reported by PMD.

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

Line: 47

                  Preconditions.checkArgument(true);
  }

  public void testCheckArgument_simple_failure() {
    try {
      Preconditions.checkArgument(false);
      fail("no exception thrown");
    } catch (IllegalArgumentException expected) {
    }

            

Reported by PMD.

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

Line: 50

                public void testCheckArgument_simple_failure() {
    try {
      Preconditions.checkArgument(false);
      fail("no exception thrown");
    } catch (IllegalArgumentException expected) {
    }
  }

  public void testCheckArgument_simpleMessage_success() {

            

Reported by PMD.

In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 50

                public void testCheckArgument_simple_failure() {
    try {
      Preconditions.checkArgument(false);
      fail("no exception thrown");
    } catch (IllegalArgumentException expected) {
    }
  }

  public void testCheckArgument_simpleMessage_success() {

            

Reported by PMD.