The following issues were found
android/guava-tests/test/com/google/common/math/StatsAccumulatorTest.java
350 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.INTEGER_MANY_VALUES;
import static com.google.common.math.StatsTesting.INTEGER_MANY_VALUES_COUNT;
Reported by PMD.
Line: 64
*
* @author Pete Gillin
*/
public class StatsAccumulatorTest extends TestCase {
private StatsAccumulator emptyAccumulator;
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
Reported by PMD.
Line: 64
*
* @author Pete Gillin
*/
public class StatsAccumulatorTest extends TestCase {
private StatsAccumulator emptyAccumulator;
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
Reported by PMD.
Line: 64
*
* @author Pete Gillin
*/
public class StatsAccumulatorTest extends TestCase {
private StatsAccumulator emptyAccumulator;
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
Reported by PMD.
Line: 64
*
* @author Pete Gillin
*/
public class StatsAccumulatorTest extends TestCase {
private StatsAccumulator emptyAccumulator;
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
Reported by PMD.
Line: 66
*/
public class StatsAccumulatorTest extends TestCase {
private StatsAccumulator emptyAccumulator;
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
private StatsAccumulator twoValuesAccumulator;
Reported by PMD.
Line: 67
public class StatsAccumulatorTest extends TestCase {
private StatsAccumulator emptyAccumulator;
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
private StatsAccumulator twoValuesAccumulator;
private StatsAccumulator twoValuesAccumulatorByAddAllStats;
Reported by PMD.
Line: 68
private StatsAccumulator emptyAccumulator;
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
private StatsAccumulator twoValuesAccumulator;
private StatsAccumulator twoValuesAccumulatorByAddAllStats;
private StatsAccumulator manyValuesAccumulatorByAddAllIterable;
Reported by PMD.
Line: 69
private StatsAccumulator emptyAccumulator;
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
private StatsAccumulator twoValuesAccumulator;
private StatsAccumulator twoValuesAccumulatorByAddAllStats;
private StatsAccumulator manyValuesAccumulatorByAddAllIterable;
private StatsAccumulator manyValuesAccumulatorByAddAllIterator;
Reported by PMD.
Line: 70
private StatsAccumulator emptyAccumulatorByAddAllEmptyIterable;
private StatsAccumulator emptyAccumulatorByAddAllEmptyStats;
private StatsAccumulator oneValueAccumulator;
private StatsAccumulator oneValueAccumulatorByAddAllEmptyStats;
private StatsAccumulator twoValuesAccumulator;
private StatsAccumulator twoValuesAccumulatorByAddAllStats;
private StatsAccumulator manyValuesAccumulatorByAddAllIterable;
private StatsAccumulator manyValuesAccumulatorByAddAllIterator;
private StatsAccumulator manyValuesAccumulatorByAddAllVarargs;
Reported by PMD.
android/guava-tests/test/com/google/common/collect/TreeRangeSetTest.java
345 issues
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.collect.BoundType.OPEN;
import static com.google.common.collect.Range.range;
import static com.google.common.truth.Truth.assertThat;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 67
QUERY_RANGES = queryBuilder.build();
}
void testViewAgainstExpected(RangeSet<Integer> expected, RangeSet<Integer> view) {
assertEquals(expected, view);
assertEquals(expected.asRanges(), view.asRanges());
assertEquals(expected.isEmpty(), view.isEmpty());
if (!expected.isEmpty()) {
Reported by PMD.
Line: 110
testNavigationAgainstExpected(expectedRangesByLowerBound, rangesByLowerBound, CUTS_TO_TEST);
}
<K, V> void testNavigationAgainstExpected(
NavigableMap<K, V> expected, NavigableMap<K, V> navigableMap, Iterable<K> keysToTest) {
for (K key : keysToTest) {
assertEquals(expected.lowerEntry(key), navigableMap.lowerEntry(key));
assertEquals(expected.floorEntry(key), navigableMap.floorEntry(key));
assertEquals(expected.ceilingEntry(key), navigableMap.ceilingEntry(key));
Reported by PMD.
Line: 117
assertEquals(expected.floorEntry(key), navigableMap.floorEntry(key));
assertEquals(expected.ceilingEntry(key), navigableMap.ceilingEntry(key));
assertEquals(expected.higherEntry(key), navigableMap.higherEntry(key));
for (boolean inclusive : new boolean[] {false, true}) {
assertThat(navigableMap.headMap(key, inclusive).entrySet())
.containsExactlyElementsIn(expected.headMap(key, inclusive).entrySet())
.inOrder();
assertThat(navigableMap.tailMap(key, inclusive).entrySet())
.containsExactlyElementsIn(expected.tailMap(key, inclusive).entrySet())
Reported by PMD.
Line: 118
assertEquals(expected.ceilingEntry(key), navigableMap.ceilingEntry(key));
assertEquals(expected.higherEntry(key), navigableMap.higherEntry(key));
for (boolean inclusive : new boolean[] {false, true}) {
assertThat(navigableMap.headMap(key, inclusive).entrySet())
.containsExactlyElementsIn(expected.headMap(key, inclusive).entrySet())
.inOrder();
assertThat(navigableMap.tailMap(key, inclusive).entrySet())
.containsExactlyElementsIn(expected.tailMap(key, inclusive).entrySet())
.inOrder();
Reported by PMD.
guava-tests/test/com/google/common/collect/TreeRangeSetTest.java
345 issues
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.collect.BoundType.OPEN;
import static com.google.common.collect.Range.range;
import static com.google.common.truth.Truth.assertThat;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 34
* @author Chris Povirk
*/
@GwtIncompatible // TreeRangeSet
public class TreeRangeSetTest extends AbstractRangeSetTest {
// TODO(cpovirk): test all of these with the ranges added in the reverse order
private static final ImmutableList<Range<Integer>> QUERY_RANGES;
private static final int MIN_BOUND = -1;
Reported by PMD.
Line: 67
QUERY_RANGES = queryBuilder.build();
}
void testViewAgainstExpected(RangeSet<Integer> expected, RangeSet<Integer> view) {
assertEquals(expected, view);
assertEquals(expected.asRanges(), view.asRanges());
assertEquals(expected.isEmpty(), view.isEmpty());
if (!expected.isEmpty()) {
Reported by PMD.
Line: 110
testNavigationAgainstExpected(expectedRangesByLowerBound, rangesByLowerBound, CUTS_TO_TEST);
}
<K, V> void testNavigationAgainstExpected(
NavigableMap<K, V> expected, NavigableMap<K, V> navigableMap, Iterable<K> keysToTest) {
for (K key : keysToTest) {
assertEquals(expected.lowerEntry(key), navigableMap.lowerEntry(key));
assertEquals(expected.floorEntry(key), navigableMap.floorEntry(key));
assertEquals(expected.ceilingEntry(key), navigableMap.ceilingEntry(key));
Reported by PMD.
Line: 117
assertEquals(expected.floorEntry(key), navigableMap.floorEntry(key));
assertEquals(expected.ceilingEntry(key), navigableMap.ceilingEntry(key));
assertEquals(expected.higherEntry(key), navigableMap.higherEntry(key));
for (boolean inclusive : new boolean[] {false, true}) {
assertThat(navigableMap.headMap(key, inclusive).entrySet())
.containsExactlyElementsIn(expected.headMap(key, inclusive).entrySet())
.inOrder();
assertThat(navigableMap.tailMap(key, inclusive).entrySet())
.containsExactlyElementsIn(expected.tailMap(key, inclusive).entrySet())
Reported by PMD.
Line: 118
assertEquals(expected.ceilingEntry(key), navigableMap.ceilingEntry(key));
assertEquals(expected.higherEntry(key), navigableMap.higherEntry(key));
for (boolean inclusive : new boolean[] {false, true}) {
assertThat(navigableMap.headMap(key, inclusive).entrySet())
.containsExactlyElementsIn(expected.headMap(key, inclusive).entrySet())
.inOrder();
assertThat(navigableMap.tailMap(key, inclusive).entrySet())
.containsExactlyElementsIn(expected.tailMap(key, inclusive).entrySet())
.inOrder();
Reported by PMD.
guava-tests/test/com/google/common/base/PredicatesTest.java
328 issues
Line: 17
* limitations under the License.
*/
package com.google.common.base;
import static com.google.common.base.CharMatcher.whitespace;
import static com.google.common.collect.Lists.newArrayList;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 46
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class PredicatesTest extends TestCase {
private static final Predicate<Integer> TRUE = Predicates.alwaysTrue();
private static final Predicate<Integer> FALSE = Predicates.alwaysFalse();
private static final Predicate<Integer> NEVER_REACHED =
new Predicate<Integer>() {
@Override
Reported by PMD.
Line: 46
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class PredicatesTest extends TestCase {
private static final Predicate<Integer> TRUE = Predicates.alwaysTrue();
private static final Predicate<Integer> FALSE = Predicates.alwaysFalse();
private static final Predicate<Integer> NEVER_REACHED =
new Predicate<Integer>() {
@Override
Reported by PMD.
Line: 46
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class PredicatesTest extends TestCase {
private static final Predicate<Integer> TRUE = Predicates.alwaysTrue();
private static final Predicate<Integer> FALSE = Predicates.alwaysFalse();
private static final Predicate<Integer> NEVER_REACHED =
new Predicate<Integer>() {
@Override
Reported by PMD.
Line: 96
* Tests for Predicates.alwaysTrue().
*/
public void testAlwaysTrue_apply() {
assertEvalsToTrue(Predicates.alwaysTrue());
}
public void testAlwaysTrue_equality() throws Exception {
new EqualsTester()
Reported by PMD.
Line: 100
assertEvalsToTrue(Predicates.alwaysTrue());
}
public void testAlwaysTrue_equality() throws Exception {
new EqualsTester()
.addEqualityGroup(TRUE, Predicates.alwaysTrue())
.addEqualityGroup(isOdd())
.addEqualityGroup(Predicates.alwaysFalse())
.testEquals();
Reported by PMD.
Line: 100
assertEvalsToTrue(Predicates.alwaysTrue());
}
public void testAlwaysTrue_equality() throws Exception {
new EqualsTester()
.addEqualityGroup(TRUE, Predicates.alwaysTrue())
.addEqualityGroup(isOdd())
.addEqualityGroup(Predicates.alwaysFalse())
.testEquals();
Reported by PMD.
Line: 108
.testEquals();
}
@GwtIncompatible // SerializableTester
public void testAlwaysTrue_serialization() {
checkSerialization(Predicates.alwaysTrue());
}
/*
Reported by PMD.
Line: 109
}
@GwtIncompatible // SerializableTester
public void testAlwaysTrue_serialization() {
checkSerialization(Predicates.alwaysTrue());
}
/*
* Tests for Predicates.alwaysFalse().
Reported by PMD.
Line: 117
* Tests for Predicates.alwaysFalse().
*/
public void testAlwaysFalse_apply() throws Exception {
assertEvalsToFalse(Predicates.alwaysFalse());
}
public void testAlwaysFalse_equality() throws Exception {
new EqualsTester()
Reported by PMD.
android/guava-tests/test/com/google/common/base/PredicatesTest.java
328 issues
Line: 17
* limitations under the License.
*/
package com.google.common.base;
import static com.google.common.base.CharMatcher.whitespace;
import static com.google.common.collect.Lists.newArrayList;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 46
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class PredicatesTest extends TestCase {
private static final Predicate<Integer> TRUE = Predicates.alwaysTrue();
private static final Predicate<Integer> FALSE = Predicates.alwaysFalse();
private static final Predicate<Integer> NEVER_REACHED =
new Predicate<Integer>() {
@Override
Reported by PMD.
Line: 46
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class PredicatesTest extends TestCase {
private static final Predicate<Integer> TRUE = Predicates.alwaysTrue();
private static final Predicate<Integer> FALSE = Predicates.alwaysFalse();
private static final Predicate<Integer> NEVER_REACHED =
new Predicate<Integer>() {
@Override
Reported by PMD.
Line: 46
* @author Kevin Bourrillion
*/
@GwtCompatible(emulated = true)
public class PredicatesTest extends TestCase {
private static final Predicate<Integer> TRUE = Predicates.alwaysTrue();
private static final Predicate<Integer> FALSE = Predicates.alwaysFalse();
private static final Predicate<Integer> NEVER_REACHED =
new Predicate<Integer>() {
@Override
Reported by PMD.
Line: 96
* Tests for Predicates.alwaysTrue().
*/
public void testAlwaysTrue_apply() {
assertEvalsToTrue(Predicates.alwaysTrue());
}
public void testAlwaysTrue_equality() throws Exception {
new EqualsTester()
Reported by PMD.
Line: 100
assertEvalsToTrue(Predicates.alwaysTrue());
}
public void testAlwaysTrue_equality() throws Exception {
new EqualsTester()
.addEqualityGroup(TRUE, Predicates.alwaysTrue())
.addEqualityGroup(isOdd())
.addEqualityGroup(Predicates.alwaysFalse())
.testEquals();
Reported by PMD.
Line: 100
assertEvalsToTrue(Predicates.alwaysTrue());
}
public void testAlwaysTrue_equality() throws Exception {
new EqualsTester()
.addEqualityGroup(TRUE, Predicates.alwaysTrue())
.addEqualityGroup(isOdd())
.addEqualityGroup(Predicates.alwaysFalse())
.testEquals();
Reported by PMD.
Line: 108
.testEquals();
}
@GwtIncompatible // SerializableTester
public void testAlwaysTrue_serialization() {
checkSerialization(Predicates.alwaysTrue());
}
/*
Reported by PMD.
Line: 109
}
@GwtIncompatible // SerializableTester
public void testAlwaysTrue_serialization() {
checkSerialization(Predicates.alwaysTrue());
}
/*
* Tests for Predicates.alwaysFalse().
Reported by PMD.
Line: 117
* Tests for Predicates.alwaysFalse().
*/
public void testAlwaysFalse_apply() throws Exception {
assertEvalsToFalse(Predicates.alwaysFalse());
}
public void testAlwaysFalse_equality() throws Exception {
new EqualsTester()
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java
327 issues
Line: 17
* limitations under the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static java.lang.Thread.currentThread;
import static java.util.concurrent.TimeUnit.SECONDS;
Reported by PMD.
Line: 43
*
* @author Jesse Wilson
*/
public class AbstractServiceTest extends TestCase {
private static final long LONG_TIMEOUT_MILLIS = 10000;
private Thread executionThread;
private Throwable thrownByExecutionThread;
Reported by PMD.
Line: 43
*
* @author Jesse Wilson
*/
public class AbstractServiceTest extends TestCase {
private static final long LONG_TIMEOUT_MILLIS = 10000;
private Thread executionThread;
private Throwable thrownByExecutionThread;
Reported by PMD.
Line: 46
public class AbstractServiceTest extends TestCase {
private static final long LONG_TIMEOUT_MILLIS = 10000;
private Thread executionThread;
private Throwable thrownByExecutionThread;
public void testNoOpServiceStartStop() throws Exception {
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
Reported by PMD.
Line: 47
private static final long LONG_TIMEOUT_MILLIS = 10000;
private Thread executionThread;
private Throwable thrownByExecutionThread;
public void testNoOpServiceStartStop() throws Exception {
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
Reported by PMD.
Line: 49
private Thread executionThread;
private Throwable thrownByExecutionThread;
public void testNoOpServiceStartStop() throws Exception {
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
Reported by PMD.
Line: 49
private Thread executionThread;
private Throwable thrownByExecutionThread;
public void testNoOpServiceStartStop() throws Exception {
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
Reported by PMD.
Line: 53
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
assertFalse(service.running);
service.startAsync();
assertEquals(State.RUNNING, service.state());
Reported by PMD.
Line: 54
RecordingListener listener = RecordingListener.record(service);
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
assertFalse(service.running);
service.startAsync();
assertEquals(State.RUNNING, service.state());
assertTrue(service.isRunning());
Reported by PMD.
Line: 55
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
assertFalse(service.running);
service.startAsync();
assertEquals(State.RUNNING, service.state());
assertTrue(service.isRunning());
assertTrue(service.running);
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java
327 issues
Line: 17
* limitations under the License.
*/
package com.google.common.util.concurrent;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static java.lang.Thread.currentThread;
import static java.util.concurrent.TimeUnit.SECONDS;
Reported by PMD.
Line: 43
*
* @author Jesse Wilson
*/
public class AbstractServiceTest extends TestCase {
private static final long LONG_TIMEOUT_MILLIS = 10000;
private Thread executionThread;
private Throwable thrownByExecutionThread;
Reported by PMD.
Line: 43
*
* @author Jesse Wilson
*/
public class AbstractServiceTest extends TestCase {
private static final long LONG_TIMEOUT_MILLIS = 10000;
private Thread executionThread;
private Throwable thrownByExecutionThread;
Reported by PMD.
Line: 46
public class AbstractServiceTest extends TestCase {
private static final long LONG_TIMEOUT_MILLIS = 10000;
private Thread executionThread;
private Throwable thrownByExecutionThread;
public void testNoOpServiceStartStop() throws Exception {
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
Reported by PMD.
Line: 47
private static final long LONG_TIMEOUT_MILLIS = 10000;
private Thread executionThread;
private Throwable thrownByExecutionThread;
public void testNoOpServiceStartStop() throws Exception {
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
Reported by PMD.
Line: 49
private Thread executionThread;
private Throwable thrownByExecutionThread;
public void testNoOpServiceStartStop() throws Exception {
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
Reported by PMD.
Line: 49
private Thread executionThread;
private Throwable thrownByExecutionThread;
public void testNoOpServiceStartStop() throws Exception {
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
Reported by PMD.
Line: 53
NoOpService service = new NoOpService();
RecordingListener listener = RecordingListener.record(service);
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
assertFalse(service.running);
service.startAsync();
assertEquals(State.RUNNING, service.state());
Reported by PMD.
Line: 54
RecordingListener listener = RecordingListener.record(service);
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
assertFalse(service.running);
service.startAsync();
assertEquals(State.RUNNING, service.state());
assertTrue(service.isRunning());
Reported by PMD.
Line: 55
assertEquals(State.NEW, service.state());
assertFalse(service.isRunning());
assertFalse(service.running);
service.startAsync();
assertEquals(State.RUNNING, service.state());
assertTrue(service.isRunning());
assertTrue(service.running);
Reported by PMD.
guava-tests/test/com/google/common/primitives/IntsTest.java
317 issues
Line: 317
testReverse(new int[] {-1, 1, -2, 2}, new int[] {2, -2, 1, -1});
}
private static void testReverse(int[] input, int[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Ints.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 323
assertTrue(Arrays.equals(expectedOutput, input));
}
private static void testReverse(int[] input, int fromIndex, int toIndex, int[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Ints.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 346
testSortDescending(new int[] {-1, 1, -2, 2}, new int[] {2, 1, -1, -2});
}
private static void testSortDescending(int[] input, int[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Ints.sortDescending(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 353
}
private static void testSortDescending(
int[] input, int fromIndex, int toIndex, int[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Ints.sortDescending(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.primitives;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Converter;
import com.google.common.collect.testing.Helpers;
Reported by PMD.
Line: 40
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class IntsTest extends TestCase {
private static final int[] EMPTY = {};
private static final int[] ARRAY1 = {(int) 1};
private static final int[] ARRAY234 = {(int) 2, (int) 3, (int) 4};
private static final int LEAST = Integer.MIN_VALUE;
Reported by PMD.
Line: 40
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class IntsTest extends TestCase {
private static final int[] EMPTY = {};
private static final int[] ARRAY1 = {(int) 1};
private static final int[] ARRAY234 = {(int) 2, (int) 3, (int) 4};
private static final int LEAST = Integer.MIN_VALUE;
Reported by PMD.
Line: 50
private static final int[] VALUES = {LEAST, (int) -1, (int) 0, (int) 1, GREATEST};
public void testHashCode() {
for (int value : VALUES) {
assertEquals(((Integer) value).hashCode(), Ints.hashCode(value));
}
}
Reported by PMD.
Line: 52
public void testHashCode() {
for (int value : VALUES) {
assertEquals(((Integer) value).hashCode(), Ints.hashCode(value));
}
}
public void testCheckedCast() {
for (int value : VALUES) {
Reported by PMD.
Line: 56
}
}
public void testCheckedCast() {
for (int value : VALUES) {
assertEquals(value, Ints.checkedCast((long) value));
}
assertCastFails(GREATEST + 1L);
assertCastFails(LEAST - 1L);
Reported by PMD.
android/guava-tests/test/com/google/common/primitives/IntsTest.java
317 issues
Line: 317
testReverse(new int[] {-1, 1, -2, 2}, new int[] {2, -2, 1, -1});
}
private static void testReverse(int[] input, int[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Ints.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 323
assertTrue(Arrays.equals(expectedOutput, input));
}
private static void testReverse(int[] input, int fromIndex, int toIndex, int[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Ints.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 346
testSortDescending(new int[] {-1, 1, -2, 2}, new int[] {2, 1, -1, -2});
}
private static void testSortDescending(int[] input, int[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Ints.sortDescending(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 353
}
private static void testSortDescending(
int[] input, int fromIndex, int toIndex, int[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Ints.sortDescending(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.primitives;
import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.Converter;
import com.google.common.collect.testing.Helpers;
Reported by PMD.
Line: 40
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class IntsTest extends TestCase {
private static final int[] EMPTY = {};
private static final int[] ARRAY1 = {(int) 1};
private static final int[] ARRAY234 = {(int) 2, (int) 3, (int) 4};
private static final int LEAST = Integer.MIN_VALUE;
Reported by PMD.
Line: 40
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class IntsTest extends TestCase {
private static final int[] EMPTY = {};
private static final int[] ARRAY1 = {(int) 1};
private static final int[] ARRAY234 = {(int) 2, (int) 3, (int) 4};
private static final int LEAST = Integer.MIN_VALUE;
Reported by PMD.
Line: 50
private static final int[] VALUES = {LEAST, (int) -1, (int) 0, (int) 1, GREATEST};
public void testHashCode() {
for (int value : VALUES) {
assertEquals(((Integer) value).hashCode(), Ints.hashCode(value));
}
}
Reported by PMD.
Line: 52
public void testHashCode() {
for (int value : VALUES) {
assertEquals(((Integer) value).hashCode(), Ints.hashCode(value));
}
}
public void testCheckedCast() {
for (int value : VALUES) {
Reported by PMD.
Line: 56
}
}
public void testCheckedCast() {
for (int value : VALUES) {
assertEquals(value, Ints.checkedCast((long) value));
}
assertCastFails(GREATEST + 1L);
assertCastFails(LEAST - 1L);
Reported by PMD.
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.