The following issues were found
android/guava/src/com/google/common/io/Files.java
56 issues
Line: 92
public static BufferedReader newReader(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
}
/**
* Returns a buffered writer that writes to a file using the given character set.
*
Reported by PMD.
Line: 111
public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
}
/**
* Returns a new {@link ByteSource} for reading bytes from the given file.
*
Reported by PMD.
Line: 133
@Override
public FileInputStream openStream() throws IOException {
return new FileInputStream(file);
}
@Override
public Optional<Long> sizeIfKnown() {
if (file.isFile()) {
Reported by PMD.
Line: 196
@Override
public FileOutputStream openStream() throws IOException {
return new FileOutputStream(file, modes.contains(APPEND));
}
@Override
public String toString() {
return "Files.asByteSink(" + file + ", " + modes + ")";
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.io;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.io.FileWriteMode.APPEND;
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.io;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.io.FileWriteMode.APPEND;
Reported by PMD.
Line: 70
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Files {
/** Maximum loop count when creating temp directories. */
private static final int TEMP_DIR_ATTEMPTS = 10000;
private Files() {}
Reported by PMD.
Line: 70
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Files {
/** Maximum loop count when creating temp directories. */
private static final int TEMP_DIR_ATTEMPTS = 10000;
private Files() {}
Reported by PMD.
Line: 70
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Files {
/** Maximum loop count when creating temp directories. */
private static final int TEMP_DIR_ATTEMPTS = 10000;
private Files() {}
Reported by PMD.
Line: 125
private static final class FileByteSource extends ByteSource {
private final File file;
private FileByteSource(File file) {
this.file = checkNotNull(file);
}
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/BiMapPutTester.java
56 issues
Line: 37
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutWithSameValueFails() {
getMap().put(k0(), v0());
try {
Reported by PMD.
Line: 37
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutWithSameValueFails() {
getMap().put(k0(), v0());
try {
Reported by PMD.
Line: 41
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutWithSameValueFails() {
getMap().put(k0(), v0());
try {
getMap().put(k1(), v0());
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
// success
Reported by PMD.
Line: 43
public void testPutWithSameValueFails() {
getMap().put(k0(), v0());
try {
getMap().put(k1(), v0());
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
// success
}
// verify that the bimap is unchanged
Reported by PMD.
Line: 52
expectAdded(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutPresentKeyDifferentValue() {
getMap().put(k0(), v0());
getMap().put(k0(), v1());
Reported by PMD.
Line: 56
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutPresentKeyDifferentValue() {
getMap().put(k0(), v0());
getMap().put(k0(), v1());
// verify that the bimap is changed, and that the old inverse mapping
// from v1 -> v0 is deleted
expectContents(Helpers.mapEntry(k0(), v1()));
}
Reported by PMD.
Line: 57
@CollectionSize.Require(ZERO)
public void testPutPresentKeyDifferentValue() {
getMap().put(k0(), v0());
getMap().put(k0(), v1());
// verify that the bimap is changed, and that the old inverse mapping
// from v1 -> v0 is deleted
expectContents(Helpers.mapEntry(k0(), v1()));
}
Reported by PMD.
Line: 67
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void putDistinctKeysDistinctValues() {
getMap().put(k0(), v0());
getMap().put(k1(), v1());
expectAdded(e0(), e1());
}
@SuppressWarnings("unchecked")
Reported by PMD.
Line: 68
@CollectionSize.Require(ZERO)
public void putDistinctKeysDistinctValues() {
getMap().put(k0(), v0());
getMap().put(k1(), v1());
expectAdded(e0(), e1());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
Reported by PMD.
Line: 72
expectAdded(e0(), e1());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ONE)
public void testForcePutKeyPresent() {
getMap().forcePut(k0(), v1());
expectContents(Helpers.mapEntry(k0(), v1()));
Reported by PMD.
guava/src/com/google/common/io/Files.java
56 issues
Line: 92
public static BufferedReader newReader(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
}
/**
* Returns a buffered writer that writes to a file using the given character set.
*
Reported by PMD.
Line: 111
public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
}
/**
* Returns a new {@link ByteSource} for reading bytes from the given file.
*
Reported by PMD.
Line: 133
@Override
public FileInputStream openStream() throws IOException {
return new FileInputStream(file);
}
@Override
public Optional<Long> sizeIfKnown() {
if (file.isFile()) {
Reported by PMD.
Line: 196
@Override
public FileOutputStream openStream() throws IOException {
return new FileOutputStream(file, modes.contains(APPEND));
}
@Override
public String toString() {
return "Files.asByteSink(" + file + ", " + modes + ")";
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.io;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.io.FileWriteMode.APPEND;
Reported by PMD.
Line: 15
* the License.
*/
package com.google.common.io;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.io.FileWriteMode.APPEND;
Reported by PMD.
Line: 70
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Files {
/** Maximum loop count when creating temp directories. */
private static final int TEMP_DIR_ATTEMPTS = 10000;
private Files() {}
Reported by PMD.
Line: 70
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Files {
/** Maximum loop count when creating temp directories. */
private static final int TEMP_DIR_ATTEMPTS = 10000;
private Files() {}
Reported by PMD.
Line: 70
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
public final class Files {
/** Maximum loop count when creating temp directories. */
private static final int TEMP_DIR_ATTEMPTS = 10000;
private Files() {}
Reported by PMD.
Line: 125
private static final class FileByteSource extends ByteSource {
private final File file;
private FileByteSource(File file) {
this.file = checkNotNull(file);
}
Reported by PMD.
android/guava/src/com/google/common/net/PercentEscaper.java
56 issues
Line: 87
* @param plusForSpace true if ASCII space should be escaped to {@code +} rather than {@code %20}
* @throws IllegalArgumentException if any of the parameters were invalid
*/
public PercentEscaper(String safeChars, boolean plusForSpace) {
// TODO(dbeaumont): Switch to static factory methods for creation now that class is final.
// TODO(dbeaumont): Support escapers where alphanumeric chars are not safe.
checkNotNull(safeChars); // eager for GWT.
// Avoid any misunderstandings about the behavior of this escaper
if (safeChars.matches(".*[0-9A-Za-z].*")) {
Reported by PMD.
Line: 130
* escaper from ~760ns to ~400ns as measured by {@link CharEscapersBenchmark}.
*/
@Override
protected int nextEscapeIndex(CharSequence csq, int index, int end) {
checkNotNull(csq);
for (; index < end; index++) {
char c = csq.charAt(index);
if (c >= safeOctets.length || !safeOctets[c]) {
break;
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
guava/src/com/google/common/net/PercentEscaper.java
56 issues
Line: 87
* @param plusForSpace true if ASCII space should be escaped to {@code +} rather than {@code %20}
* @throws IllegalArgumentException if any of the parameters were invalid
*/
public PercentEscaper(String safeChars, boolean plusForSpace) {
// TODO(dbeaumont): Switch to static factory methods for creation now that class is final.
// TODO(dbeaumont): Support escapers where alphanumeric chars are not safe.
checkNotNull(safeChars); // eager for GWT.
// Avoid any misunderstandings about the behavior of this escaper
if (safeChars.matches(".*[0-9A-Za-z].*")) {
Reported by PMD.
Line: 130
* escaper from ~760ns to ~400ns as measured by {@link CharEscapersBenchmark}.
*/
@Override
protected int nextEscapeIndex(CharSequence csq, int index, int end) {
checkNotNull(csq);
for (; index < end; index++) {
char c = csq.charAt(index);
if (c >= safeOctets.length || !safeOctets[c]) {
break;
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
Line: 161
/** Escapes the given Unicode code point in UTF-8. */
@Override
@CheckForNull
protected char[] escape(int cp) {
// We should never get negative values here but if we do it will throw an
// IndexOutOfBoundsException, so at least it will get spotted.
if (cp < safeOctets.length && safeOctets[cp]) {
return null;
} else if (cp == ' ' && plusForSpace) {
Reported by PMD.
guava-testlib/src/com/google/common/collect/testing/google/BiMapPutTester.java
56 issues
Line: 37
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutWithSameValueFails() {
getMap().put(k0(), v0());
try {
Reported by PMD.
Line: 37
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutWithSameValueFails() {
getMap().put(k0(), v0());
try {
Reported by PMD.
Line: 41
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutWithSameValueFails() {
getMap().put(k0(), v0());
try {
getMap().put(k1(), v0());
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
// success
Reported by PMD.
Line: 43
public void testPutWithSameValueFails() {
getMap().put(k0(), v0());
try {
getMap().put(k1(), v0());
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException expected) {
// success
}
// verify that the bimap is unchanged
Reported by PMD.
Line: 52
expectAdded(e0());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutPresentKeyDifferentValue() {
getMap().put(k0(), v0());
getMap().put(k0(), v1());
Reported by PMD.
Line: 56
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void testPutPresentKeyDifferentValue() {
getMap().put(k0(), v0());
getMap().put(k0(), v1());
// verify that the bimap is changed, and that the old inverse mapping
// from v1 -> v0 is deleted
expectContents(Helpers.mapEntry(k0(), v1()));
}
Reported by PMD.
Line: 57
@CollectionSize.Require(ZERO)
public void testPutPresentKeyDifferentValue() {
getMap().put(k0(), v0());
getMap().put(k0(), v1());
// verify that the bimap is changed, and that the old inverse mapping
// from v1 -> v0 is deleted
expectContents(Helpers.mapEntry(k0(), v1()));
}
Reported by PMD.
Line: 67
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ZERO)
public void putDistinctKeysDistinctValues() {
getMap().put(k0(), v0());
getMap().put(k1(), v1());
expectAdded(e0(), e1());
}
@SuppressWarnings("unchecked")
Reported by PMD.
Line: 68
@CollectionSize.Require(ZERO)
public void putDistinctKeysDistinctValues() {
getMap().put(k0(), v0());
getMap().put(k1(), v1());
expectAdded(e0(), e1());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
Reported by PMD.
Line: 72
expectAdded(e0(), e1());
}
@SuppressWarnings("unchecked")
@MapFeature.Require(SUPPORTS_PUT)
@CollectionSize.Require(ONE)
public void testForcePutKeyPresent() {
getMap().forcePut(k0(), v1());
expectContents(Helpers.mapEntry(k0(), v1()));
Reported by PMD.
guava-tests/test/com/google/common/util/concurrent/CallablesTest.java
55 issues
Line: 38
@GwtCompatible(emulated = true)
public class CallablesTest extends TestCase {
public void testReturning() throws Exception {
assertNull(Callables.returning(null).call());
Object value = new Object();
Callable<Object> callable = Callables.returning(value);
assertSame(value, callable.call());
Reported by PMD.
Line: 38
@GwtCompatible(emulated = true)
public class CallablesTest extends TestCase {
public void testReturning() throws Exception {
assertNull(Callables.returning(null).call());
Object value = new Object();
Callable<Object> callable = Callables.returning(value);
assertSame(value, callable.call());
Reported by PMD.
Line: 39
public class CallablesTest extends TestCase {
public void testReturning() throws Exception {
assertNull(Callables.returning(null).call());
Object value = new Object();
Callable<Object> callable = Callables.returning(value);
assertSame(value, callable.call());
// Expect the same value on subsequent calls
Reported by PMD.
Line: 39
public class CallablesTest extends TestCase {
public void testReturning() throws Exception {
assertNull(Callables.returning(null).call());
Object value = new Object();
Callable<Object> callable = Callables.returning(value);
assertSame(value, callable.call());
// Expect the same value on subsequent calls
Reported by PMD.
Line: 43
Object value = new Object();
Callable<Object> callable = Callables.returning(value);
assertSame(value, callable.call());
// Expect the same value on subsequent calls
assertSame(value, callable.call());
}
@GwtIncompatible
Reported by PMD.
Line: 43
Object value = new Object();
Callable<Object> callable = Callables.returning(value);
assertSame(value, callable.call());
// Expect the same value on subsequent calls
assertSame(value, callable.call());
}
@GwtIncompatible
Reported by PMD.
Line: 45
Callable<Object> callable = Callables.returning(value);
assertSame(value, callable.call());
// Expect the same value on subsequent calls
assertSame(value, callable.call());
}
@GwtIncompatible
public void testAsAsyncCallable() throws Exception {
final String expected = "MyCallableString";
Reported by PMD.
Line: 45
Callable<Object> callable = Callables.returning(value);
assertSame(value, callable.call());
// Expect the same value on subsequent calls
assertSame(value, callable.call());
}
@GwtIncompatible
public void testAsAsyncCallable() throws Exception {
final String expected = "MyCallableString";
Reported by PMD.
Line: 48
assertSame(value, callable.call());
}
@GwtIncompatible
public void testAsAsyncCallable() throws Exception {
final String expected = "MyCallableString";
Callable<String> callable =
new Callable<String>() {
@Override
Reported by PMD.
Line: 62
AsyncCallable<String> asyncCallable =
Callables.asAsyncCallable(callable, MoreExecutors.newDirectExecutorService());
ListenableFuture<String> future = asyncCallable.call();
assertSame(expected, future.get());
}
@GwtIncompatible
public void testAsAsyncCallable_exception() throws Exception {
Reported by PMD.
guava-tests/test/com/google/common/collect/ImmutableClassToInstanceMapTest.java
55 issues
Line: 43
* @author Kevin Bourrillion
*/
public class ImmutableClassToInstanceMapTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableClassToInstanceMapTest.class);
suite.addTest(
MapTestSuiteBuilder.using(
Reported by PMD.
Line: 59
ImmutableClassToInstanceMap.builder();
for (Object object : elements) {
Entry<Class, Impl> entry = (Entry<Class, Impl>) object;
builder.put(entry.getKey(), entry.getValue());
}
return (Map) builder.build();
}
})
.named("ImmutableClassToInstanceMap")
Reported by PMD.
Line: 59
ImmutableClassToInstanceMap.builder();
for (Object object : elements) {
Entry<Class, Impl> entry = (Entry<Class, Impl>) object;
builder.put(entry.getKey(), entry.getValue());
}
return (Map) builder.build();
}
})
.named("ImmutableClassToInstanceMap")
Reported by PMD.
Line: 77
return suite;
}
public void testSerialization_empty() {
assertSame(
ImmutableClassToInstanceMap.of(),
SerializableTester.reserialize(ImmutableClassToInstanceMap.of()));
}
Reported by PMD.
Line: 78
}
public void testSerialization_empty() {
assertSame(
ImmutableClassToInstanceMap.of(),
SerializableTester.reserialize(ImmutableClassToInstanceMap.of()));
}
public void testCopyOf_map_empty() {
Reported by PMD.
Line: 83
SerializableTester.reserialize(ImmutableClassToInstanceMap.of()));
}
public void testCopyOf_map_empty() {
Map<Class<?>, Object> in = Collections.emptyMap();
ClassToInstanceMap<Object> map = ImmutableClassToInstanceMap.copyOf(in);
assertTrue(map.isEmpty());
assertSame(map, ImmutableClassToInstanceMap.of());
assertSame(map, ImmutableClassToInstanceMap.copyOf(map));
Reported by PMD.
Line: 83
SerializableTester.reserialize(ImmutableClassToInstanceMap.of()));
}
public void testCopyOf_map_empty() {
Map<Class<?>, Object> in = Collections.emptyMap();
ClassToInstanceMap<Object> map = ImmutableClassToInstanceMap.copyOf(in);
assertTrue(map.isEmpty());
assertSame(map, ImmutableClassToInstanceMap.of());
assertSame(map, ImmutableClassToInstanceMap.copyOf(map));
Reported by PMD.
Line: 86
public void testCopyOf_map_empty() {
Map<Class<?>, Object> in = Collections.emptyMap();
ClassToInstanceMap<Object> map = ImmutableClassToInstanceMap.copyOf(in);
assertTrue(map.isEmpty());
assertSame(map, ImmutableClassToInstanceMap.of());
assertSame(map, ImmutableClassToInstanceMap.copyOf(map));
}
public void testOf_zero() {
Reported by PMD.
Line: 86
public void testCopyOf_map_empty() {
Map<Class<?>, Object> in = Collections.emptyMap();
ClassToInstanceMap<Object> map = ImmutableClassToInstanceMap.copyOf(in);
assertTrue(map.isEmpty());
assertSame(map, ImmutableClassToInstanceMap.of());
assertSame(map, ImmutableClassToInstanceMap.copyOf(map));
}
public void testOf_zero() {
Reported by PMD.
Line: 87
Map<Class<?>, Object> in = Collections.emptyMap();
ClassToInstanceMap<Object> map = ImmutableClassToInstanceMap.copyOf(in);
assertTrue(map.isEmpty());
assertSame(map, ImmutableClassToInstanceMap.of());
assertSame(map, ImmutableClassToInstanceMap.copyOf(map));
}
public void testOf_zero() {
assertTrue(ImmutableClassToInstanceMap.of().isEmpty());
Reported by PMD.
android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java
55 issues
Line: 57
assertFalse(control("foo", 1).equals(entry("foo", 2)));
assertFalse(entry("foo", 1).equals(control("bar", 1)));
assertFalse(entry("foo", 1).equals(new Object()));
assertFalse(entry("foo", 1).equals(null));
}
public void testEqualsNull() {
assertEquals(control(NE, 1), entry(NE, 1));
assertFalse(control(NE, 1).equals(entry(NE, 2)));
Reported by PMD.
Line: 65
assertFalse(control(NE, 1).equals(entry(NE, 2)));
assertFalse(entry(NE, 1).equals(control("bar", 1)));
assertFalse(entry(NE, 1).equals(new Object()));
assertFalse(entry(NE, 1).equals(null));
}
public void testHashCode() {
assertEquals(control("foo", 1).hashCode(), entry("foo", 1).hashCode());
assertEquals(control("bar", 2).hashCode(), entry("bar", 2).hashCode());
Reported by PMD.
Line: 38
}
private static <E> Entry<E> control(E element, int count) {
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
Reported by PMD.
Line: 38
}
private static <E> Entry<E> control(E element, int count) {
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
Reported by PMD.
Line: 38
}
private static <E> Entry<E> control(E element, int count) {
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
Reported by PMD.
Line: 41
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
Reported by PMD.
Line: 41
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
Reported by PMD.
Line: 42
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
assertEquals("null", entry(NE, 1).toString());
Reported by PMD.
Line: 42
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
assertEquals("null", entry(NE, 1).toString());
Reported by PMD.
Line: 42
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
assertEquals("null", entry(NE, 1).toString());
Reported by PMD.
guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java
55 issues
Line: 57
assertFalse(control("foo", 1).equals(entry("foo", 2)));
assertFalse(entry("foo", 1).equals(control("bar", 1)));
assertFalse(entry("foo", 1).equals(new Object()));
assertFalse(entry("foo", 1).equals(null));
}
public void testEqualsNull() {
assertEquals(control(NE, 1), entry(NE, 1));
assertFalse(control(NE, 1).equals(entry(NE, 2)));
Reported by PMD.
Line: 65
assertFalse(control(NE, 1).equals(entry(NE, 2)));
assertFalse(entry(NE, 1).equals(control("bar", 1)));
assertFalse(entry(NE, 1).equals(new Object()));
assertFalse(entry(NE, 1).equals(null));
}
public void testHashCode() {
assertEquals(control("foo", 1).hashCode(), entry("foo", 1).hashCode());
assertEquals(control("bar", 2).hashCode(), entry("bar", 2).hashCode());
Reported by PMD.
Line: 38
}
private static <E> Entry<E> control(E element, int count) {
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
Reported by PMD.
Line: 38
}
private static <E> Entry<E> control(E element, int count) {
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
Reported by PMD.
Line: 38
}
private static <E> Entry<E> control(E element, int count) {
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
Reported by PMD.
Line: 41
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
Reported by PMD.
Line: 41
return HashMultiset.create(Collections.nCopies(count, element)).entrySet().iterator().next();
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
Reported by PMD.
Line: 42
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
assertEquals("null", entry(NE, 1).toString());
Reported by PMD.
Line: 42
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
assertEquals("null", entry(NE, 1).toString());
Reported by PMD.
Line: 42
}
public void testToString() {
assertEquals("foo", entry("foo", 1).toString());
assertEquals("bar x 2", entry("bar", 2).toString());
}
public void testToStringNull() {
assertEquals("null", entry(NE, 1).toString());
Reported by PMD.