The following issues were found
android/guava-tests/test/com/google/common/collect/TableCollectionTest.java
176 issues
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
Line: 34
*
* @author Pablo Bellver
*/
public class FilesSimplifyPathTest extends TestCase {
public void testSimplifyEmptyString() {
assertEquals(".", simplifyPath(""));
}
Reported by PMD.
Line: 36
*/
public class FilesSimplifyPathTest extends TestCase {
public void testSimplifyEmptyString() {
assertEquals(".", simplifyPath(""));
}
public void testSimplifyDot() {
assertEquals(".", simplifyPath("."));
Reported by PMD.
Line: 37
public class FilesSimplifyPathTest extends TestCase {
public void testSimplifyEmptyString() {
assertEquals(".", simplifyPath(""));
}
public void testSimplifyDot() {
assertEquals(".", simplifyPath("."));
}
Reported by PMD.
Line: 40
assertEquals(".", simplifyPath(""));
}
public void testSimplifyDot() {
assertEquals(".", simplifyPath("."));
}
public void testSimplifyWhiteSpace() {
assertEquals(" ", simplifyPath(" "));
Reported by PMD.
Line: 41
}
public void testSimplifyDot() {
assertEquals(".", simplifyPath("."));
}
public void testSimplifyWhiteSpace() {
assertEquals(" ", simplifyPath(" "));
}
Reported by PMD.
Line: 44
assertEquals(".", simplifyPath("."));
}
public void testSimplifyWhiteSpace() {
assertEquals(" ", simplifyPath(" "));
}
public void testSimplify2() {
assertEquals("x", simplifyPath("x"));
Reported by PMD.
Line: 45
}
public void testSimplifyWhiteSpace() {
assertEquals(" ", simplifyPath(" "));
}
public void testSimplify2() {
assertEquals("x", simplifyPath("x"));
}
Reported by PMD.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
Line: 47
Preconditions.checkArgument(true);
}
public void testCheckArgument_simple_failure() {
try {
Preconditions.checkArgument(false);
fail("no exception thrown");
} catch (IllegalArgumentException expected) {
}
Reported by PMD.
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.
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
Line: 34
*
* @author Pablo Bellver
*/
public class FilesSimplifyPathTest extends TestCase {
public void testSimplifyEmptyString() {
assertEquals(".", simplifyPath(""));
}
Reported by PMD.
Line: 36
*/
public class FilesSimplifyPathTest extends TestCase {
public void testSimplifyEmptyString() {
assertEquals(".", simplifyPath(""));
}
public void testSimplifyDot() {
assertEquals(".", simplifyPath("."));
Reported by PMD.
Line: 37
public class FilesSimplifyPathTest extends TestCase {
public void testSimplifyEmptyString() {
assertEquals(".", simplifyPath(""));
}
public void testSimplifyDot() {
assertEquals(".", simplifyPath("."));
}
Reported by PMD.
Line: 40
assertEquals(".", simplifyPath(""));
}
public void testSimplifyDot() {
assertEquals(".", simplifyPath("."));
}
public void testSimplifyWhiteSpace() {
assertEquals(" ", simplifyPath(" "));
Reported by PMD.
Line: 41
}
public void testSimplifyDot() {
assertEquals(".", simplifyPath("."));
}
public void testSimplifyWhiteSpace() {
assertEquals(" ", simplifyPath(" "));
}
Reported by PMD.
Line: 44
assertEquals(".", simplifyPath("."));
}
public void testSimplifyWhiteSpace() {
assertEquals(" ", simplifyPath(" "));
}
public void testSimplify2() {
assertEquals("x", simplifyPath("x"));
Reported by PMD.
Line: 45
}
public void testSimplifyWhiteSpace() {
assertEquals(" ", simplifyPath(" "));
}
public void testSimplify2() {
assertEquals("x", simplifyPath("x"));
}
Reported by PMD.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
Line: 47
Preconditions.checkArgument(true);
}
public void testCheckArgument_simple_failure() {
try {
Preconditions.checkArgument(false);
fail("no exception thrown");
} catch (IllegalArgumentException expected) {
}
Reported by PMD.
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.
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.