The following issues were found
guava-tests/test/com/google/common/collect/TreeBasedTableTest.java
180 issues
Line: 46
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class TreeBasedTableTest extends AbstractTableTest {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(TreeBasedTableTest.class);
suite.addTestSuite(TreeRowTest.class);
Reported by PMD.
Line: 47
*/
@GwtCompatible(emulated = true)
public class TreeBasedTableTest extends AbstractTableTest {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(TreeBasedTableTest.class);
suite.addTestSuite(TreeRowTest.class);
suite.addTest(
Reported by PMD.
Line: 58
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
Reported by PMD.
Line: 59
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
return table.row("b");
Reported by PMD.
Line: 60
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
return table.row("b");
}
Reported by PMD.
Line: 64
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
return table.row("b");
}
})
.withFeatures(
MapFeature.GENERAL_PURPOSE,
CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
Reported by PMD.
Line: 84
@Override
protected SortedMap<String, String> makeEmptyMap() {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
return table.row("b");
}
Reported by PMD.
Line: 85
protected SortedMap<String, String> makeEmptyMap() {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
return table.row("b");
}
@Override
Reported by PMD.
Line: 86
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
return table.row("b");
}
@Override
protected SortedMap<String, String> makePopulatedMap() {
Reported by PMD.
Line: 87
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
return table.row("b");
}
@Override
protected SortedMap<String, String> makePopulatedMap() {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
Reported by PMD.
android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java
180 issues
Line: 46
* @author Louis Wasserman
*/
@GwtCompatible(emulated = true)
public class TreeBasedTableTest extends AbstractTableTest {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(TreeBasedTableTest.class);
suite.addTestSuite(TreeRowTest.class);
Reported by PMD.
Line: 47
*/
@GwtCompatible(emulated = true)
public class TreeBasedTableTest extends AbstractTableTest {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(TreeBasedTableTest.class);
suite.addTestSuite(TreeRowTest.class);
suite.addTest(
Reported by PMD.
Line: 58
@Override
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
Reported by PMD.
Line: 59
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
return table.row("b");
Reported by PMD.
Line: 60
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
return table.row("b");
}
Reported by PMD.
Line: 64
for (Entry<String, String> entry : entries) {
table.put("b", entry.getKey(), entry.getValue());
}
return table.row("b");
}
})
.withFeatures(
MapFeature.GENERAL_PURPOSE,
CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
Reported by PMD.
Line: 84
@Override
protected SortedMap<String, String> makeEmptyMap() {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
return table.row("b");
}
Reported by PMD.
Line: 85
protected SortedMap<String, String> makeEmptyMap() {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
return table.row("b");
}
@Override
Reported by PMD.
Line: 86
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
return table.row("b");
}
@Override
protected SortedMap<String, String> makePopulatedMap() {
Reported by PMD.
Line: 87
table.put("a", "b", "c");
table.put("c", "b", "a");
table.put("a", "a", "d");
return table.row("b");
}
@Override
protected SortedMap<String, String> makePopulatedMap() {
TreeBasedTable<String, String, String> table = TreeBasedTable.create();
Reported by PMD.
android/guava-tests/test/com/google/common/graph/AbstractStandardDirectedGraphTest.java
179 issues
Line: 31
/**
* Abstract base class for testing directed {@link Graph} implementations defined in this package.
*/
public abstract class AbstractStandardDirectedGraphTest extends AbstractGraphTest {
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Reported by PMD.
Line: 36
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Set<Integer> nodes = graph.nodes();
try {
nodes.add(N2);
fail(ERROR_MODIFIABLE_SET);
Reported by PMD.
Line: 36
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Set<Integer> nodes = graph.nodes();
try {
nodes.add(N2);
fail(ERROR_MODIFIABLE_SET);
Reported by PMD.
Line: 44
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
addNode(N1);
assertThat(graph.nodes()).containsExactlyElementsIn(nodes);
}
}
@Override
@Test
Reported by PMD.
Line: 51
@Override
@Test
public void adjacentNodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N1);
Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
try {
adjacentNodes.add(N2);
Reported by PMD.
Line: 51
@Override
@Test
public void adjacentNodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N1);
Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
try {
adjacentNodes.add(N2);
Reported by PMD.
Line: 60
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
putEdge(N1, N2);
assertThat(graph.adjacentNodes(N1)).containsExactlyElementsIn(adjacentNodes);
}
}
@Override
@Test
Reported by PMD.
Line: 67
@Override
@Test
public void predecessors_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N2);
Set<Integer> predecessors = graph.predecessors(N2);
try {
predecessors.add(N1);
Reported by PMD.
Line: 67
@Override
@Test
public void predecessors_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N2);
Set<Integer> predecessors = graph.predecessors(N2);
try {
predecessors.add(N1);
Reported by PMD.
Line: 76
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
putEdge(N1, N2);
assertThat(graph.predecessors(N2)).containsExactlyElementsIn(predecessors);
}
}
@Override
@Test
Reported by PMD.
guava-tests/test/com/google/common/graph/AbstractStandardDirectedGraphTest.java
179 issues
Line: 31
/**
* Abstract base class for testing directed {@link Graph} implementations defined in this package.
*/
public abstract class AbstractStandardDirectedGraphTest extends AbstractGraphTest {
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Reported by PMD.
Line: 36
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Set<Integer> nodes = graph.nodes();
try {
nodes.add(N2);
fail(ERROR_MODIFIABLE_SET);
Reported by PMD.
Line: 36
@Override
@Test
public void nodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
Set<Integer> nodes = graph.nodes();
try {
nodes.add(N2);
fail(ERROR_MODIFIABLE_SET);
Reported by PMD.
Line: 44
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
addNode(N1);
assertThat(graph.nodes()).containsExactlyElementsIn(nodes);
}
}
@Override
@Test
Reported by PMD.
Line: 51
@Override
@Test
public void adjacentNodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N1);
Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
try {
adjacentNodes.add(N2);
Reported by PMD.
Line: 51
@Override
@Test
public void adjacentNodes_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N1);
Set<Integer> adjacentNodes = graph.adjacentNodes(N1);
try {
adjacentNodes.add(N2);
Reported by PMD.
Line: 60
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
putEdge(N1, N2);
assertThat(graph.adjacentNodes(N1)).containsExactlyElementsIn(adjacentNodes);
}
}
@Override
@Test
Reported by PMD.
Line: 67
@Override
@Test
public void predecessors_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N2);
Set<Integer> predecessors = graph.predecessors(N2);
try {
predecessors.add(N1);
Reported by PMD.
Line: 67
@Override
@Test
public void predecessors_checkReturnedSetMutability() {
assume().that(graphIsMutable()).isTrue();
addNode(N2);
Set<Integer> predecessors = graph.predecessors(N2);
try {
predecessors.add(N1);
Reported by PMD.
Line: 76
fail(ERROR_MODIFIABLE_SET);
} catch (UnsupportedOperationException e) {
putEdge(N1, N2);
assertThat(graph.predecessors(N2)).containsExactlyElementsIn(predecessors);
}
}
@Override
@Test
Reported by PMD.
android/guava-tests/test/com/google/common/net/InternetDomainNameTest.java
179 issues
Line: 36
* @author Craig Berry
*/
@GwtCompatible(emulated = true)
public final class InternetDomainNameTest extends TestCase {
private static final InternetDomainName UNICODE_EXAMPLE =
InternetDomainName.from("j\u00f8rpeland.no");
private static final InternetDomainName PUNYCODE_EXAMPLE =
InternetDomainName.from("xn--jrpeland-54a.no");
Reported by PMD.
Line: 36
* @author Craig Berry
*/
@GwtCompatible(emulated = true)
public final class InternetDomainNameTest extends TestCase {
private static final InternetDomainName UNICODE_EXAMPLE =
InternetDomainName.from("j\u00f8rpeland.no");
private static final InternetDomainName PUNYCODE_EXAMPLE =
InternetDomainName.from("xn--jrpeland-54a.no");
Reported by PMD.
Line: 77
ImmutableSet.of(
"",
" ",
"127.0.0.1",
"::1",
"13",
"abc.12c",
"foo-.com",
"_bar.quux",
Reported by PMD.
Line: 78
"",
" ",
"127.0.0.1",
"::1",
"13",
"abc.12c",
"foo-.com",
"_bar.quux",
"foo+bar.com",
Reported by PMD.
Line: 95
"...",
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com",
"a" + DELTA + " .com",
ALMOST_TOO_MANY_LEVELS + "com",
ALMOST_TOO_LONG + ".c");
private static final ImmutableSet<String> RS =
ImmutableSet.of(
"com",
Reported by PMD.
Line: 151
ImmutableSet.<String>builder().addAll(NON_PS).addAll(PS_NOT_RS).build();
private static final ImmutableSet<String> TOP_UNDER_REGISTRY_SUFFIX =
ImmutableSet.of("google.com", "foo.Co.uk", "foo.ca.us.");
private static final ImmutableSet<String> TOP_PRIVATE_DOMAIN =
ImmutableSet.of("google.com", "foo.Co.uk", "foo.ca.us.", "foo.blogspot.com");
private static final ImmutableSet<String> UNDER_TOP_UNDER_REGISTRY_SUFFIX =
Reported by PMD.
Line: 163
ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");
private static final ImmutableSet<String> VALID_IP_ADDRS =
ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");
private static final ImmutableSet<String> INVALID_IP_ADDRS =
ImmutableSet.of(
"", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");
Reported by PMD.
Line: 163
ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");
private static final ImmutableSet<String> VALID_IP_ADDRS =
ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");
private static final ImmutableSet<String> INVALID_IP_ADDRS =
ImmutableSet.of(
"", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");
Reported by PMD.
Line: 163
ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");
private static final ImmutableSet<String> VALID_IP_ADDRS =
ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");
private static final ImmutableSet<String> INVALID_IP_ADDRS =
ImmutableSet.of(
"", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");
Reported by PMD.
Line: 163
ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");
private static final ImmutableSet<String> VALID_IP_ADDRS =
ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");
private static final ImmutableSet<String> INVALID_IP_ADDRS =
ImmutableSet.of(
"", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");
Reported by PMD.
guava-tests/test/com/google/common/net/InternetDomainNameTest.java
179 issues
Line: 36
* @author Craig Berry
*/
@GwtCompatible(emulated = true)
public final class InternetDomainNameTest extends TestCase {
private static final InternetDomainName UNICODE_EXAMPLE =
InternetDomainName.from("j\u00f8rpeland.no");
private static final InternetDomainName PUNYCODE_EXAMPLE =
InternetDomainName.from("xn--jrpeland-54a.no");
Reported by PMD.
Line: 36
* @author Craig Berry
*/
@GwtCompatible(emulated = true)
public final class InternetDomainNameTest extends TestCase {
private static final InternetDomainName UNICODE_EXAMPLE =
InternetDomainName.from("j\u00f8rpeland.no");
private static final InternetDomainName PUNYCODE_EXAMPLE =
InternetDomainName.from("xn--jrpeland-54a.no");
Reported by PMD.
Line: 77
ImmutableSet.of(
"",
" ",
"127.0.0.1",
"::1",
"13",
"abc.12c",
"foo-.com",
"_bar.quux",
Reported by PMD.
Line: 78
"",
" ",
"127.0.0.1",
"::1",
"13",
"abc.12c",
"foo-.com",
"_bar.quux",
"foo+bar.com",
Reported by PMD.
Line: 95
"...",
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com",
"a" + DELTA + " .com",
ALMOST_TOO_MANY_LEVELS + "com",
ALMOST_TOO_LONG + ".c");
private static final ImmutableSet<String> RS =
ImmutableSet.of(
"com",
Reported by PMD.
Line: 151
ImmutableSet.<String>builder().addAll(NON_PS).addAll(PS_NOT_RS).build();
private static final ImmutableSet<String> TOP_UNDER_REGISTRY_SUFFIX =
ImmutableSet.of("google.com", "foo.Co.uk", "foo.ca.us.");
private static final ImmutableSet<String> TOP_PRIVATE_DOMAIN =
ImmutableSet.of("google.com", "foo.Co.uk", "foo.ca.us.", "foo.blogspot.com");
private static final ImmutableSet<String> UNDER_TOP_UNDER_REGISTRY_SUFFIX =
Reported by PMD.
Line: 163
ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");
private static final ImmutableSet<String> VALID_IP_ADDRS =
ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");
private static final ImmutableSet<String> INVALID_IP_ADDRS =
ImmutableSet.of(
"", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");
Reported by PMD.
Line: 163
ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");
private static final ImmutableSet<String> VALID_IP_ADDRS =
ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");
private static final ImmutableSet<String> INVALID_IP_ADDRS =
ImmutableSet.of(
"", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");
Reported by PMD.
Line: 163
ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");
private static final ImmutableSet<String> VALID_IP_ADDRS =
ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");
private static final ImmutableSet<String> INVALID_IP_ADDRS =
ImmutableSet.of(
"", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");
Reported by PMD.
Line: 163
ImmutableSet.of("foo.bar.google.com", "a.b.co.uk", "x.y.ca.us", "a.b.blogspot.com");
private static final ImmutableSet<String> VALID_IP_ADDRS =
ImmutableSet.of("1.2.3.4", "127.0.0.1", "::1", "2001:db8::1");
private static final ImmutableSet<String> INVALID_IP_ADDRS =
ImmutableSet.of(
"", "1", "1.2.3", "...", "1.2.3.4.5", "400.500.600.700", ":", ":::1", "2001:db8:");
Reported by PMD.
android/guava-tests/test/com/google/common/hash/HashCodeTest.java
177 issues
Line: 34
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashCodeTest extends TestCase {
// note: asInt(), asLong() are in little endian
private static final ImmutableList<ExpectedHashCode> expectedHashCodes =
ImmutableList.of(
new ExpectedHashCode(
new byte[] {
Reported by PMD.
Line: 34
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashCodeTest extends TestCase {
// note: asInt(), asLong() are in little endian
private static final ImmutableList<ExpectedHashCode> expectedHashCodes =
ImmutableList.of(
new ExpectedHashCode(
new byte[] {
Reported by PMD.
Line: 66
new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00},
0x0000abcd,
null,
"cdab0000"),
new ExpectedHashCode(
new byte[] {
(byte) 0xef, (byte) 0xcd, (byte) 0xab, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
},
Reported by PMD.
Line: 77
"efcdab0000000000"));
// expectedHashCodes must contain at least one hash code with 4 bytes
public void testFromInt() {
for (ExpectedHashCode expected : expectedHashCodes) {
if (expected.bytes.length == 4) {
HashCode fromInt = HashCode.fromInt(expected.asInt);
assertExpectedHashCode(expected, fromInt);
}
Reported by PMD.
Line: 79
// expectedHashCodes must contain at least one hash code with 4 bytes
public void testFromInt() {
for (ExpectedHashCode expected : expectedHashCodes) {
if (expected.bytes.length == 4) {
HashCode fromInt = HashCode.fromInt(expected.asInt);
assertExpectedHashCode(expected, fromInt);
}
}
}
Reported by PMD.
Line: 87
}
// expectedHashCodes must contain at least one hash code with 8 bytes
public void testFromLong() {
for (ExpectedHashCode expected : expectedHashCodes) {
if (expected.bytes.length == 8) {
HashCode fromLong = HashCode.fromLong(expected.asLong);
assertExpectedHashCode(expected, fromLong);
}
Reported by PMD.
Line: 89
// expectedHashCodes must contain at least one hash code with 8 bytes
public void testFromLong() {
for (ExpectedHashCode expected : expectedHashCodes) {
if (expected.bytes.length == 8) {
HashCode fromLong = HashCode.fromLong(expected.asLong);
assertExpectedHashCode(expected, fromLong);
}
}
}
Reported by PMD.
Line: 96
}
}
public void testFromBytes() {
for (ExpectedHashCode expected : expectedHashCodes) {
HashCode fromBytes = HashCode.fromBytes(expected.bytes);
assertExpectedHashCode(expected, fromBytes);
}
}
Reported by PMD.
Line: 103
}
}
public void testFromBytes_copyOccurs() {
byte[] bytes = new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00};
HashCode hashCode = HashCode.fromBytes(bytes);
int expectedInt = 0x0000abcd;
String expectedToString = "cdab0000";
Reported by PMD.
Line: 103
}
}
public void testFromBytes_copyOccurs() {
byte[] bytes = new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00};
HashCode hashCode = HashCode.fromBytes(bytes);
int expectedInt = 0x0000abcd;
String expectedToString = "cdab0000";
Reported by PMD.
guava-tests/test/com/google/common/hash/HashCodeTest.java
177 issues
Line: 34
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashCodeTest extends TestCase {
// note: asInt(), asLong() are in little endian
private static final ImmutableList<ExpectedHashCode> expectedHashCodes =
ImmutableList.of(
new ExpectedHashCode(
new byte[] {
Reported by PMD.
Line: 34
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashCodeTest extends TestCase {
// note: asInt(), asLong() are in little endian
private static final ImmutableList<ExpectedHashCode> expectedHashCodes =
ImmutableList.of(
new ExpectedHashCode(
new byte[] {
Reported by PMD.
Line: 66
new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00},
0x0000abcd,
null,
"cdab0000"),
new ExpectedHashCode(
new byte[] {
(byte) 0xef, (byte) 0xcd, (byte) 0xab, (byte) 0x00,
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
},
Reported by PMD.
Line: 77
"efcdab0000000000"));
// expectedHashCodes must contain at least one hash code with 4 bytes
public void testFromInt() {
for (ExpectedHashCode expected : expectedHashCodes) {
if (expected.bytes.length == 4) {
HashCode fromInt = HashCode.fromInt(expected.asInt);
assertExpectedHashCode(expected, fromInt);
}
Reported by PMD.
Line: 79
// expectedHashCodes must contain at least one hash code with 4 bytes
public void testFromInt() {
for (ExpectedHashCode expected : expectedHashCodes) {
if (expected.bytes.length == 4) {
HashCode fromInt = HashCode.fromInt(expected.asInt);
assertExpectedHashCode(expected, fromInt);
}
}
}
Reported by PMD.
Line: 87
}
// expectedHashCodes must contain at least one hash code with 8 bytes
public void testFromLong() {
for (ExpectedHashCode expected : expectedHashCodes) {
if (expected.bytes.length == 8) {
HashCode fromLong = HashCode.fromLong(expected.asLong);
assertExpectedHashCode(expected, fromLong);
}
Reported by PMD.
Line: 89
// expectedHashCodes must contain at least one hash code with 8 bytes
public void testFromLong() {
for (ExpectedHashCode expected : expectedHashCodes) {
if (expected.bytes.length == 8) {
HashCode fromLong = HashCode.fromLong(expected.asLong);
assertExpectedHashCode(expected, fromLong);
}
}
}
Reported by PMD.
Line: 96
}
}
public void testFromBytes() {
for (ExpectedHashCode expected : expectedHashCodes) {
HashCode fromBytes = HashCode.fromBytes(expected.bytes);
assertExpectedHashCode(expected, fromBytes);
}
}
Reported by PMD.
Line: 103
}
}
public void testFromBytes_copyOccurs() {
byte[] bytes = new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00};
HashCode hashCode = HashCode.fromBytes(bytes);
int expectedInt = 0x0000abcd;
String expectedToString = "cdab0000";
Reported by PMD.
Line: 103
}
}
public void testFromBytes_copyOccurs() {
byte[] bytes = new byte[] {(byte) 0xcd, (byte) 0xab, (byte) 0x00, (byte) 0x00};
HashCode hashCode = HashCode.fromBytes(bytes);
int expectedInt = 0x0000abcd;
String expectedToString = "cdab0000";
Reported by PMD.
android/guava-tests/test/com/google/common/io/FilesTest.java
176 issues
Line: 17
* limitations under the License.
*/
package com.google.common.io;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
Reported by PMD.
Line: 50
* @author Chris Nokleberg
*/
public class FilesTest extends IoTestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
suite.addTest(
ByteSourceTester.tests(
Reported by PMD.
Line: 50
* @author Chris Nokleberg
*/
public class FilesTest extends IoTestCase {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
suite.addTest(
ByteSourceTester.tests(
Reported by PMD.
Line: 78
return suite;
}
public void testRoundTripSources() throws Exception {
File asciiFile = getTestFile("ascii.txt");
ByteSource byteSource = Files.asByteSource(asciiFile);
assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
}
Reported by PMD.
Line: 79
}
public void testRoundTripSources() throws Exception {
File asciiFile = getTestFile("ascii.txt");
ByteSource byteSource = Files.asByteSource(asciiFile);
assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
}
public void testToByteArray() throws IOException {
Reported by PMD.
Line: 81
public void testRoundTripSources() throws Exception {
File asciiFile = getTestFile("ascii.txt");
ByteSource byteSource = Files.asByteSource(asciiFile);
assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
}
public void testToByteArray() throws IOException {
File asciiFile = getTestFile("ascii.txt");
File i18nFile = getTestFile("i18n.txt");
Reported by PMD.
Line: 81
public void testRoundTripSources() throws Exception {
File asciiFile = getTestFile("ascii.txt");
ByteSource byteSource = Files.asByteSource(asciiFile);
assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
}
public void testToByteArray() throws IOException {
File asciiFile = getTestFile("ascii.txt");
File i18nFile = getTestFile("i18n.txt");
Reported by PMD.
Line: 84
assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
}
public void testToByteArray() throws IOException {
File asciiFile = getTestFile("ascii.txt");
File i18nFile = getTestFile("i18n.txt");
assertTrue(Arrays.equals(ASCII.getBytes(Charsets.US_ASCII), Files.toByteArray(asciiFile)));
assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.toByteArray(i18nFile)));
assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.asByteSource(i18nFile).read()));
Reported by PMD.
Line: 84
assertSame(byteSource, byteSource.asCharSource(Charsets.UTF_8).asByteSource(Charsets.UTF_8));
}
public void testToByteArray() throws IOException {
File asciiFile = getTestFile("ascii.txt");
File i18nFile = getTestFile("i18n.txt");
assertTrue(Arrays.equals(ASCII.getBytes(Charsets.US_ASCII), Files.toByteArray(asciiFile)));
assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.toByteArray(i18nFile)));
assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.asByteSource(i18nFile).read()));
Reported by PMD.
Line: 86
public void testToByteArray() throws IOException {
File asciiFile = getTestFile("ascii.txt");
File i18nFile = getTestFile("i18n.txt");
assertTrue(Arrays.equals(ASCII.getBytes(Charsets.US_ASCII), Files.toByteArray(asciiFile)));
assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.toByteArray(i18nFile)));
assertTrue(Arrays.equals(I18N.getBytes(Charsets.UTF_8), Files.asByteSource(i18nFile).read()));
}
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ArrayTableTest.java
176 issues
Line: 38
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ArrayTableTest extends AbstractTableTest {
@Override
protected ArrayTable<String, Integer, Character> create(Object... data) {
// TODO: Specify different numbers of rows and columns, to detect problems
// that arise when the wrong size is used.
Reported by PMD.
Line: 38
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public class ArrayTableTest extends AbstractTableTest {
@Override
protected ArrayTable<String, Integer, Character> create(Object... data) {
// TODO: Specify different numbers of rows and columns, to detect problems
// that arise when the wrong size is used.
Reported by PMD.
Line: 45
// TODO: Specify different numbers of rows and columns, to detect problems
// that arise when the wrong size is used.
ArrayTable<String, Integer, Character> table =
ArrayTable.create(asList("foo", "bar", "cat"), asList(1, 2, 3));
populate(table, data);
return table;
}
@Override
Reported by PMD.
Line: 45
// TODO: Specify different numbers of rows and columns, to detect problems
// that arise when the wrong size is used.
ArrayTable<String, Integer, Character> table =
ArrayTable.create(asList("foo", "bar", "cat"), asList(1, 2, 3));
populate(table, data);
return table;
}
@Override
Reported by PMD.
Line: 45
// TODO: Specify different numbers of rows and columns, to detect problems
// that arise when the wrong size is used.
ArrayTable<String, Integer, Character> table =
ArrayTable.create(asList("foo", "bar", "cat"), asList(1, 2, 3));
populate(table, data);
return table;
}
@Override
Reported by PMD.
Line: 67
// Overriding tests of behavior that differs for ArrayTable.
@Override
public void testContains() {
table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
assertTrue(table.contains("foo", 1));
assertTrue(table.contains("bar", 1));
assertTrue(table.contains("foo", 3));
Reported by PMD.
Line: 68
// Overriding tests of behavior that differs for ArrayTable.
@Override
public void testContains() {
table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
assertTrue(table.contains("foo", 1));
assertTrue(table.contains("bar", 1));
assertTrue(table.contains("foo", 3));
assertTrue(table.contains("foo", 2));
Reported by PMD.
Line: 84
assertFalse(table.contains(null, null));
}
@Override
public void testContainsRow() {
table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
assertTrue(table.containsRow("foo"));
assertTrue(table.containsRow("bar"));
assertTrue(table.containsRow("cat"));
Reported by PMD.
Line: 85
}
@Override
public void testContainsRow() {
table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
assertTrue(table.containsRow("foo"));
assertTrue(table.containsRow("bar"));
assertTrue(table.containsRow("cat"));
assertFalse(table.containsRow("bad"));
Reported by PMD.
Line: 94
assertFalse(table.containsRow(null));
}
@Override
public void testContainsColumn() {
table = create("foo", 1, 'a', "bar", 1, 'b', "foo", 3, 'c');
assertTrue(table.containsColumn(1));
assertTrue(table.containsColumn(3));
assertTrue(table.containsColumn(2));
Reported by PMD.