The following issues were found
android/guava/src/com/google/common/net/MediaType.java
39 issues
Line: 15
* the License.
*/
package com.google.common.net;
import static com.google.common.base.CharMatcher.ascii;
import static com.google.common.base.CharMatcher.javaIsoControl;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.base.Preconditions.checkArgument;
Reported by PMD.
Line: 79
@GwtCompatible
@Immutable
@ElementTypesAreNonnullByDefault
public final class MediaType {
private static final String CHARSET_ATTRIBUTE = "charset";
private static final ImmutableListMultimap<String, String> UTF_8_CONSTANT_PARAMETERS =
ImmutableListMultimap.of(CHARSET_ATTRIBUTE, Ascii.toLowerCase(UTF_8.name()));
/** Matcher for type, subtype and attributes. */
Reported by PMD.
Line: 79
@GwtCompatible
@Immutable
@ElementTypesAreNonnullByDefault
public final class MediaType {
private static final String CHARSET_ATTRIBUTE = "charset";
private static final ImmutableListMultimap<String, String> UTF_8_CONSTANT_PARAMETERS =
ImmutableListMultimap.of(CHARSET_ATTRIBUTE, Ascii.toLowerCase(UTF_8.name()));
/** Matcher for type, subtype and attributes. */
Reported by PMD.
Line: 763
*/
public static final MediaType FONT_WOFF2 = createConstant(FONT_TYPE, "woff2");
private final String type;
private final String subtype;
private final ImmutableListMultimap<String, String> parameters;
@LazyInit @CheckForNull private String toString;
Reported by PMD.
Line: 763
*/
public static final MediaType FONT_WOFF2 = createConstant(FONT_TYPE, "woff2");
private final String type;
private final String subtype;
private final ImmutableListMultimap<String, String> parameters;
@LazyInit @CheckForNull private String toString;
Reported by PMD.
Line: 764
public static final MediaType FONT_WOFF2 = createConstant(FONT_TYPE, "woff2");
private final String type;
private final String subtype;
private final ImmutableListMultimap<String, String> parameters;
@LazyInit @CheckForNull private String toString;
@LazyInit private int hashCode;
Reported by PMD.
Line: 764
public static final MediaType FONT_WOFF2 = createConstant(FONT_TYPE, "woff2");
private final String type;
private final String subtype;
private final ImmutableListMultimap<String, String> parameters;
@LazyInit @CheckForNull private String toString;
@LazyInit private int hashCode;
Reported by PMD.
Line: 765
private final String type;
private final String subtype;
private final ImmutableListMultimap<String, String> parameters;
@LazyInit @CheckForNull private String toString;
@LazyInit private int hashCode;
Reported by PMD.
Line: 765
private final String type;
private final String subtype;
private final ImmutableListMultimap<String, String> parameters;
@LazyInit @CheckForNull private String toString;
@LazyInit private int hashCode;
Reported by PMD.
Line: 767
private final String subtype;
private final ImmutableListMultimap<String, String> parameters;
@LazyInit @CheckForNull private String toString;
@LazyInit private int hashCode;
@LazyInit @CheckForNull private Optional<Charset> parsedCharset;
Reported by PMD.
android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java
39 issues
Line: 37
*/
public class LittleEndianDataInputStreamTest extends TestCase {
private byte[] data;
@Override
protected void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 39
private byte[] data;
@Override
protected void setUp() throws Exception {
super.setUp();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
Reported by PMD.
Line: 69
out.writeDouble(Double.longBitsToDouble(0xDEADBEEFCAFEBABEL));
}
public void testReadFully() throws IOException {
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(data));
byte[] b = new byte[data.length];
in.readFully(b);
assertEquals(Bytes.asList(data), Bytes.asList(b));
}
Reported by PMD.
Line: 73
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(data));
byte[] b = new byte[data.length];
in.readFully(b);
assertEquals(Bytes.asList(data), Bytes.asList(b));
}
public void testReadUnsignedByte_eof() throws IOException {
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(new byte[0]));
try {
Reported by PMD.
Line: 76
assertEquals(Bytes.asList(data), Bytes.asList(b));
}
public void testReadUnsignedByte_eof() throws IOException {
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(new byte[0]));
try {
in.readUnsignedByte();
fail();
} catch (EOFException expected) {
Reported by PMD.
Line: 80
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(new byte[0]));
try {
in.readUnsignedByte();
fail();
} catch (EOFException expected) {
}
}
public void testReadUnsignedShort_eof() throws IOException {
Reported by PMD.
Line: 80
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(new byte[0]));
try {
in.readUnsignedByte();
fail();
} catch (EOFException expected) {
}
}
public void testReadUnsignedShort_eof() throws IOException {
Reported by PMD.
Line: 85
}
}
public void testReadUnsignedShort_eof() throws IOException {
byte[] buf = {23};
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(buf));
try {
in.readUnsignedShort();
fail();
Reported by PMD.
Line: 90
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(buf));
try {
in.readUnsignedShort();
fail();
} catch (EOFException expected) {
}
}
public void testReadLine() throws IOException {
Reported by PMD.
Line: 90
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(buf));
try {
in.readUnsignedShort();
fail();
} catch (EOFException expected) {
}
}
public void testReadLine() throws IOException {
Reported by PMD.
android/guava-tests/test/com/google/common/hash/Crc32cHashFunctionTest.java
39 issues
Line: 29
* @author Patrick Costello
* @author Kurt Alfred Kluever
*/
public class Crc32cHashFunctionTest extends TestCase {
public void testEmpty() {
assertCrc(0, new byte[0]);
}
public void testZeros() {
Reported by PMD.
Line: 30
* @author Kurt Alfred Kluever
*/
public class Crc32cHashFunctionTest extends TestCase {
public void testEmpty() {
assertCrc(0, new byte[0]);
}
public void testZeros() {
// Test 32 byte array of 0x00.
Reported by PMD.
Line: 34
assertCrc(0, new byte[0]);
}
public void testZeros() {
// Test 32 byte array of 0x00.
byte[] zeros = new byte[32];
assertCrc(0x8a9136aa, zeros);
}
Reported by PMD.
Line: 40
assertCrc(0x8a9136aa, zeros);
}
public void testZeros100() {
// Test 100 byte array of 0x00.
byte[] zeros = new byte[100];
assertCrc(0x07cb9ff6, zeros);
}
Reported by PMD.
Line: 46
assertCrc(0x07cb9ff6, zeros);
}
public void testFull() {
// Test 32 byte array of 0xFF.
byte[] fulls = new byte[32];
Arrays.fill(fulls, (byte) 0xFF);
assertCrc(0x62a8ab43, fulls);
}
Reported by PMD.
Line: 53
assertCrc(0x62a8ab43, fulls);
}
public void testFull100() {
// Test 100 byte array of 0xFF.
byte[] fulls = new byte[100];
Arrays.fill(fulls, (byte) 0xFF);
assertCrc(0xbc753add, fulls);
}
Reported by PMD.
Line: 60
assertCrc(0xbc753add, fulls);
}
public void testAscending() {
// Test 32 byte arrays of ascending.
byte[] ascending = new byte[32];
for (int i = 0; i < 32; i++) {
ascending[i] = (byte) i;
}
Reported by PMD.
Line: 69
assertCrc(0x46dd794e, ascending);
}
public void testDescending() {
// Test 32 byte arrays of descending.
byte[] descending = new byte[32];
for (int i = 0; i < 32; i++) {
descending[i] = (byte) (31 - i);
}
Reported by PMD.
Line: 78
assertCrc(0x113fdb5c, descending);
}
public void testDescending100() {
// Test 100 byte arrays of descending.
byte[] descending = new byte[100];
for (int i = 0; i < 100; i++) {
descending[i] = (byte) (99 - i);
}
Reported by PMD.
Line: 87
assertCrc(0xd022db97, descending);
}
public void testScsiReadCommand() {
// Test SCSI read command.
byte[] scsiReadCommand =
new byte[] {
0x01, (byte) 0xc0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
Reported by PMD.
android/guava-tests/test/com/google/common/io/SourceSinkFactories.java
39 issues
Line: 289
public ByteSource createSource(byte[] bytes) throws IOException {
checkNotNull(bytes);
File file = createFile();
OutputStream out = new FileOutputStream(file);
try {
out.write(bytes);
} finally {
out.close();
}
Reported by PMD.
Line: 316
public ByteSink createSink() throws IOException {
File file = createFile();
if (initialBytes != null) {
FileOutputStream out = new FileOutputStream(file);
try {
out.write(initialBytes);
} finally {
out.close();
}
Reported by PMD.
Line: 342
@Override
public byte[] getSinkContents() throws IOException {
File file = getFile();
InputStream in = new FileInputStream(file);
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[100];
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
Reported by PMD.
Line: 359
public CharSource createSource(String string) throws IOException {
checkNotNull(string);
File file = createFile();
Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8);
try {
writer.write(string);
} finally {
writer.close();
}
Reported by PMD.
Line: 386
public CharSink createSink() throws IOException {
File file = createFile();
if (initialString != null) {
Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8);
try {
writer.write(initialString);
} finally {
writer.close();
}
Reported by PMD.
Line: 406
@Override
public String getSinkContents() throws IOException {
File file = getFile();
Reader reader = new InputStreamReader(new FileInputStream(file), Charsets.UTF_8);
StringBuilder builder = new StringBuilder();
CharBuffer buffer = CharBuffer.allocate(100);
while (reader.read(buffer) != -1) {
buffer.flip();
builder.append(buffer);
Reported by PMD.
Line: 277
public final void tearDown() throws IOException {
if (!fileThreadLocal.get().delete()) {
logger.warning("Unable to delete file: " + fileThreadLocal.get());
}
fileThreadLocal.remove();
}
}
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.io;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.io.SourceSinkFactory.ByteSinkFactory;
import static com.google.common.io.SourceSinkFactory.ByteSourceFactory;
import static com.google.common.io.SourceSinkFactory.CharSinkFactory;
Reported by PMD.
Line: 47
*
* @author Colin Decker
*/
public class SourceSinkFactories {
private SourceSinkFactories() {}
public static CharSourceFactory stringCharSourceFactory() {
return new StringSourceFactory();
Reported by PMD.
Line: 77
public static ByteSinkFactory appendingFileByteSinkFactory() {
String initialString = IoTestCase.ASCII + IoTestCase.I18N;
return new FileByteSinkFactory(initialString.getBytes(Charsets.UTF_8));
}
public static CharSourceFactory fileCharSourceFactory() {
return new FileCharSourceFactory();
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/MapsCollectionTest.java
39 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.testing.Helpers.mapEntry;
Reported by PMD.
Line: 62
*
* @author Louis Wasserman
*/
public class MapsCollectionTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
NavigableMapTestSuiteBuilder.using(
Reported by PMD.
Line: 62
*
* @author Louis Wasserman
*/
public class MapsCollectionTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
NavigableMapTestSuiteBuilder.using(
Reported by PMD.
Line: 62
*
* @author Louis Wasserman
*/
public class MapsCollectionTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
NavigableMapTestSuiteBuilder.using(
Reported by PMD.
Line: 62
*
* @author Louis Wasserman
*/
public class MapsCollectionTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
NavigableMapTestSuiteBuilder.using(
Reported by PMD.
Line: 63
* @author Louis Wasserman
*/
public class MapsCollectionTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
NavigableMapTestSuiteBuilder.using(
new TestStringSortedMapGenerator() {
Reported by PMD.
Line: 63
* @author Louis Wasserman
*/
public class MapsCollectionTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
NavigableMapTestSuiteBuilder.using(
new TestStringSortedMapGenerator() {
Reported by PMD.
Line: 63
* @author Louis Wasserman
*/
public class MapsCollectionTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
NavigableMapTestSuiteBuilder.using(
new TestStringSortedMapGenerator() {
Reported by PMD.
Line: 63
* @author Louis Wasserman
*/
public class MapsCollectionTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(
NavigableMapTestSuiteBuilder.using(
new TestStringSortedMapGenerator() {
Reported by PMD.
Line: 120
Set<String> set = Sets.newLinkedHashSet();
for (Object e : elements) {
Entry<?, ?> entry = (Entry<?, ?>) e;
checkNotNull(entry.getValue());
set.add((String) checkNotNull(entry.getKey()));
}
return Maps.asMap(
set,
new Function<String, Integer>() {
Reported by PMD.
android/guava-tests/test/com/google/common/io/CharSourceTester.java
39 issues
Line: 42
* @author Colin Decker
*/
@AndroidIncompatible // Android doesn't understand tests that lack default constructors.
public class CharSourceTester extends SourceSinkTester<CharSource, String, CharSourceFactory> {
private static final ImmutableList<Method> testMethods = getTestMethods(CharSourceTester.class);
static TestSuite tests(String name, CharSourceFactory factory, boolean testAsByteSource) {
TestSuite suite = new TestSuite(name);
Reported by PMD.
Line: 52
if (testAsByteSource) {
suite.addTest(
suiteForBytes(
factory, entry.getValue().getBytes(Charsets.UTF_8), name, entry.getKey(), true));
} else {
suite.addTest(suiteForString(factory, entry.getValue(), name, entry.getKey()));
}
}
return suite;
Reported by PMD.
Line: 74
CharSourceFactory factory, String string, String name, String desc) {
TestSuite suite = new TestSuite(name + " [" + desc + "]");
for (Method method : testMethods) {
suite.addTest(new CharSourceTester(factory, string, name, desc, method));
}
return suite;
}
private final ImmutableList<String> expectedLines;
Reported by PMD.
Line: 79
return suite;
}
private final ImmutableList<String> expectedLines;
private CharSource source;
public CharSourceTester(
CharSourceFactory factory, String string, String suiteName, String caseDesc, Method method) {
Reported by PMD.
Line: 81
private final ImmutableList<String> expectedLines;
private CharSource source;
public CharSourceTester(
CharSourceFactory factory, String string, String suiteName, String caseDesc, Method method) {
super(factory, string, suiteName, caseDesc, method);
this.expectedLines = getLines(expected);
Reported by PMD.
Line: 89
this.expectedLines = getLines(expected);
}
@Override
protected void setUp() throws Exception {
this.source = factory.createSource(data);
}
public void testOpenStream() throws IOException {
Reported by PMD.
Line: 94
this.source = factory.createSource(data);
}
public void testOpenStream() throws IOException {
Reader reader = source.openStream();
StringWriter writer = new StringWriter();
char[] buf = new char[64];
int read;
Reported by PMD.
Line: 95
}
public void testOpenStream() throws IOException {
Reader reader = source.openStream();
StringWriter writer = new StringWriter();
char[] buf = new char[64];
int read;
while ((read = reader.read(buf)) != -1) {
Reported by PMD.
Line: 100
StringWriter writer = new StringWriter();
char[] buf = new char[64];
int read;
while ((read = reader.read(buf)) != -1) {
writer.write(buf, 0, read);
}
reader.close();
writer.close();
Reported by PMD.
Line: 100
StringWriter writer = new StringWriter();
char[] buf = new char[64];
int read;
while ((read = reader.read(buf)) != -1) {
writer.write(buf, 0, read);
}
reader.close();
writer.close();
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/Helpers.java
39 issues
Line: 456
protected NullsBefore(String justAfterNull) {
if (justAfterNull == null) {
throw new NullPointerException();
}
this.justAfterNull = justAfterNull;
}
Reported by PMD.
Line: 44
import junit.framework.AssertionFailedError;
@GwtCompatible(emulated = true)
public class Helpers {
// Clone of Objects.equal
static boolean equal(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
Reported by PMD.
Line: 44
import junit.framework.AssertionFailedError;
@GwtCompatible(emulated = true)
public class Helpers {
// Clone of Objects.equal
static boolean equal(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
Reported by PMD.
Line: 44
import junit.framework.AssertionFailedError;
@GwtCompatible(emulated = true)
public class Helpers {
// Clone of Objects.equal
static boolean equal(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
Reported by PMD.
Line: 44
import junit.framework.AssertionFailedError;
@GwtCompatible(emulated = true)
public class Helpers {
// Clone of Objects.equal
static boolean equal(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
Reported by PMD.
Line: 44
import junit.framework.AssertionFailedError;
@GwtCompatible(emulated = true)
public class Helpers {
// Clone of Objects.equal
static boolean equal(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
Reported by PMD.
Line: 47
public class Helpers {
// Clone of Objects.equal
static boolean equal(Object a, Object b) {
return a == b || (a != null && a.equals(b));
}
// Clone of Lists.newArrayList
public static <E> List<E> copyToList(Iterable<? extends E> elements) {
List<E> list = new ArrayList<E>();
Reported by PMD.
Line: 74
// Would use Maps.immutableEntry
public static <K, V> Entry<K, V> mapEntry(K key, V value) {
return Collections.singletonMap(key, value).entrySet().iterator().next();
}
private static boolean isEmpty(Iterable<?> iterable) {
return iterable instanceof Collection
? ((Collection<?>) iterable).isEmpty()
Reported by PMD.
Line: 74
// Would use Maps.immutableEntry
public static <K, V> Entry<K, V> mapEntry(K key, V value) {
return Collections.singletonMap(key, value).entrySet().iterator().next();
}
private static boolean isEmpty(Iterable<?> iterable) {
return iterable instanceof Collection
? ((Collection<?>) iterable).isEmpty()
Reported by PMD.
Line: 74
// Would use Maps.immutableEntry
public static <K, V> Entry<K, V> mapEntry(K key, V value) {
return Collections.singletonMap(key, value).entrySet().iterator().next();
}
private static boolean isEmpty(Iterable<?> iterable) {
return iterable instanceof Collection
? ((Collection<?>) iterable).isEmpty()
Reported by PMD.
android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java
39 issues
Line: 53
* #remove()}.
*/
private static class PeekingIteratorTester<T> extends IteratorTester<T> {
private Iterable<T> master;
private List<T> targetList;
public PeekingIteratorTester(Collection<T> master) {
super(master.size() + 3, MODIFIABLE, master, IteratorTester.KnownOrder.KNOWN_ORDER);
this.master = master;
Reported by PMD.
Line: 72
@Override
protected void verify(List<T> elements) {
// verify same objects were removed from reference and target
assertEquals(elements, targetList);
}
}
private <T> void actsLikeIteratorHelper(final List<T> list) {
// Check with modifiable copies of the list
Reported by PMD.
Line: 85
list.size() * 2 + 2, UNMODIFIABLE, list, IteratorTester.KnownOrder.KNOWN_ORDER) {
@Override
protected Iterator<T> newTargetIterator() {
Iterator<T> iterator = Collections.unmodifiableList(list).iterator();
return Iterators.peekingIterator(iterator);
}
}.test();
}
Reported by PMD.
Line: 91
}.test();
}
public void testPeekingIteratorBehavesLikeIteratorOnEmptyIterable() {
actsLikeIteratorHelper(Collections.emptyList());
}
public void testPeekingIteratorBehavesLikeIteratorOnSingletonIterable() {
actsLikeIteratorHelper(Collections.singletonList(new Object()));
Reported by PMD.
Line: 91
}.test();
}
public void testPeekingIteratorBehavesLikeIteratorOnEmptyIterable() {
actsLikeIteratorHelper(Collections.emptyList());
}
public void testPeekingIteratorBehavesLikeIteratorOnSingletonIterable() {
actsLikeIteratorHelper(Collections.singletonList(new Object()));
Reported by PMD.
Line: 95
actsLikeIteratorHelper(Collections.emptyList());
}
public void testPeekingIteratorBehavesLikeIteratorOnSingletonIterable() {
actsLikeIteratorHelper(Collections.singletonList(new Object()));
}
// TODO(cpovirk): instead of skipping, use a smaller number of steps
@GwtIncompatible // works but takes 5 minutes to run
Reported by PMD.
Line: 95
actsLikeIteratorHelper(Collections.emptyList());
}
public void testPeekingIteratorBehavesLikeIteratorOnSingletonIterable() {
actsLikeIteratorHelper(Collections.singletonList(new Object()));
}
// TODO(cpovirk): instead of skipping, use a smaller number of steps
@GwtIncompatible // works but takes 5 minutes to run
Reported by PMD.
Line: 100
}
// TODO(cpovirk): instead of skipping, use a smaller number of steps
@GwtIncompatible // works but takes 5 minutes to run
public void testPeekingIteratorBehavesLikeIteratorOnThreeElementIterable() {
actsLikeIteratorHelper(Lists.newArrayList("A", "B", "C"));
}
@GwtIncompatible // works but takes 5 minutes to run
Reported by PMD.
Line: 101
// TODO(cpovirk): instead of skipping, use a smaller number of steps
@GwtIncompatible // works but takes 5 minutes to run
public void testPeekingIteratorBehavesLikeIteratorOnThreeElementIterable() {
actsLikeIteratorHelper(Lists.newArrayList("A", "B", "C"));
}
@GwtIncompatible // works but takes 5 minutes to run
public void testPeekingIteratorAcceptsNullElements() {
Reported by PMD.
Line: 105
actsLikeIteratorHelper(Lists.newArrayList("A", "B", "C"));
}
@GwtIncompatible // works but takes 5 minutes to run
public void testPeekingIteratorAcceptsNullElements() {
actsLikeIteratorHelper(Lists.newArrayList(null, "A", null));
}
public void testPeekOnEmptyList() {
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeysTester.java
39 issues
Line: 44
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapKeysTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@CollectionSize.Require(SEVERAL)
public void testKeys() {
resetContainer(
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k1(), v0()));
Multiset<K> keys = multimap().keys();
assertEquals(2, keys.count(k0()));
Reported by PMD.
Line: 45
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultimapKeysTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
@CollectionSize.Require(SEVERAL)
public void testKeys() {
resetContainer(
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k1(), v0()));
Multiset<K> keys = multimap().keys();
assertEquals(2, keys.count(k0()));
assertEquals(1, keys.count(k1()));
Reported by PMD.
Line: 48
public void testKeys() {
resetContainer(
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k1(), v0()));
Multiset<K> keys = multimap().keys();
assertEquals(2, keys.count(k0()));
assertEquals(1, keys.count(k1()));
assertEquals(3, keys.size());
assertContainsAllOf(keys, k0(), k1());
assertContainsAllOf(
Reported by PMD.
Line: 49
resetContainer(
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k1(), v0()));
Multiset<K> keys = multimap().keys();
assertEquals(2, keys.count(k0()));
assertEquals(1, keys.count(k1()));
assertEquals(3, keys.size());
assertContainsAllOf(keys, k0(), k1());
assertContainsAllOf(
keys.entrySet(), Multisets.immutableEntry(k0(), 2), Multisets.immutableEntry(k1(), 1));
Reported by PMD.
Line: 50
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k1(), v0()));
Multiset<K> keys = multimap().keys();
assertEquals(2, keys.count(k0()));
assertEquals(1, keys.count(k1()));
assertEquals(3, keys.size());
assertContainsAllOf(keys, k0(), k1());
assertContainsAllOf(
keys.entrySet(), Multisets.immutableEntry(k0(), 2), Multisets.immutableEntry(k1(), 1));
}
Reported by PMD.
Line: 51
Multiset<K> keys = multimap().keys();
assertEquals(2, keys.count(k0()));
assertEquals(1, keys.count(k1()));
assertEquals(3, keys.size());
assertContainsAllOf(keys, k0(), k1());
assertContainsAllOf(
keys.entrySet(), Multisets.immutableEntry(k0(), 2), Multisets.immutableEntry(k1(), 1));
}
Reported by PMD.
Line: 54
assertEquals(3, keys.size());
assertContainsAllOf(keys, k0(), k1());
assertContainsAllOf(
keys.entrySet(), Multisets.immutableEntry(k0(), 2), Multisets.immutableEntry(k1(), 1));
}
@MapFeature.Require(ALLOWS_NULL_KEY_QUERIES)
public void testKeysCountAbsentNullKey() {
assertEquals(0, multimap().keys().count(null));
Reported by PMD.
Line: 57
keys.entrySet(), Multisets.immutableEntry(k0(), 2), Multisets.immutableEntry(k1(), 1));
}
@MapFeature.Require(ALLOWS_NULL_KEY_QUERIES)
public void testKeysCountAbsentNullKey() {
assertEquals(0, multimap().keys().count(null));
}
@CollectionSize.Require(SEVERAL)
Reported by PMD.
Line: 59
@MapFeature.Require(ALLOWS_NULL_KEY_QUERIES)
public void testKeysCountAbsentNullKey() {
assertEquals(0, multimap().keys().count(null));
}
@CollectionSize.Require(SEVERAL)
@MapFeature.Require(ALLOWS_NULL_KEYS)
public void testKeysWithNullKey() {
Reported by PMD.
Line: 59
@MapFeature.Require(ALLOWS_NULL_KEY_QUERIES)
public void testKeysCountAbsentNullKey() {
assertEquals(0, multimap().keys().count(null));
}
@CollectionSize.Require(SEVERAL)
@MapFeature.Require(ALLOWS_NULL_KEYS)
public void testKeysWithNullKey() {
Reported by PMD.
android/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java
39 issues
Line: 37
*/
@GwtCompatible
public class EquivalenceTesterTest extends TestCase {
private EquivalenceTester<Object> tester;
private MockEquivalence equivalenceMock;
@Override
public void setUp() throws Exception {
super.setUp();
Reported by PMD.
Line: 38
@GwtCompatible
public class EquivalenceTesterTest extends TestCase {
private EquivalenceTester<Object> tester;
private MockEquivalence equivalenceMock;
@Override
public void setUp() throws Exception {
super.setUp();
this.equivalenceMock = new MockEquivalence();
Reported by PMD.
Line: 40
private EquivalenceTester<Object> tester;
private MockEquivalence equivalenceMock;
@Override
public void setUp() throws Exception {
super.setUp();
this.equivalenceMock = new MockEquivalence();
this.tester = EquivalenceTester.of(equivalenceMock);
}
Reported by PMD.
Line: 48
}
/** Test null reference yields error */
public void testOf_NullPointerException() {
try {
EquivalenceTester.of(null);
fail("Should fail on null reference");
} catch (NullPointerException expected) {
}
Reported by PMD.
Line: 51
public void testOf_NullPointerException() {
try {
EquivalenceTester.of(null);
fail("Should fail on null reference");
} catch (NullPointerException expected) {
}
}
public void testTest_NoData() {
Reported by PMD.
Line: 52
try {
EquivalenceTester.of(null);
fail("Should fail on null reference");
} catch (NullPointerException expected) {
}
}
public void testTest_NoData() {
tester.test();
Reported by PMD.
Line: 52
try {
EquivalenceTester.of(null);
fail("Should fail on null reference");
} catch (NullPointerException expected) {
}
}
public void testTest_NoData() {
tester.test();
Reported by PMD.
Line: 56
}
}
public void testTest_NoData() {
tester.test();
}
public void testTest() {
Object group1Item1 = new TestObject(1, 1);
Reported by PMD.
Line: 56
}
}
public void testTest_NoData() {
tester.test();
}
public void testTest() {
Object group1Item1 = new TestObject(1, 1);
Reported by PMD.
Line: 60
tester.test();
}
public void testTest() {
Object group1Item1 = new TestObject(1, 1);
Object group1Item2 = new TestObject(1, 2);
Object group2Item1 = new TestObject(2, 1);
Object group2Item2 = new TestObject(2, 2);
Reported by PMD.