The following issues were found
guava-tests/test/com/google/common/primitives/DoublesTest.java
316 issues
Line: 343
testReverse(new double[] {-1, 1, -2, 2}, new double[] {2, -2, 1, -1});
}
private static void testReverse(double[] input, double[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Doubles.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 350
}
private static void testReverse(
double[] input, int fromIndex, int toIndex, double[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Doubles.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 376
new double[] {Double.NaN, 2, 1, 0, -0, -1, -2});
}
private static void testSortDescending(double[] input, double[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Doubles.sortDescending(input);
// GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
for (int i = 0; i < input.length; i++) {
assertEquals(0, Double.compare(expectedOutput[i], input[i]));
Reported by PMD.
Line: 386
}
private static void testSortDescending(
double[] input, int fromIndex, int toIndex, double[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Doubles.sortDescending(input, fromIndex, toIndex);
// GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
for (int i = 0; i < input.length; i++) {
assertEquals(0, Double.compare(expectedOutput[i], input[i]));
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.primitives;
import static com.google.common.truth.Truth.assertThat;
import static java.lang.Double.NaN;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 44
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class DoublesTest extends TestCase {
private static final double[] EMPTY = {};
private static final double[] ARRAY1 = {(double) 1};
private static final double[] ARRAY234 = {(double) 2, (double) 3, (double) 4};
private static final double LEAST = Double.NEGATIVE_INFINITY;
Reported by PMD.
Line: 44
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class DoublesTest extends TestCase {
private static final double[] EMPTY = {};
private static final double[] ARRAY1 = {(double) 1};
private static final double[] ARRAY234 = {(double) 2, (double) 3, (double) 4};
private static final double LEAST = Double.NEGATIVE_INFINITY;
Reported by PMD.
Line: 44
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class DoublesTest extends TestCase {
private static final double[] EMPTY = {};
private static final double[] ARRAY1 = {(double) 1};
private static final double[] ARRAY234 = {(double) 2, (double) 3, (double) 4};
private static final double LEAST = Double.NEGATIVE_INFINITY;
Reported by PMD.
Line: 78
private static final double[] VALUES = Doubles.concat(NUMBERS, new double[] {NaN});
public void testHashCode() {
for (double value : VALUES) {
assertEquals(((Double) value).hashCode(), Doubles.hashCode(value));
}
}
Reported by PMD.
Line: 80
public void testHashCode() {
for (double value : VALUES) {
assertEquals(((Double) value).hashCode(), Doubles.hashCode(value));
}
}
public void testIsFinite() {
for (double value : NUMBERS) {
Reported by PMD.
android/guava-tests/test/com/google/common/primitives/LongsTest.java
315 issues
Line: 329
testReverse(new long[] {-1, 1, -2, 2}, new long[] {2, -2, 1, -1});
}
private static void testReverse(long[] input, long[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Longs.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 335
assertTrue(Arrays.equals(expectedOutput, input));
}
private static void testReverse(long[] input, int fromIndex, int toIndex, long[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Longs.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 358
testSortDescending(new long[] {-1, 1, -2, 2}, new long[] {2, 1, -1, -2});
}
private static void testSortDescending(long[] input, long[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Longs.sortDescending(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 365
}
private static void testSortDescending(
long[] input, int fromIndex, int toIndex, long[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Longs.sortDescending(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.primitives;
import static java.lang.Long.MAX_VALUE;
import static java.lang.Long.MIN_VALUE;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 44
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class LongsTest extends TestCase {
private static final long[] EMPTY = {};
private static final long[] ARRAY1 = {(long) 1};
private static final long[] ARRAY234 = {(long) 2, (long) 3, (long) 4};
private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};
Reported by PMD.
Line: 44
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class LongsTest extends TestCase {
private static final long[] EMPTY = {};
private static final long[] ARRAY1 = {(long) 1};
private static final long[] ARRAY234 = {(long) 2, (long) 3, (long) 4};
private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};
Reported by PMD.
Line: 51
private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};
@GwtIncompatible // Long.hashCode returns different values in GWT.
public void testHashCode() {
for (long value : VALUES) {
assertEquals("hashCode for " + value, ((Long) value).hashCode(), Longs.hashCode(value));
}
}
Reported by PMD.
Line: 58
}
}
public void testCompare() {
for (long x : VALUES) {
for (long y : VALUES) {
// note: spec requires only that the sign is the same
assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
}
Reported by PMD.
Line: 62
for (long x : VALUES) {
for (long y : VALUES) {
// note: spec requires only that the sign is the same
assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
}
}
}
public void testContains() {
Reported by PMD.
guava-tests/test/com/google/common/primitives/LongsTest.java
315 issues
Line: 329
testReverse(new long[] {-1, 1, -2, 2}, new long[] {2, -2, 1, -1});
}
private static void testReverse(long[] input, long[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Longs.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 335
assertTrue(Arrays.equals(expectedOutput, input));
}
private static void testReverse(long[] input, int fromIndex, int toIndex, long[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Longs.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 358
testSortDescending(new long[] {-1, 1, -2, 2}, new long[] {2, 1, -1, -2});
}
private static void testSortDescending(long[] input, long[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Longs.sortDescending(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 365
}
private static void testSortDescending(
long[] input, int fromIndex, int toIndex, long[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Longs.sortDescending(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.primitives;
import static java.lang.Long.MAX_VALUE;
import static java.lang.Long.MIN_VALUE;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 44
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class LongsTest extends TestCase {
private static final long[] EMPTY = {};
private static final long[] ARRAY1 = {(long) 1};
private static final long[] ARRAY234 = {(long) 2, (long) 3, (long) 4};
private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};
Reported by PMD.
Line: 44
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class LongsTest extends TestCase {
private static final long[] EMPTY = {};
private static final long[] ARRAY1 = {(long) 1};
private static final long[] ARRAY234 = {(long) 2, (long) 3, (long) 4};
private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};
Reported by PMD.
Line: 51
private static final long[] VALUES = {MIN_VALUE, (long) -1, (long) 0, (long) 1, MAX_VALUE};
@GwtIncompatible // Long.hashCode returns different values in GWT.
public void testHashCode() {
for (long value : VALUES) {
assertEquals("hashCode for " + value, ((Long) value).hashCode(), Longs.hashCode(value));
}
}
Reported by PMD.
Line: 58
}
}
public void testCompare() {
for (long x : VALUES) {
for (long y : VALUES) {
// note: spec requires only that the sign is the same
assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
}
Reported by PMD.
Line: 62
for (long x : VALUES) {
for (long y : VALUES) {
// note: spec requires only that the sign is the same
assertEquals(x + ", " + y, Long.valueOf(x).compareTo(y), Longs.compare(x, y));
}
}
}
public void testContains() {
Reported by PMD.
android/guava-tests/test/com/google/common/math/StatsTest.java
314 issues
Line: 17
* limitations under the License.
*/
package com.google.common.math;
import static com.google.common.math.StatsTesting.ALLOWED_ERROR;
import static com.google.common.math.StatsTesting.ALL_MANY_VALUES;
import static com.google.common.math.StatsTesting.ALL_STATS;
import static com.google.common.math.StatsTesting.EMPTY_STATS_ITERABLE;
Reported by PMD.
Line: 89
*
* @author Pete Gillin
*/
public class StatsTest extends TestCase {
public void testCount() {
assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
Reported by PMD.
Line: 89
*
* @author Pete Gillin
*/
public class StatsTest extends TestCase {
public void testCount() {
assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
Reported by PMD.
Line: 91
*/
public class StatsTest extends TestCase {
public void testCount() {
assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
Reported by PMD.
Line: 91
*/
public class StatsTest extends TestCase {
public void testCount() {
assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
Reported by PMD.
Line: 92
public class StatsTest extends TestCase {
public void testCount() {
assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
Reported by PMD.
Line: 93
public void testCount() {
assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERATOR.count()).isEqualTo(MANY_VALUES_COUNT);
Reported by PMD.
Line: 94
public void testCount() {
assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERATOR.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_SNAPSHOT.count()).isEqualTo(MANY_VALUES_COUNT);
Reported by PMD.
Line: 95
assertThat(EMPTY_STATS_VARARGS.count()).isEqualTo(0);
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERATOR.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_SNAPSHOT.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(INTEGER_MANY_VALUES_STATS_VARARGS.count()).isEqualTo(INTEGER_MANY_VALUES_COUNT);
Reported by PMD.
Line: 96
assertThat(EMPTY_STATS_ITERABLE.count()).isEqualTo(0);
assertThat(ONE_VALUE_STATS.count()).isEqualTo(1);
assertThat(TWO_VALUES_STATS.count()).isEqualTo(2);
assertThat(MANY_VALUES_STATS_VARARGS.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_ITERATOR.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(MANY_VALUES_STATS_SNAPSHOT.count()).isEqualTo(MANY_VALUES_COUNT);
assertThat(INTEGER_MANY_VALUES_STATS_VARARGS.count()).isEqualTo(INTEGER_MANY_VALUES_COUNT);
assertThat(INTEGER_MANY_VALUES_STATS_ITERABLE.count()).isEqualTo(INTEGER_MANY_VALUES_COUNT);
Reported by PMD.
guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java
310 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.collect.testing.Helpers.mapEntry;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.collect.testing.Helpers.mapEntry;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 65
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ImmutableSortedMapTest extends TestCase {
// TODO: Avoid duplicating code in ImmutableMapTest
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
Reported by PMD.
Line: 68
public class ImmutableSortedMapTest extends TestCase {
// TODO: Avoid duplicating code in ImmutableMapTest
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableSortedMapTest.class);
suite.addTest(
Reported by PMD.
Line: 143
protected void assertMoreInvariants(Map<K, V> map) {
// TODO: can these be moved to MapInterfaceTest?
for (Entry<K, V> entry : map.entrySet()) {
assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
Reported by PMD.
Line: 146
assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
Reported by PMD.
Line: 147
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
Reported by PMD.
Line: 147
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
Reported by PMD.
Line: 148
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
}
Reported by PMD.
Line: 148
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java
307 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
Reported by PMD.
Line: 59
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ImmutableSortedMapTest extends TestCase {
// TODO: Avoid duplicating code in ImmutableMapTest
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
Reported by PMD.
Line: 62
public class ImmutableSortedMapTest extends TestCase {
// TODO: Avoid duplicating code in ImmutableMapTest
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableSortedMapTest.class);
suite.addTest(
Reported by PMD.
Line: 137
protected void assertMoreInvariants(Map<K, V> map) {
// TODO: can these be moved to MapInterfaceTest?
for (Entry<K, V> entry : map.entrySet()) {
assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
Reported by PMD.
Line: 140
assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
Reported by PMD.
Line: 141
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
Reported by PMD.
Line: 141
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
Reported by PMD.
Line: 142
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
}
Reported by PMD.
Line: 142
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(Sets.newHashSet(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
}
Reported by PMD.
guava-tests/test/com/google/common/collect/ListsTest.java
301 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 68
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
private static final class RemoveFirstFunction implements Function<String, String>, Serializable {
@Override
public String apply(String from) {
return (from.length() == 0) ? from : from.substring(1);
}
}
Reported by PMD.
Line: 101
private static final long serialVersionUID = 0;
}
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ListsTest.class);
suite.addTest(
Reported by PMD.
Line: 102
}
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ListsTest.class);
suite.addTest(
ListTestSuiteBuilder.using(
Reported by PMD.
guava-tests/test/com/google/common/primitives/FloatsTest.java
301 issues
Line: 325
testReverse(new float[] {-1, 1, -2, 2}, new float[] {2, -2, 1, -1});
}
private static void testReverse(float[] input, float[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Floats.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 332
}
private static void testReverse(
float[] input, int fromIndex, int toIndex, float[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Floats.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 357
new float[] {-1, 1, Float.NaN, -2, -0, 0, 2}, new float[] {Float.NaN, 2, 1, 0, -0, -1, -2});
}
private static void testSortDescending(float[] input, float[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Floats.sortDescending(input);
// GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
for (int i = 0; i < input.length; i++) {
assertEquals(0, Float.compare(expectedOutput[i], input[i]));
Reported by PMD.
Line: 367
}
private static void testSortDescending(
float[] input, int fromIndex, int toIndex, float[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Floats.sortDescending(input, fromIndex, toIndex);
// GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
for (int i = 0; i < input.length; i++) {
assertEquals(0, Float.compare(expectedOutput[i], input[i]));
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.primitives;
import static com.google.common.truth.Truth.assertThat;
import static java.lang.Float.NaN;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 43
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
private static final float[] EMPTY = {};
private static final float[] ARRAY1 = {(float) 1};
private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};
private static final float LEAST = Float.NEGATIVE_INFINITY;
Reported by PMD.
Line: 43
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
private static final float[] EMPTY = {};
private static final float[] ARRAY1 = {(float) 1};
private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};
private static final float LEAST = Float.NEGATIVE_INFINITY;
Reported by PMD.
Line: 43
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
private static final float[] EMPTY = {};
private static final float[] ARRAY1 = {(float) 1};
private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};
private static final float LEAST = Float.NEGATIVE_INFINITY;
Reported by PMD.
Line: 73
private static final float[] VALUES = Floats.concat(NUMBERS, new float[] {NaN});
public void testHashCode() {
for (float value : VALUES) {
assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
}
}
Reported by PMD.
Line: 75
public void testHashCode() {
for (float value : VALUES) {
assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
}
}
public void testIsFinite() {
for (float value : NUMBERS) {
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ListsTest.java
301 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.IteratorFeature.UNMODIFIABLE;
import static com.google.common.truth.Truth.assertThat;
import static java.util.Arrays.asList;
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 62
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ListsTest extends TestCase {
private static final Collection<Integer> SOME_COLLECTION = asList(0, 1, 1);
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
Reported by PMD.
Line: 68
private static final Iterable<Integer> SOME_ITERABLE = new SomeIterable();
private static final class RemoveFirstFunction implements Function<String, String>, Serializable {
@Override
public String apply(String from) {
return (from.length() == 0) ? from : from.substring(1);
}
}
Reported by PMD.
Line: 101
private static final long serialVersionUID = 0;
}
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ListsTest.class);
suite.addTest(
Reported by PMD.
Line: 102
}
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ListsTest.class);
suite.addTest(
ListTestSuiteBuilder.using(
Reported by PMD.
android/guava-tests/test/com/google/common/primitives/FloatsTest.java
301 issues
Line: 325
testReverse(new float[] {-1, 1, -2, 2}, new float[] {2, -2, 1, -1});
}
private static void testReverse(float[] input, float[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Floats.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 332
}
private static void testReverse(
float[] input, int fromIndex, int toIndex, float[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Floats.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 357
new float[] {-1, 1, Float.NaN, -2, -0, 0, 2}, new float[] {Float.NaN, 2, 1, 0, -0, -1, -2});
}
private static void testSortDescending(float[] input, float[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Floats.sortDescending(input);
// GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
for (int i = 0; i < input.length; i++) {
assertEquals(0, Float.compare(expectedOutput[i], input[i]));
Reported by PMD.
Line: 367
}
private static void testSortDescending(
float[] input, int fromIndex, int toIndex, float[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Floats.sortDescending(input, fromIndex, toIndex);
// GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually
for (int i = 0; i < input.length; i++) {
assertEquals(0, Float.compare(expectedOutput[i], input[i]));
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.primitives;
import static com.google.common.truth.Truth.assertThat;
import static java.lang.Float.NaN;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 43
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
private static final float[] EMPTY = {};
private static final float[] ARRAY1 = {(float) 1};
private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};
private static final float LEAST = Float.NEGATIVE_INFINITY;
Reported by PMD.
Line: 43
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
private static final float[] EMPTY = {};
private static final float[] ARRAY1 = {(float) 1};
private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};
private static final float LEAST = Float.NEGATIVE_INFINITY;
Reported by PMD.
Line: 43
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class FloatsTest extends TestCase {
private static final float[] EMPTY = {};
private static final float[] ARRAY1 = {(float) 1};
private static final float[] ARRAY234 = {(float) 2, (float) 3, (float) 4};
private static final float LEAST = Float.NEGATIVE_INFINITY;
Reported by PMD.
Line: 73
private static final float[] VALUES = Floats.concat(NUMBERS, new float[] {NaN});
public void testHashCode() {
for (float value : VALUES) {
assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
}
}
Reported by PMD.
Line: 75
public void testHashCode() {
for (float value : VALUES) {
assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
}
}
public void testIsFinite() {
for (float value : NUMBERS) {
Reported by PMD.