The following issues were found
guava/src/com/google/common/collect/TreeRangeSet.java
166 issues
Line: 477
this.complementLowerBoundWindow = window;
}
private NavigableMap<Cut<C>, Range<C>> subMap(Range<Cut<C>> subWindow) {
if (!complementLowerBoundWindow.isConnected(subWindow)) {
return ImmutableSortedMap.of();
} else {
subWindow = subWindow.intersection(complementLowerBoundWindow);
return new ComplementRangesByLowerBound<C>(positiveRangesByLowerBound, subWindow);
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.Beta;
Reported by PMD.
Line: 44
@Beta
@GwtIncompatible // uses NavigableMap
@ElementTypesAreNonnullByDefault
public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
implements Serializable {
@VisibleForTesting final NavigableMap<Cut<C>, Range<C>> rangesByLowerBound;
/** Creates an empty {@code TreeRangeSet} instance. */
Reported by PMD.
Line: 45
@GwtIncompatible // uses NavigableMap
@ElementTypesAreNonnullByDefault
public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
implements Serializable {
@VisibleForTesting final NavigableMap<Cut<C>, Range<C>> rangesByLowerBound;
/** Creates an empty {@code TreeRangeSet} instance. */
public static <C extends Comparable<?>> TreeRangeSet<C> create() {
Reported by PMD.
Line: 47
public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
implements Serializable {
@VisibleForTesting final NavigableMap<Cut<C>, Range<C>> rangesByLowerBound;
/** Creates an empty {@code TreeRangeSet} instance. */
public static <C extends Comparable<?>> TreeRangeSet<C> create() {
return new TreeRangeSet<C>(new TreeMap<Cut<C>, Range<C>>());
}
Reported by PMD.
Line: 57
/** Returns a {@code TreeRangeSet} initialized with the ranges in the specified range set. */
public static <C extends Comparable<?>> TreeRangeSet<C> create(RangeSet<C> rangeSet) {
TreeRangeSet<C> result = create();
result.addAll(rangeSet);
return result;
}
/**
* Returns a {@code TreeRangeSet} representing the union of the specified ranges.
Reported by PMD.
Line: 72
*/
public static <C extends Comparable<?>> TreeRangeSet<C> create(Iterable<Range<C>> ranges) {
TreeRangeSet<C> result = create();
result.addAll(ranges);
return result;
}
private TreeRangeSet(NavigableMap<Cut<C>, Range<C>> rangesByLowerCut) {
this.rangesByLowerBound = rangesByLowerCut;
Reported by PMD.
Line: 80
this.rangesByLowerBound = rangesByLowerCut;
}
@CheckForNull private transient Set<Range<C>> asRanges;
@CheckForNull private transient Set<Range<C>> asDescendingSetOfRanges;
@Override
public Set<Range<C>> asRanges() {
Set<Range<C>> result = asRanges;
Reported by PMD.
Line: 81
}
@CheckForNull private transient Set<Range<C>> asRanges;
@CheckForNull private transient Set<Range<C>> asDescendingSetOfRanges;
@Override
public Set<Range<C>> asRanges() {
Set<Range<C>> result = asRanges;
return (result == null) ? asRanges = new AsRanges(rangesByLowerBound.values()) : result;
Reported by PMD.
Line: 93
public Set<Range<C>> asDescendingSetOfRanges() {
Set<Range<C>> result = asDescendingSetOfRanges;
return (result == null)
? asDescendingSetOfRanges = new AsRanges(rangesByLowerBound.descendingMap().values())
: result;
}
final class AsRanges extends ForwardingCollection<Range<C>> implements Set<Range<C>> {
Reported by PMD.
android/guava/src/com/google/common/collect/TreeRangeSet.java
166 issues
Line: 477
this.complementLowerBoundWindow = window;
}
private NavigableMap<Cut<C>, Range<C>> subMap(Range<Cut<C>> subWindow) {
if (!complementLowerBoundWindow.isConnected(subWindow)) {
return ImmutableSortedMap.of();
} else {
subWindow = subWindow.intersection(complementLowerBoundWindow);
return new ComplementRangesByLowerBound<C>(positiveRangesByLowerBound, subWindow);
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.Beta;
Reported by PMD.
Line: 44
@Beta
@GwtIncompatible // uses NavigableMap
@ElementTypesAreNonnullByDefault
public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
implements Serializable {
@VisibleForTesting final NavigableMap<Cut<C>, Range<C>> rangesByLowerBound;
/** Creates an empty {@code TreeRangeSet} instance. */
Reported by PMD.
Line: 45
@GwtIncompatible // uses NavigableMap
@ElementTypesAreNonnullByDefault
public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
implements Serializable {
@VisibleForTesting final NavigableMap<Cut<C>, Range<C>> rangesByLowerBound;
/** Creates an empty {@code TreeRangeSet} instance. */
public static <C extends Comparable<?>> TreeRangeSet<C> create() {
Reported by PMD.
Line: 47
public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
implements Serializable {
@VisibleForTesting final NavigableMap<Cut<C>, Range<C>> rangesByLowerBound;
/** Creates an empty {@code TreeRangeSet} instance. */
public static <C extends Comparable<?>> TreeRangeSet<C> create() {
return new TreeRangeSet<C>(new TreeMap<Cut<C>, Range<C>>());
}
Reported by PMD.
Line: 57
/** Returns a {@code TreeRangeSet} initialized with the ranges in the specified range set. */
public static <C extends Comparable<?>> TreeRangeSet<C> create(RangeSet<C> rangeSet) {
TreeRangeSet<C> result = create();
result.addAll(rangeSet);
return result;
}
/**
* Returns a {@code TreeRangeSet} representing the union of the specified ranges.
Reported by PMD.
Line: 72
*/
public static <C extends Comparable<?>> TreeRangeSet<C> create(Iterable<Range<C>> ranges) {
TreeRangeSet<C> result = create();
result.addAll(ranges);
return result;
}
private TreeRangeSet(NavigableMap<Cut<C>, Range<C>> rangesByLowerCut) {
this.rangesByLowerBound = rangesByLowerCut;
Reported by PMD.
Line: 80
this.rangesByLowerBound = rangesByLowerCut;
}
@CheckForNull private transient Set<Range<C>> asRanges;
@CheckForNull private transient Set<Range<C>> asDescendingSetOfRanges;
@Override
public Set<Range<C>> asRanges() {
Set<Range<C>> result = asRanges;
Reported by PMD.
Line: 81
}
@CheckForNull private transient Set<Range<C>> asRanges;
@CheckForNull private transient Set<Range<C>> asDescendingSetOfRanges;
@Override
public Set<Range<C>> asRanges() {
Set<Range<C>> result = asRanges;
return (result == null) ? asRanges = new AsRanges(rangesByLowerBound.values()) : result;
Reported by PMD.
Line: 93
public Set<Range<C>> asDescendingSetOfRanges() {
Set<Range<C>> result = asDescendingSetOfRanges;
return (result == null)
? asDescendingSetOfRanges = new AsRanges(rangesByLowerBound.descendingMap().values())
: result;
}
final class AsRanges extends ForwardingCollection<Range<C>> implements Set<Range<C>> {
Reported by PMD.
android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java
163 issues
Line: 52
* @author Luke Sandberg
* @author Chris Nokleberg
*/
public class ServiceManagerTest extends TestCase {
private static class NoOpService extends AbstractService {
@Override
protected void doStart() {
notifyStarted();
Reported by PMD.
Line: 52
* @author Luke Sandberg
* @author Chris Nokleberg
*/
public class ServiceManagerTest extends TestCase {
private static class NoOpService extends AbstractService {
@Override
protected void doStart() {
notifyStarted();
Reported by PMD.
Line: 52
* @author Luke Sandberg
* @author Chris Nokleberg
*/
public class ServiceManagerTest extends TestCase {
private static class NoOpService extends AbstractService {
@Override
protected void doStart() {
notifyStarted();
Reported by PMD.
Line: 52
* @author Luke Sandberg
* @author Chris Nokleberg
*/
public class ServiceManagerTest extends TestCase {
private static class NoOpService extends AbstractService {
@Override
protected void doStart() {
notifyStarted();
Reported by PMD.
Line: 71
* of time.
*/
private static class NoOpDelayedService extends NoOpService {
private long delay;
public NoOpDelayedService(long delay) {
this.delay = delay;
}
Reported by PMD.
Line: 71
* of time.
*/
private static class NoOpDelayedService extends NoOpService {
private long delay;
public NoOpDelayedService(long delay) {
this.delay = delay;
}
Reported by PMD.
Line: 123
}
public void testServiceStartupTimes() {
Service a = new NoOpDelayedService(150);
Service b = new NoOpDelayedService(353);
ServiceManager serviceManager = new ServiceManager(asList(a, b));
serviceManager.startAsync().awaitHealthy();
ImmutableMap<Service, Long> startupTimes = serviceManager.startupTimes();
Reported by PMD.
Line: 123
}
public void testServiceStartupTimes() {
Service a = new NoOpDelayedService(150);
Service b = new NoOpDelayedService(353);
ServiceManager serviceManager = new ServiceManager(asList(a, b));
serviceManager.startAsync().awaitHealthy();
ImmutableMap<Service, Long> startupTimes = serviceManager.startupTimes();
Reported by PMD.
Line: 127
Service a = new NoOpDelayedService(150);
Service b = new NoOpDelayedService(353);
ServiceManager serviceManager = new ServiceManager(asList(a, b));
serviceManager.startAsync().awaitHealthy();
ImmutableMap<Service, Long> startupTimes = serviceManager.startupTimes();
assertThat(startupTimes).hasSize(2);
assertThat(startupTimes.get(a)).isAtLeast(150);
assertThat(startupTimes.get(b)).isAtLeast(353);
}
Reported by PMD.
Line: 129
ServiceManager serviceManager = new ServiceManager(asList(a, b));
serviceManager.startAsync().awaitHealthy();
ImmutableMap<Service, Long> startupTimes = serviceManager.startupTimes();
assertThat(startupTimes).hasSize(2);
assertThat(startupTimes.get(a)).isAtLeast(150);
assertThat(startupTimes.get(b)).isAtLeast(353);
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java
158 issues
Line: 15
* limitations under the License.
*/
package com.google.common.collect.testing.google;
import static com.google.common.collect.BoundType.CLOSED;
import static com.google.common.collect.BoundType.OPEN;
import static com.google.common.collect.testing.Helpers.copyToList;
import static com.google.common.collect.testing.features.CollectionFeature.SUPPORTS_ADD;
Reported by PMD.
Line: 49
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
Reported by PMD.
Line: 49
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
Reported by PMD.
Line: 50
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
Reported by PMD.
Line: 51
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
Reported by PMD.
Line: 51
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
Reported by PMD.
Line: 52
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
static <T> SortedMultiset<T> cast(Multiset<T> iterable) {
Reported by PMD.
Line: 53
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
static <T> SortedMultiset<T> cast(Multiset<T> iterable) {
return (SortedMultiset<T>) iterable;
Reported by PMD.
Line: 54
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
static <T> SortedMultiset<T> cast(Multiset<T> iterable) {
return (SortedMultiset<T>) iterable;
}
Reported by PMD.
Line: 61
return (SortedMultiset<T>) iterable;
}
@Override
public void setUp() throws Exception {
super.setUp();
sortedMultiset = cast(getMultiset());
entries =
copyToList(
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java
158 issues
Line: 15
* limitations under the License.
*/
package com.google.common.collect.testing.google;
import static com.google.common.collect.BoundType.CLOSED;
import static com.google.common.collect.BoundType.OPEN;
import static com.google.common.collect.testing.Helpers.copyToList;
import static com.google.common.collect.testing.features.CollectionFeature.SUPPORTS_ADD;
Reported by PMD.
Line: 49
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
Reported by PMD.
Line: 49
*/
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
Reported by PMD.
Line: 50
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
Reported by PMD.
Line: 51
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
Reported by PMD.
Line: 51
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
Reported by PMD.
Line: 52
public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
static <T> SortedMultiset<T> cast(Multiset<T> iterable) {
Reported by PMD.
Line: 53
private SortedMultiset<E> sortedMultiset;
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
static <T> SortedMultiset<T> cast(Multiset<T> iterable) {
return (SortedMultiset<T>) iterable;
Reported by PMD.
Line: 54
private List<E> entries;
private Entry<E> a;
private Entry<E> b;
private Entry<E> c;
/** Used to avoid http://bugs.sun.com/view_bug.do?bug_id=6558557 */
static <T> SortedMultiset<T> cast(Multiset<T> iterable) {
return (SortedMultiset<T>) iterable;
}
Reported by PMD.
Line: 61
return (SortedMultiset<T>) iterable;
}
@Override
public void setUp() throws Exception {
super.setUp();
sortedMultiset = cast(getMultiset());
entries =
copyToList(
Reported by PMD.
android/guava-tests/test/com/google/common/base/CaseFormatTest.java
157 issues
Line: 37
* @author Mike Bostock
*/
@GwtCompatible(emulated = true)
public class CaseFormatTest extends TestCase {
public void testIdentity() {
for (CaseFormat from : CaseFormat.values()) {
assertSame(from + " to " + from, "foo", from.to(from, "foo"));
for (CaseFormat to : CaseFormat.values()) {
Reported by PMD.
Line: 39
@GwtCompatible(emulated = true)
public class CaseFormatTest extends TestCase {
public void testIdentity() {
for (CaseFormat from : CaseFormat.values()) {
assertSame(from + " to " + from, "foo", from.to(from, "foo"));
for (CaseFormat to : CaseFormat.values()) {
assertEquals(from + " to " + to, "", from.to(to, ""));
assertEquals(from + " to " + to, " ", from.to(to, " "));
Reported by PMD.
Line: 39
@GwtCompatible(emulated = true)
public class CaseFormatTest extends TestCase {
public void testIdentity() {
for (CaseFormat from : CaseFormat.values()) {
assertSame(from + " to " + from, "foo", from.to(from, "foo"));
for (CaseFormat to : CaseFormat.values()) {
assertEquals(from + " to " + to, "", from.to(to, ""));
assertEquals(from + " to " + to, " ", from.to(to, " "));
Reported by PMD.
Line: 41
public void testIdentity() {
for (CaseFormat from : CaseFormat.values()) {
assertSame(from + " to " + from, "foo", from.to(from, "foo"));
for (CaseFormat to : CaseFormat.values()) {
assertEquals(from + " to " + to, "", from.to(to, ""));
assertEquals(from + " to " + to, " ", from.to(to, " "));
}
}
Reported by PMD.
Line: 49
}
}
@GwtIncompatible // NullPointerTester
public void testNullArguments() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(CaseFormat.class);
for (CaseFormat format : CaseFormat.values()) {
tester.testAllPublicInstanceMethods(format);
Reported by PMD.
Line: 50
}
@GwtIncompatible // NullPointerTester
public void testNullArguments() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(CaseFormat.class);
for (CaseFormat format : CaseFormat.values()) {
tester.testAllPublicInstanceMethods(format);
}
Reported by PMD.
Line: 58
}
}
public void testLowerHyphenToLowerHyphen() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo"));
assertEquals("foo-bar", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo-bar"));
}
public void testLowerHyphenToLowerUnderscore() {
Reported by PMD.
Line: 58
}
}
public void testLowerHyphenToLowerHyphen() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo"));
assertEquals("foo-bar", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo-bar"));
}
public void testLowerHyphenToLowerUnderscore() {
Reported by PMD.
Line: 59
}
public void testLowerHyphenToLowerHyphen() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo"));
assertEquals("foo-bar", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo-bar"));
}
public void testLowerHyphenToLowerUnderscore() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_UNDERSCORE, "foo"));
Reported by PMD.
Line: 60
public void testLowerHyphenToLowerHyphen() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo"));
assertEquals("foo-bar", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo-bar"));
}
public void testLowerHyphenToLowerUnderscore() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_UNDERSCORE, "foo"));
assertEquals("foo_bar", LOWER_HYPHEN.to(LOWER_UNDERSCORE, "foo-bar"));
Reported by PMD.
guava-tests/test/com/google/common/base/CaseFormatTest.java
157 issues
Line: 37
* @author Mike Bostock
*/
@GwtCompatible(emulated = true)
public class CaseFormatTest extends TestCase {
public void testIdentity() {
for (CaseFormat from : CaseFormat.values()) {
assertSame(from + " to " + from, "foo", from.to(from, "foo"));
for (CaseFormat to : CaseFormat.values()) {
Reported by PMD.
Line: 39
@GwtCompatible(emulated = true)
public class CaseFormatTest extends TestCase {
public void testIdentity() {
for (CaseFormat from : CaseFormat.values()) {
assertSame(from + " to " + from, "foo", from.to(from, "foo"));
for (CaseFormat to : CaseFormat.values()) {
assertEquals(from + " to " + to, "", from.to(to, ""));
assertEquals(from + " to " + to, " ", from.to(to, " "));
Reported by PMD.
Line: 39
@GwtCompatible(emulated = true)
public class CaseFormatTest extends TestCase {
public void testIdentity() {
for (CaseFormat from : CaseFormat.values()) {
assertSame(from + " to " + from, "foo", from.to(from, "foo"));
for (CaseFormat to : CaseFormat.values()) {
assertEquals(from + " to " + to, "", from.to(to, ""));
assertEquals(from + " to " + to, " ", from.to(to, " "));
Reported by PMD.
Line: 41
public void testIdentity() {
for (CaseFormat from : CaseFormat.values()) {
assertSame(from + " to " + from, "foo", from.to(from, "foo"));
for (CaseFormat to : CaseFormat.values()) {
assertEquals(from + " to " + to, "", from.to(to, ""));
assertEquals(from + " to " + to, " ", from.to(to, " "));
}
}
Reported by PMD.
Line: 49
}
}
@GwtIncompatible // NullPointerTester
public void testNullArguments() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(CaseFormat.class);
for (CaseFormat format : CaseFormat.values()) {
tester.testAllPublicInstanceMethods(format);
Reported by PMD.
Line: 50
}
@GwtIncompatible // NullPointerTester
public void testNullArguments() {
NullPointerTester tester = new NullPointerTester();
tester.testAllPublicStaticMethods(CaseFormat.class);
for (CaseFormat format : CaseFormat.values()) {
tester.testAllPublicInstanceMethods(format);
}
Reported by PMD.
Line: 58
}
}
public void testLowerHyphenToLowerHyphen() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo"));
assertEquals("foo-bar", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo-bar"));
}
public void testLowerHyphenToLowerUnderscore() {
Reported by PMD.
Line: 58
}
}
public void testLowerHyphenToLowerHyphen() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo"));
assertEquals("foo-bar", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo-bar"));
}
public void testLowerHyphenToLowerUnderscore() {
Reported by PMD.
Line: 59
}
public void testLowerHyphenToLowerHyphen() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo"));
assertEquals("foo-bar", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo-bar"));
}
public void testLowerHyphenToLowerUnderscore() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_UNDERSCORE, "foo"));
Reported by PMD.
Line: 60
public void testLowerHyphenToLowerHyphen() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo"));
assertEquals("foo-bar", LOWER_HYPHEN.to(LOWER_HYPHEN, "foo-bar"));
}
public void testLowerHyphenToLowerUnderscore() {
assertEquals("foo", LOWER_HYPHEN.to(LOWER_UNDERSCORE, "foo"));
assertEquals("foo_bar", LOWER_HYPHEN.to(LOWER_UNDERSCORE, "foo-bar"));
Reported by PMD.
guava-tests/test/com/google/common/cache/CacheEvictionTest.java
156 issues
Line: 38
*
* @author mike nonemacher
*/
public class CacheEvictionTest extends TestCase {
static final int MAX_SIZE = 100;
public void testEviction_setMaxSegmentSize() {
IdentityLoader<Object> loader = identityLoader();
for (int i = 1; i < 1000; i++) {
Reported by PMD.
Line: 41
public class CacheEvictionTest extends TestCase {
static final int MAX_SIZE = 100;
public void testEviction_setMaxSegmentSize() {
IdentityLoader<Object> loader = identityLoader();
for (int i = 1; i < 1000; i++) {
LoadingCache<Object, Object> cache = CacheBuilder.newBuilder().maximumSize(i).build(loader);
assertEquals(i, CacheTesting.getTotalSegmentSize(cache));
}
Reported by PMD.
Line: 45
IdentityLoader<Object> loader = identityLoader();
for (int i = 1; i < 1000; i++) {
LoadingCache<Object, Object> cache = CacheBuilder.newBuilder().maximumSize(i).build(loader);
assertEquals(i, CacheTesting.getTotalSegmentSize(cache));
}
}
public void testEviction_setMaxSegmentWeight() {
IdentityLoader<Object> loader = identityLoader();
Reported by PMD.
Line: 49
}
}
public void testEviction_setMaxSegmentWeight() {
IdentityLoader<Object> loader = identityLoader();
for (int i = 1; i < 1000; i++) {
LoadingCache<Object, Object> cache =
CacheBuilder.newBuilder().maximumWeight(i).weigher(constantWeigher(1)).build(loader);
assertEquals(i, CacheTesting.getTotalSegmentSize(cache));
Reported by PMD.
Line: 54
for (int i = 1; i < 1000; i++) {
LoadingCache<Object, Object> cache =
CacheBuilder.newBuilder().maximumWeight(i).weigher(constantWeigher(1)).build(loader);
assertEquals(i, CacheTesting.getTotalSegmentSize(cache));
}
}
public void testEviction_maxSizeOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
Reported by PMD.
Line: 58
}
}
public void testEviction_maxSizeOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
LoadingCache<Integer, Integer> cache =
CacheBuilder.newBuilder().concurrencyLevel(1).maximumSize(MAX_SIZE).build(loader);
for (int i = 0; i < 2 * MAX_SIZE; i++) {
cache.getUnchecked(i);
Reported by PMD.
Line: 58
}
}
public void testEviction_maxSizeOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
LoadingCache<Integer, Integer> cache =
CacheBuilder.newBuilder().concurrencyLevel(1).maximumSize(MAX_SIZE).build(loader);
for (int i = 0; i < 2 * MAX_SIZE; i++) {
cache.getUnchecked(i);
Reported by PMD.
Line: 64
CacheBuilder.newBuilder().concurrencyLevel(1).maximumSize(MAX_SIZE).build(loader);
for (int i = 0; i < 2 * MAX_SIZE; i++) {
cache.getUnchecked(i);
assertEquals(Math.min(i + 1, MAX_SIZE), cache.size());
}
assertEquals(MAX_SIZE, cache.size());
CacheTesting.checkValidState(cache);
}
Reported by PMD.
Line: 67
assertEquals(Math.min(i + 1, MAX_SIZE), cache.size());
}
assertEquals(MAX_SIZE, cache.size());
CacheTesting.checkValidState(cache);
}
public void testEviction_maxWeightOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
Reported by PMD.
Line: 67
assertEquals(Math.min(i + 1, MAX_SIZE), cache.size());
}
assertEquals(MAX_SIZE, cache.size());
CacheTesting.checkValidState(cache);
}
public void testEviction_maxWeightOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
Reported by PMD.
android/guava-tests/test/com/google/common/cache/CacheEvictionTest.java
156 issues
Line: 38
*
* @author mike nonemacher
*/
public class CacheEvictionTest extends TestCase {
static final int MAX_SIZE = 100;
public void testEviction_setMaxSegmentSize() {
IdentityLoader<Object> loader = identityLoader();
for (int i = 1; i < 1000; i++) {
Reported by PMD.
Line: 41
public class CacheEvictionTest extends TestCase {
static final int MAX_SIZE = 100;
public void testEviction_setMaxSegmentSize() {
IdentityLoader<Object> loader = identityLoader();
for (int i = 1; i < 1000; i++) {
LoadingCache<Object, Object> cache = CacheBuilder.newBuilder().maximumSize(i).build(loader);
assertEquals(i, CacheTesting.getTotalSegmentSize(cache));
}
Reported by PMD.
Line: 45
IdentityLoader<Object> loader = identityLoader();
for (int i = 1; i < 1000; i++) {
LoadingCache<Object, Object> cache = CacheBuilder.newBuilder().maximumSize(i).build(loader);
assertEquals(i, CacheTesting.getTotalSegmentSize(cache));
}
}
public void testEviction_setMaxSegmentWeight() {
IdentityLoader<Object> loader = identityLoader();
Reported by PMD.
Line: 49
}
}
public void testEviction_setMaxSegmentWeight() {
IdentityLoader<Object> loader = identityLoader();
for (int i = 1; i < 1000; i++) {
LoadingCache<Object, Object> cache =
CacheBuilder.newBuilder().maximumWeight(i).weigher(constantWeigher(1)).build(loader);
assertEquals(i, CacheTesting.getTotalSegmentSize(cache));
Reported by PMD.
Line: 54
for (int i = 1; i < 1000; i++) {
LoadingCache<Object, Object> cache =
CacheBuilder.newBuilder().maximumWeight(i).weigher(constantWeigher(1)).build(loader);
assertEquals(i, CacheTesting.getTotalSegmentSize(cache));
}
}
public void testEviction_maxSizeOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
Reported by PMD.
Line: 58
}
}
public void testEviction_maxSizeOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
LoadingCache<Integer, Integer> cache =
CacheBuilder.newBuilder().concurrencyLevel(1).maximumSize(MAX_SIZE).build(loader);
for (int i = 0; i < 2 * MAX_SIZE; i++) {
cache.getUnchecked(i);
Reported by PMD.
Line: 58
}
}
public void testEviction_maxSizeOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
LoadingCache<Integer, Integer> cache =
CacheBuilder.newBuilder().concurrencyLevel(1).maximumSize(MAX_SIZE).build(loader);
for (int i = 0; i < 2 * MAX_SIZE; i++) {
cache.getUnchecked(i);
Reported by PMD.
Line: 64
CacheBuilder.newBuilder().concurrencyLevel(1).maximumSize(MAX_SIZE).build(loader);
for (int i = 0; i < 2 * MAX_SIZE; i++) {
cache.getUnchecked(i);
assertEquals(Math.min(i + 1, MAX_SIZE), cache.size());
}
assertEquals(MAX_SIZE, cache.size());
CacheTesting.checkValidState(cache);
}
Reported by PMD.
Line: 67
assertEquals(Math.min(i + 1, MAX_SIZE), cache.size());
}
assertEquals(MAX_SIZE, cache.size());
CacheTesting.checkValidState(cache);
}
public void testEviction_maxWeightOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
Reported by PMD.
Line: 67
assertEquals(Math.min(i + 1, MAX_SIZE), cache.size());
}
assertEquals(MAX_SIZE, cache.size());
CacheTesting.checkValidState(cache);
}
public void testEviction_maxWeightOneSegment() {
IdentityLoader<Integer> loader = identityLoader();
Reported by PMD.
guava-tests/test/com/google/common/base/SuppliersTest.java
154 issues
Line: 63
static class ThrowingSupplier implements Supplier<Integer> {
@Override
public Integer get() {
throw new NullPointerException();
}
}
static class SerializableCountingSupplier extends CountingSupplier implements Serializable {
private static final long serialVersionUID = 0L;
Reported by PMD.
Line: 43
* @author Harry Heymann
*/
@GwtCompatible(emulated = true)
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
Reported by PMD.
Line: 43
* @author Harry Heymann
*/
@GwtCompatible(emulated = true)
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
Reported by PMD.
Line: 43
* @author Harry Heymann
*/
@GwtCompatible(emulated = true)
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
Reported by PMD.
Line: 46
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
public Integer get() {
calls++;
return calls * 10;
Reported by PMD.
Line: 46
public class SuppliersTest extends TestCase {
static class CountingSupplier implements Supplier<Integer> {
int calls = 0;
@Override
public Integer get() {
calls++;
return calls * 10;
Reported by PMD.
Line: 77
static void checkMemoize(CountingSupplier countingSupplier, Supplier<Integer> memoizedSupplier) {
// the underlying supplier hasn't executed yet
assertEquals(0, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
// now it has
assertEquals(1, countingSupplier.calls);
Reported by PMD.
Line: 79
// the underlying supplier hasn't executed yet
assertEquals(0, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
// now it has
assertEquals(1, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
Reported by PMD.
Line: 82
assertEquals(10, (int) memoizedSupplier.get());
// now it has
assertEquals(1, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
// it still should only have executed once due to memoization
assertEquals(1, countingSupplier.calls);
Reported by PMD.
Line: 84
// now it has
assertEquals(1, countingSupplier.calls);
assertEquals(10, (int) memoizedSupplier.get());
// it still should only have executed once due to memoization
assertEquals(1, countingSupplier.calls);
}
Reported by PMD.