The following issues were found
guava-tests/test/com/google/common/io/FilesFileTraverserTest.java
32 issues
Line: 37
* @author Jens Nyman
*/
public class FilesFileTraverserTest extends TestCase {
private File rootDir;
@Override
public void setUp() throws IOException {
Reported by PMD.
Line: 39
public class FilesFileTraverserTest extends TestCase {
private File rootDir;
@Override
public void setUp() throws IOException {
rootDir = Files.createTempDir();
}
Reported by PMD.
Line: 41
private File rootDir;
@Override
public void setUp() throws IOException {
rootDir = Files.createTempDir();
}
@Override
Reported by PMD.
Line: 46
rootDir = Files.createTempDir();
}
@Override
public void tearDown() throws IOException {
// delete rootDir and its contents
java.nio.file.Files.walkFileTree(
rootDir.toPath(),
new SimpleFileVisitor<Path>() {
Reported by PMD.
Line: 55
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
java.nio.file.Files.deleteIfExists(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Reported by PMD.
Line: 64
if (exc != null) {
return FileVisitResult.TERMINATE;
}
java.nio.file.Files.deleteIfExists(dir);
return FileVisitResult.CONTINUE;
}
});
}
Reported by PMD.
Line: 70
});
}
public void testFileTraverser_emptyDirectory() throws Exception {
assertThat(Files.fileTraverser().breadthFirst(rootDir)).containsExactly(rootDir);
}
public void testFileTraverser_nonExistingFile() throws Exception {
File file = new File(rootDir, "file-that-doesnt-exist");
Reported by PMD.
Line: 71
}
public void testFileTraverser_emptyDirectory() throws Exception {
assertThat(Files.fileTraverser().breadthFirst(rootDir)).containsExactly(rootDir);
}
public void testFileTraverser_nonExistingFile() throws Exception {
File file = new File(rootDir, "file-that-doesnt-exist");
Reported by PMD.
Line: 71
}
public void testFileTraverser_emptyDirectory() throws Exception {
assertThat(Files.fileTraverser().breadthFirst(rootDir)).containsExactly(rootDir);
}
public void testFileTraverser_nonExistingFile() throws Exception {
File file = new File(rootDir, "file-that-doesnt-exist");
Reported by PMD.
Line: 74
assertThat(Files.fileTraverser().breadthFirst(rootDir)).containsExactly(rootDir);
}
public void testFileTraverser_nonExistingFile() throws Exception {
File file = new File(rootDir, "file-that-doesnt-exist");
assertThat(Files.fileTraverser().breadthFirst(file)).containsExactly(file);
}
Reported by PMD.
guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java
32 issues
Line: 119
methods[i] = type.getMethod(methods[i].getName(), methods[i].getParameterTypes());
} catch (Exception e) {
throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
return methods;
}
Reported by PMD.
Line: 149
fail(method + " failed to throw exception as is.");
} catch (InvocationTargetException e) {
if (exception != e.getCause()) {
throw new RuntimeException(e);
}
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
}
Reported by PMD.
Line: 227
"Return value of " + method + " not forwarded", returnValue, actualReturnValue);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw Throwables.propagate(e.getCause());
}
assertEquals("Failed to forward to " + method, 1, called.get());
}
Reported by PMD.
Line: 60
@GwtIncompatible
public final class ForwardingWrapperTester {
private boolean testsEquals = false;
/**
* Asks for {@link Object#equals} and {@link Object#hashCode} to be tested. That is, forwarding
* wrappers of equal instances should be equal.
*/
Reported by PMD.
Line: 60
@GwtIncompatible
public final class ForwardingWrapperTester {
private boolean testsEquals = false;
/**
* Asks for {@link Object#equals} and {@link Object#hashCode} to be tested. That is, forwarding
* wrappers of equal instances should be equal.
*/
Reported by PMD.
Line: 76
* calls with parameters passed as is, return value returned as is, and exceptions propagated as
* is.
*/
public <T> void testForwarding(
Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) {
checkNotNull(wrapperFunction);
checkArgument(interfaceType.isInterface(), "%s isn't an interface", interfaceType);
Method[] methods = getMostConcreteMethods(interfaceType);
AccessibleObject.setAccessible(methods, true);
Reported by PMD.
Line: 76
* calls with parameters passed as is, return value returned as is, and exceptions propagated as
* is.
*/
public <T> void testForwarding(
Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) {
checkNotNull(wrapperFunction);
checkArgument(interfaceType.isInterface(), "%s isn't an interface", interfaceType);
Method[] methods = getMostConcreteMethods(interfaceType);
AccessibleObject.setAccessible(methods, true);
Reported by PMD.
Line: 91
}
// The interface could be package-private or private.
// filter out equals/hashCode/toString
if (method.getName().equals("equals")
&& method.getParameterTypes().length == 1
&& method.getParameterTypes()[0] == Object.class) {
continue;
}
if (method.getName().equals("hashCode") && method.getParameterTypes().length == 0) {
Reported by PMD.
Line: 91
}
// The interface could be package-private or private.
// filter out equals/hashCode/toString
if (method.getName().equals("equals")
&& method.getParameterTypes().length == 1
&& method.getParameterTypes()[0] == Object.class) {
continue;
}
if (method.getName().equals("hashCode") && method.getParameterTypes().length == 0) {
Reported by PMD.
Line: 92
// The interface could be package-private or private.
// filter out equals/hashCode/toString
if (method.getName().equals("equals")
&& method.getParameterTypes().length == 1
&& method.getParameterTypes()[0] == Object.class) {
continue;
}
if (method.getName().equals("hashCode") && method.getParameterTypes().length == 0) {
continue;
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultisetTestSuiteBuilder.java
32 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect.testing.google;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.Multiset;
Reported by PMD.
Line: 74
@Override
protected List<Class<? extends AbstractTester>> getTesters() {
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.add(CollectionSerializationEqualTester.class);
testers.add(MultisetAddTester.class);
testers.add(MultisetContainsTester.class);
testers.add(MultisetCountTester.class);
testers.add(MultisetElementSetTester.class);
testers.add(MultisetEqualsTester.class);
Reported by PMD.
Line: 75
protected List<Class<? extends AbstractTester>> getTesters() {
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.add(CollectionSerializationEqualTester.class);
testers.add(MultisetAddTester.class);
testers.add(MultisetContainsTester.class);
testers.add(MultisetCountTester.class);
testers.add(MultisetElementSetTester.class);
testers.add(MultisetEqualsTester.class);
testers.add(MultisetReadsTester.class);
Reported by PMD.
Line: 76
List<Class<? extends AbstractTester>> testers = Helpers.copyToList(super.getTesters());
testers.add(CollectionSerializationEqualTester.class);
testers.add(MultisetAddTester.class);
testers.add(MultisetContainsTester.class);
testers.add(MultisetCountTester.class);
testers.add(MultisetElementSetTester.class);
testers.add(MultisetEqualsTester.class);
testers.add(MultisetReadsTester.class);
testers.add(MultisetSetCountConditionallyTester.class);
Reported by PMD.
Line: 77
testers.add(CollectionSerializationEqualTester.class);
testers.add(MultisetAddTester.class);
testers.add(MultisetContainsTester.class);
testers.add(MultisetCountTester.class);
testers.add(MultisetElementSetTester.class);
testers.add(MultisetEqualsTester.class);
testers.add(MultisetReadsTester.class);
testers.add(MultisetSetCountConditionallyTester.class);
testers.add(MultisetSetCountUnconditionallyTester.class);
Reported by PMD.
Line: 78
testers.add(MultisetAddTester.class);
testers.add(MultisetContainsTester.class);
testers.add(MultisetCountTester.class);
testers.add(MultisetElementSetTester.class);
testers.add(MultisetEqualsTester.class);
testers.add(MultisetReadsTester.class);
testers.add(MultisetSetCountConditionallyTester.class);
testers.add(MultisetSetCountUnconditionallyTester.class);
testers.add(MultisetRemoveTester.class);
Reported by PMD.
Line: 79
testers.add(MultisetContainsTester.class);
testers.add(MultisetCountTester.class);
testers.add(MultisetElementSetTester.class);
testers.add(MultisetEqualsTester.class);
testers.add(MultisetReadsTester.class);
testers.add(MultisetSetCountConditionallyTester.class);
testers.add(MultisetSetCountUnconditionallyTester.class);
testers.add(MultisetRemoveTester.class);
testers.add(MultisetEntrySetTester.class);
Reported by PMD.
Line: 80
testers.add(MultisetCountTester.class);
testers.add(MultisetElementSetTester.class);
testers.add(MultisetEqualsTester.class);
testers.add(MultisetReadsTester.class);
testers.add(MultisetSetCountConditionallyTester.class);
testers.add(MultisetSetCountUnconditionallyTester.class);
testers.add(MultisetRemoveTester.class);
testers.add(MultisetEntrySetTester.class);
testers.add(MultisetIteratorTester.class);
Reported by PMD.
Line: 81
testers.add(MultisetElementSetTester.class);
testers.add(MultisetEqualsTester.class);
testers.add(MultisetReadsTester.class);
testers.add(MultisetSetCountConditionallyTester.class);
testers.add(MultisetSetCountUnconditionallyTester.class);
testers.add(MultisetRemoveTester.class);
testers.add(MultisetEntrySetTester.class);
testers.add(MultisetIteratorTester.class);
testers.add(MultisetSerializationTester.class);
Reported by PMD.
Line: 82
testers.add(MultisetEqualsTester.class);
testers.add(MultisetReadsTester.class);
testers.add(MultisetSetCountConditionallyTester.class);
testers.add(MultisetSetCountUnconditionallyTester.class);
testers.add(MultisetRemoveTester.class);
testers.add(MultisetEntrySetTester.class);
testers.add(MultisetIteratorTester.class);
testers.add(MultisetSerializationTester.class);
return testers;
Reported by PMD.
android/guava-tests/test/com/google/common/io/FilesFileTraverserTest.java
32 issues
Line: 37
* @author Jens Nyman
*/
public class FilesFileTraverserTest extends TestCase {
private File rootDir;
@Override
public void setUp() throws IOException {
Reported by PMD.
Line: 39
public class FilesFileTraverserTest extends TestCase {
private File rootDir;
@Override
public void setUp() throws IOException {
rootDir = Files.createTempDir();
}
Reported by PMD.
Line: 41
private File rootDir;
@Override
public void setUp() throws IOException {
rootDir = Files.createTempDir();
}
@Override
Reported by PMD.
Line: 46
rootDir = Files.createTempDir();
}
@Override
public void tearDown() throws IOException {
// delete rootDir and its contents
java.nio.file.Files.walkFileTree(
rootDir.toPath(),
new SimpleFileVisitor<Path>() {
Reported by PMD.
Line: 55
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
java.nio.file.Files.deleteIfExists(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Reported by PMD.
Line: 64
if (exc != null) {
return FileVisitResult.TERMINATE;
}
java.nio.file.Files.deleteIfExists(dir);
return FileVisitResult.CONTINUE;
}
});
}
Reported by PMD.
Line: 70
});
}
public void testFileTraverser_emptyDirectory() throws Exception {
assertThat(Files.fileTraverser().breadthFirst(rootDir)).containsExactly(rootDir);
}
public void testFileTraverser_nonExistingFile() throws Exception {
File file = new File(rootDir, "file-that-doesnt-exist");
Reported by PMD.
Line: 71
}
public void testFileTraverser_emptyDirectory() throws Exception {
assertThat(Files.fileTraverser().breadthFirst(rootDir)).containsExactly(rootDir);
}
public void testFileTraverser_nonExistingFile() throws Exception {
File file = new File(rootDir, "file-that-doesnt-exist");
Reported by PMD.
Line: 71
}
public void testFileTraverser_emptyDirectory() throws Exception {
assertThat(Files.fileTraverser().breadthFirst(rootDir)).containsExactly(rootDir);
}
public void testFileTraverser_nonExistingFile() throws Exception {
File file = new File(rootDir, "file-that-doesnt-exist");
Reported by PMD.
Line: 74
assertThat(Files.fileTraverser().breadthFirst(rootDir)).containsExactly(rootDir);
}
public void testFileTraverser_nonExistingFile() throws Exception {
File file = new File(rootDir, "file-that-doesnt-exist");
assertThat(Files.fileTraverser().breadthFirst(file)).containsExactly(file);
}
Reported by PMD.
android/guava-tests/test/com/google/common/io/ByteSourceTester.java
32 issues
Line: 47
* @author Colin Decker
*/
@AndroidIncompatible // Android doesn't understand tests that lack default constructors.
public class ByteSourceTester extends SourceSinkTester<ByteSource, byte[], ByteSourceFactory> {
private static final ImmutableList<Method> testMethods = getTestMethods(ByteSourceTester.class);
static TestSuite tests(String name, ByteSourceFactory factory, boolean testAsCharSource) {
TestSuite suite = new TestSuite(name);
Reported by PMD.
Line: 59
} else {
suite.addTest(
suiteForBytes(
factory, entry.getValue().getBytes(Charsets.UTF_8), name, entry.getKey(), true));
}
}
return suite;
}
Reported by PMD.
Line: 79
ByteSourceFactory factory, byte[] bytes, String name, String desc, boolean slice) {
TestSuite suite = new TestSuite(name + " [" + desc + "]");
for (Method method : testMethods) {
suite.addTest(new ByteSourceTester(factory, bytes, name, desc, method));
}
if (slice && bytes.length > 0) {
// test a random slice() of the ByteSource
Random random = new Random();
Reported by PMD.
Line: 112
return suite;
}
private ByteSource source;
public ByteSourceTester(
ByteSourceFactory factory, byte[] bytes, String suiteName, String caseDesc, Method method) {
super(factory, bytes, suiteName, caseDesc, method);
}
Reported by PMD.
Line: 119
super(factory, bytes, suiteName, caseDesc, method);
}
@Override
public void setUp() throws IOException {
source = factory.createSource(data);
}
public void testOpenStream() throws IOException {
Reported by PMD.
Line: 124
source = factory.createSource(data);
}
public void testOpenStream() throws IOException {
InputStream in = source.openStream();
try {
byte[] readBytes = ByteStreams.toByteArray(in);
assertExpectedBytes(readBytes);
} finally {
Reported by PMD.
Line: 126
public void testOpenStream() throws IOException {
InputStream in = source.openStream();
try {
byte[] readBytes = ByteStreams.toByteArray(in);
assertExpectedBytes(readBytes);
} finally {
in.close();
}
Reported by PMD.
Line: 134
}
}
public void testOpenBufferedStream() throws IOException {
InputStream in = source.openBufferedStream();
try {
byte[] readBytes = ByteStreams.toByteArray(in);
assertExpectedBytes(readBytes);
} finally {
Reported by PMD.
Line: 136
public void testOpenBufferedStream() throws IOException {
InputStream in = source.openBufferedStream();
try {
byte[] readBytes = ByteStreams.toByteArray(in);
assertExpectedBytes(readBytes);
} finally {
in.close();
}
Reported by PMD.
Line: 144
}
}
public void testRead() throws IOException {
byte[] readBytes = source.read();
assertExpectedBytes(readBytes);
}
public void testCopyTo_outputStream() throws IOException {
Reported by PMD.
android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java
32 issues
Line: 119
methods[i] = type.getMethod(methods[i].getName(), methods[i].getParameterTypes());
} catch (Exception e) {
throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
return methods;
}
Reported by PMD.
Line: 149
fail(method + " failed to throw exception as is.");
} catch (InvocationTargetException e) {
if (exception != e.getCause()) {
throw new RuntimeException(e);
}
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
}
Reported by PMD.
Line: 227
"Return value of " + method + " not forwarded", returnValue, actualReturnValue);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw Throwables.propagate(e.getCause());
}
assertEquals("Failed to forward to " + method, 1, called.get());
}
Reported by PMD.
Line: 60
@GwtIncompatible
public final class ForwardingWrapperTester {
private boolean testsEquals = false;
/**
* Asks for {@link Object#equals} and {@link Object#hashCode} to be tested. That is, forwarding
* wrappers of equal instances should be equal.
*/
Reported by PMD.
Line: 60
@GwtIncompatible
public final class ForwardingWrapperTester {
private boolean testsEquals = false;
/**
* Asks for {@link Object#equals} and {@link Object#hashCode} to be tested. That is, forwarding
* wrappers of equal instances should be equal.
*/
Reported by PMD.
Line: 76
* calls with parameters passed as is, return value returned as is, and exceptions propagated as
* is.
*/
public <T> void testForwarding(
Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) {
checkNotNull(wrapperFunction);
checkArgument(interfaceType.isInterface(), "%s isn't an interface", interfaceType);
Method[] methods = getMostConcreteMethods(interfaceType);
AccessibleObject.setAccessible(methods, true);
Reported by PMD.
Line: 76
* calls with parameters passed as is, return value returned as is, and exceptions propagated as
* is.
*/
public <T> void testForwarding(
Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) {
checkNotNull(wrapperFunction);
checkArgument(interfaceType.isInterface(), "%s isn't an interface", interfaceType);
Method[] methods = getMostConcreteMethods(interfaceType);
AccessibleObject.setAccessible(methods, true);
Reported by PMD.
Line: 91
}
// The interface could be package-private or private.
// filter out equals/hashCode/toString
if (method.getName().equals("equals")
&& method.getParameterTypes().length == 1
&& method.getParameterTypes()[0] == Object.class) {
continue;
}
if (method.getName().equals("hashCode") && method.getParameterTypes().length == 0) {
Reported by PMD.
Line: 91
}
// The interface could be package-private or private.
// filter out equals/hashCode/toString
if (method.getName().equals("equals")
&& method.getParameterTypes().length == 1
&& method.getParameterTypes()[0] == Object.class) {
continue;
}
if (method.getName().equals("hashCode") && method.getParameterTypes().length == 0) {
Reported by PMD.
Line: 92
// The interface could be package-private or private.
// filter out equals/hashCode/toString
if (method.getName().equals("equals")
&& method.getParameterTypes().length == 1
&& method.getParameterTypes()[0] == Object.class) {
continue;
}
if (method.getName().equals("hashCode") && method.getParameterTypes().length == 0) {
continue;
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ForwardingConcurrentMapTest.java
31 issues
Line: 31
public class ForwardingConcurrentMapTest extends TestCase {
private static class TestMap extends ForwardingConcurrentMap<String, Integer> {
final ConcurrentMap<String, Integer> delegate = new ConcurrentHashMap<>();
@Override
protected ConcurrentMap<String, Integer> delegate() {
return delegate;
}
Reported by PMD.
Line: 31
public class ForwardingConcurrentMapTest extends TestCase {
private static class TestMap extends ForwardingConcurrentMap<String, Integer> {
final ConcurrentMap<String, Integer> delegate = new ConcurrentHashMap<>();
@Override
protected ConcurrentMap<String, Integer> delegate() {
return delegate;
}
Reported by PMD.
Line: 39
}
}
public void testPutIfAbsent() {
TestMap map = new TestMap();
map.put("foo", 1);
assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2));
assertEquals(Integer.valueOf(1), map.get("foo"));
assertNull(map.putIfAbsent("bar", 3));
Reported by PMD.
Line: 39
}
}
public void testPutIfAbsent() {
TestMap map = new TestMap();
map.put("foo", 1);
assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2));
assertEquals(Integer.valueOf(1), map.get("foo"));
assertNull(map.putIfAbsent("bar", 3));
Reported by PMD.
Line: 41
public void testPutIfAbsent() {
TestMap map = new TestMap();
map.put("foo", 1);
assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2));
assertEquals(Integer.valueOf(1), map.get("foo"));
assertNull(map.putIfAbsent("bar", 3));
assertEquals(Integer.valueOf(3), map.get("bar"));
}
Reported by PMD.
Line: 42
public void testPutIfAbsent() {
TestMap map = new TestMap();
map.put("foo", 1);
assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2));
assertEquals(Integer.valueOf(1), map.get("foo"));
assertNull(map.putIfAbsent("bar", 3));
assertEquals(Integer.valueOf(3), map.get("bar"));
}
Reported by PMD.
Line: 43
TestMap map = new TestMap();
map.put("foo", 1);
assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2));
assertEquals(Integer.valueOf(1), map.get("foo"));
assertNull(map.putIfAbsent("bar", 3));
assertEquals(Integer.valueOf(3), map.get("bar"));
}
public void testRemove() {
Reported by PMD.
Line: 44
map.put("foo", 1);
assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2));
assertEquals(Integer.valueOf(1), map.get("foo"));
assertNull(map.putIfAbsent("bar", 3));
assertEquals(Integer.valueOf(3), map.get("bar"));
}
public void testRemove() {
TestMap map = new TestMap();
Reported by PMD.
Line: 44
map.put("foo", 1);
assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2));
assertEquals(Integer.valueOf(1), map.get("foo"));
assertNull(map.putIfAbsent("bar", 3));
assertEquals(Integer.valueOf(3), map.get("bar"));
}
public void testRemove() {
TestMap map = new TestMap();
Reported by PMD.
Line: 45
assertEquals(Integer.valueOf(1), map.putIfAbsent("foo", 2));
assertEquals(Integer.valueOf(1), map.get("foo"));
assertNull(map.putIfAbsent("bar", 3));
assertEquals(Integer.valueOf(3), map.get("bar"));
}
public void testRemove() {
TestMap map = new TestMap();
map.put("foo", 1);
Reported by PMD.
android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java
31 issues
Line: 26
/** @author Gregory Kick */
@GwtCompatible
public class RegularImmutableTableTest extends AbstractImmutableTableTest {
private static final ImmutableSet<Cell<Character, Integer, String>> CELLS =
ImmutableSet.of(
Tables.immutableCell('a', 1, "foo"),
Tables.immutableCell('b', 1, "bar"),
Tables.immutableCell('a', 2, "baz"));
Reported by PMD.
Line: 29
public class RegularImmutableTableTest extends AbstractImmutableTableTest {
private static final ImmutableSet<Cell<Character, Integer, String>> CELLS =
ImmutableSet.of(
Tables.immutableCell('a', 1, "foo"),
Tables.immutableCell('b', 1, "bar"),
Tables.immutableCell('a', 2, "baz"));
private static final ImmutableSet<Character> ROW_SPACE = ImmutableSet.of('a', 'b');
Reported by PMD.
Line: 30
private static final ImmutableSet<Cell<Character, Integer, String>> CELLS =
ImmutableSet.of(
Tables.immutableCell('a', 1, "foo"),
Tables.immutableCell('b', 1, "bar"),
Tables.immutableCell('a', 2, "baz"));
private static final ImmutableSet<Character> ROW_SPACE = ImmutableSet.of('a', 'b');
private static final ImmutableSet<Integer> COLUMN_SPACE = ImmutableSet.of(1, 2);
Reported by PMD.
Line: 31
ImmutableSet.of(
Tables.immutableCell('a', 1, "foo"),
Tables.immutableCell('b', 1, "bar"),
Tables.immutableCell('a', 2, "baz"));
private static final ImmutableSet<Character> ROW_SPACE = ImmutableSet.of('a', 'b');
private static final ImmutableSet<Integer> COLUMN_SPACE = ImmutableSet.of(1, 2);
Reported by PMD.
Line: 48
return ImmutableList.<ImmutableTable<Character, Integer, String>>of(SPARSE, DENSE);
}
public void testCellSet() {
for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
assertEquals(CELLS, testInstance.cellSet());
}
}
Reported by PMD.
Line: 54
}
}
public void testValues() {
for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
assertThat(testInstance.values()).containsExactly("foo", "bar", "baz").inOrder();
}
}
Reported by PMD.
Line: 56
public void testValues() {
for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
assertThat(testInstance.values()).containsExactly("foo", "bar", "baz").inOrder();
}
}
public void testSize() {
for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
Reported by PMD.
Line: 56
public void testValues() {
for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
assertThat(testInstance.values()).containsExactly("foo", "bar", "baz").inOrder();
}
}
public void testSize() {
for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
Reported by PMD.
Line: 60
}
}
public void testSize() {
for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
assertEquals(3, testInstance.size());
}
}
Reported by PMD.
Line: 66
}
}
public void testContainsValue() {
for (ImmutableTable<Character, Integer, String> testInstance : getTestInstances()) {
assertTrue(testInstance.containsValue("foo"));
assertTrue(testInstance.containsValue("bar"));
assertTrue(testInstance.containsValue("baz"));
assertFalse(testInstance.containsValue("blah"));
Reported by PMD.
android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java
31 issues
Line: 37
@Override
protected Table<String, Integer, Character> create(Object... data) {
Table<String, Integer, Character> table = HashBasedTable.create();
table.put("foo", 4, 'a');
table.put("cat", 1, 'b');
table.clear();
populate(table, data);
return table;
}
Reported by PMD.
Line: 37
@Override
protected Table<String, Integer, Character> create(Object... data) {
Table<String, Integer, Character> table = HashBasedTable.create();
table.put("foo", 4, 'a');
table.put("cat", 1, 'b');
table.clear();
populate(table, data);
return table;
}
Reported by PMD.
Line: 38
protected Table<String, Integer, Character> create(Object... data) {
Table<String, Integer, Character> table = HashBasedTable.create();
table.put("foo", 4, 'a');
table.put("cat", 1, 'b');
table.clear();
populate(table, data);
return table;
}
Reported by PMD.
Line: 39
Table<String, Integer, Character> table = HashBasedTable.create();
table.put("foo", 4, 'a');
table.put("cat", 1, 'b');
table.clear();
populate(table, data);
return table;
}
public void testIterationOrder() {
Reported by PMD.
Line: 44
return table;
}
public void testIterationOrder() {
Table<String, String, String> table = HashBasedTable.create();
for (int i = 0; i < 5; i++) {
table.put("r" + i, "c" + i, "v" + i);
}
assertThat(table.rowKeySet()).containsExactly("r0", "r1", "r2", "r3", "r4").inOrder();
Reported by PMD.
Line: 44
return table;
}
public void testIterationOrder() {
Table<String, String, String> table = HashBasedTable.create();
for (int i = 0; i < 5; i++) {
table.put("r" + i, "c" + i, "v" + i);
}
assertThat(table.rowKeySet()).containsExactly("r0", "r1", "r2", "r3", "r4").inOrder();
Reported by PMD.
Line: 49
for (int i = 0; i < 5; i++) {
table.put("r" + i, "c" + i, "v" + i);
}
assertThat(table.rowKeySet()).containsExactly("r0", "r1", "r2", "r3", "r4").inOrder();
assertThat(table.columnKeySet()).containsExactly("c0", "c1", "c2", "c3", "c4").inOrder();
assertThat(table.values()).containsExactly("v0", "v1", "v2", "v3", "v4").inOrder();
}
public void testCreateWithValidSizes() {
Reported by PMD.
Line: 49
for (int i = 0; i < 5; i++) {
table.put("r" + i, "c" + i, "v" + i);
}
assertThat(table.rowKeySet()).containsExactly("r0", "r1", "r2", "r3", "r4").inOrder();
assertThat(table.columnKeySet()).containsExactly("c0", "c1", "c2", "c3", "c4").inOrder();
assertThat(table.values()).containsExactly("v0", "v1", "v2", "v3", "v4").inOrder();
}
public void testCreateWithValidSizes() {
Reported by PMD.
Line: 49
for (int i = 0; i < 5; i++) {
table.put("r" + i, "c" + i, "v" + i);
}
assertThat(table.rowKeySet()).containsExactly("r0", "r1", "r2", "r3", "r4").inOrder();
assertThat(table.columnKeySet()).containsExactly("c0", "c1", "c2", "c3", "c4").inOrder();
assertThat(table.values()).containsExactly("v0", "v1", "v2", "v3", "v4").inOrder();
}
public void testCreateWithValidSizes() {
Reported by PMD.
Line: 50
table.put("r" + i, "c" + i, "v" + i);
}
assertThat(table.rowKeySet()).containsExactly("r0", "r1", "r2", "r3", "r4").inOrder();
assertThat(table.columnKeySet()).containsExactly("c0", "c1", "c2", "c3", "c4").inOrder();
assertThat(table.values()).containsExactly("v0", "v1", "v2", "v3", "v4").inOrder();
}
public void testCreateWithValidSizes() {
Table<String, Integer, Character> table1 = HashBasedTable.create(100, 20);
Reported by PMD.
android/guava-testlib/src/com/google/common/collect/testing/google/MultisetElementSetTester.java
31 issues
Line: 45
@GwtCompatible
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetElementSetTester<E> extends AbstractMultisetTester<E> {
@CollectionFeature.Require(SUPPORTS_ADD)
public void testElementSetReflectsAddAbsent() {
Set<E> elementSet = getMultiset().elementSet();
assertFalse(elementSet.contains(e3()));
getMultiset().add(e3(), 4);
assertTrue(elementSet.contains(e3()));
Reported by PMD.
Line: 46
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
public class MultisetElementSetTester<E> extends AbstractMultisetTester<E> {
@CollectionFeature.Require(SUPPORTS_ADD)
public void testElementSetReflectsAddAbsent() {
Set<E> elementSet = getMultiset().elementSet();
assertFalse(elementSet.contains(e3()));
getMultiset().add(e3(), 4);
assertTrue(elementSet.contains(e3()));
}
Reported by PMD.
Line: 47
public class MultisetElementSetTester<E> extends AbstractMultisetTester<E> {
@CollectionFeature.Require(SUPPORTS_ADD)
public void testElementSetReflectsAddAbsent() {
Set<E> elementSet = getMultiset().elementSet();
assertFalse(elementSet.contains(e3()));
getMultiset().add(e3(), 4);
assertTrue(elementSet.contains(e3()));
}
Reported by PMD.
Line: 48
@CollectionFeature.Require(SUPPORTS_ADD)
public void testElementSetReflectsAddAbsent() {
Set<E> elementSet = getMultiset().elementSet();
assertFalse(elementSet.contains(e3()));
getMultiset().add(e3(), 4);
assertTrue(elementSet.contains(e3()));
}
@CollectionSize.Require(absent = ZERO)
Reported by PMD.
Line: 49
public void testElementSetReflectsAddAbsent() {
Set<E> elementSet = getMultiset().elementSet();
assertFalse(elementSet.contains(e3()));
getMultiset().add(e3(), 4);
assertTrue(elementSet.contains(e3()));
}
@CollectionSize.Require(absent = ZERO)
@CollectionFeature.Require(SUPPORTS_REMOVE)
Reported by PMD.
Line: 50
Set<E> elementSet = getMultiset().elementSet();
assertFalse(elementSet.contains(e3()));
getMultiset().add(e3(), 4);
assertTrue(elementSet.contains(e3()));
}
@CollectionSize.Require(absent = ZERO)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testElementSetReflectsRemove() {
Reported by PMD.
Line: 53
assertTrue(elementSet.contains(e3()));
}
@CollectionSize.Require(absent = ZERO)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testElementSetReflectsRemove() {
Set<E> elementSet = getMultiset().elementSet();
assertTrue(elementSet.contains(e0()));
getMultiset().removeAll(Collections.singleton(e0()));
Reported by PMD.
Line: 55
@CollectionSize.Require(absent = ZERO)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testElementSetReflectsRemove() {
Set<E> elementSet = getMultiset().elementSet();
assertTrue(elementSet.contains(e0()));
getMultiset().removeAll(Collections.singleton(e0()));
assertFalse(elementSet.contains(e0()));
}
Reported by PMD.
Line: 56
@CollectionSize.Require(absent = ZERO)
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testElementSetReflectsRemove() {
Set<E> elementSet = getMultiset().elementSet();
assertTrue(elementSet.contains(e0()));
getMultiset().removeAll(Collections.singleton(e0()));
assertFalse(elementSet.contains(e0()));
}
Reported by PMD.
Line: 57
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testElementSetReflectsRemove() {
Set<E> elementSet = getMultiset().elementSet();
assertTrue(elementSet.contains(e0()));
getMultiset().removeAll(Collections.singleton(e0()));
assertFalse(elementSet.contains(e0()));
}
@CollectionSize.Require(absent = ZERO)
Reported by PMD.