The following issues were found
guava-tests/test/com/google/common/graph/ValueGraphTest.java
224 issues
Line: 41
/** Tests for {@link StandardMutableValueGraph} and related functionality. */
// TODO(user): Expand coverage and move to proper test suite.
@RunWith(JUnit4.class)
public final class ValueGraphTest {
private static final String DEFAULT = "default";
MutableValueGraph<Integer, String> graph;
@After
Reported by PMD.
Line: 42
// TODO(user): Expand coverage and move to proper test suite.
@RunWith(JUnit4.class)
public final class ValueGraphTest {
private static final String DEFAULT = "default";
MutableValueGraph<Integer, String> graph;
@After
public void validateGraphState() {
Reported by PMD.
Line: 44
public final class ValueGraphTest {
private static final String DEFAULT = "default";
MutableValueGraph<Integer, String> graph;
@After
public void validateGraphState() {
assertStronglyEquivalent(graph, Graphs.copyOf(graph));
assertStronglyEquivalent(graph, ImmutableValueGraph.copyOf(graph));
Reported by PMD.
Line: 53
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
Reported by PMD.
Line: 53
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
Reported by PMD.
Line: 54
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
Reported by PMD.
Line: 54
Graph<Integer> asGraph = graph.asGraph();
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
Reported by PMD.
Line: 55
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
for (Integer node : graph.nodes()) {
Reported by PMD.
Line: 55
AbstractGraphTest.validateGraph(asGraph);
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
for (Integer node : graph.nodes()) {
Reported by PMD.
Line: 56
assertThat(graph.nodes()).isEqualTo(asGraph.nodes());
assertThat(graph.edges()).isEqualTo(asGraph.edges());
assertThat(graph.nodeOrder()).isEqualTo(asGraph.nodeOrder());
assertThat(graph.incidentEdgeOrder()).isEqualTo(asGraph.incidentEdgeOrder());
assertThat(graph.isDirected()).isEqualTo(asGraph.isDirected());
assertThat(graph.allowsSelfLoops()).isEqualTo(asGraph.allowsSelfLoops());
for (Integer node : graph.nodes()) {
assertThat(graph.adjacentNodes(node)).isEqualTo(asGraph.adjacentNodes(node));
Reported by PMD.
guava-tests/test/com/google/common/collect/ImmutableTableTest.java
223 issues
Line: 34
* @author Gregory Kick
*/
@GwtCompatible(emulated = true)
public class ImmutableTableTest extends AbstractTableReadTest {
@Override
protected Table<String, Integer, Character> create(Object... data) {
ImmutableTable.Builder<String, Integer, Character> builder = ImmutableTable.builder();
for (int i = 0; i < data.length; i = i + 3) {
builder.put((String) data[i], (Integer) data[i + 1], (Character) data[i + 2]);
Reported by PMD.
Line: 46
// The bulk of the toImmutableTable tests can be found in TableCollectorsTest.
// This gives minimal coverage to the forwarding functions
public void testToImmutableTableSanityTest() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue);
CollectorTester.of(collector)
.expectCollects(ImmutableTable.of())
.expectCollects(ImmutableTable.of("one", "uno", 1), Tables.immutableCell("one", "uno", 1));
Reported by PMD.
Line: 49
public void testToImmutableTableSanityTest() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue);
CollectorTester.of(collector)
.expectCollects(ImmutableTable.of())
.expectCollects(ImmutableTable.of("one", "uno", 1), Tables.immutableCell("one", "uno", 1));
}
public void testToImmutableTableMergingSanityTest() {
Reported by PMD.
Line: 49
public void testToImmutableTableSanityTest() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue);
CollectorTester.of(collector)
.expectCollects(ImmutableTable.of())
.expectCollects(ImmutableTable.of("one", "uno", 1), Tables.immutableCell("one", "uno", 1));
}
public void testToImmutableTableMergingSanityTest() {
Reported by PMD.
Line: 51
TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue);
CollectorTester.of(collector)
.expectCollects(ImmutableTable.of())
.expectCollects(ImmutableTable.of("one", "uno", 1), Tables.immutableCell("one", "uno", 1));
}
public void testToImmutableTableMergingSanityTest() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
TableCollectors.toImmutableTable(
Reported by PMD.
Line: 51
TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue);
CollectorTester.of(collector)
.expectCollects(ImmutableTable.of())
.expectCollects(ImmutableTable.of("one", "uno", 1), Tables.immutableCell("one", "uno", 1));
}
public void testToImmutableTableMergingSanityTest() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
TableCollectors.toImmutableTable(
Reported by PMD.
Line: 54
.expectCollects(ImmutableTable.of("one", "uno", 1), Tables.immutableCell("one", "uno", 1));
}
public void testToImmutableTableMergingSanityTest() {
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
TableCollectors.toImmutableTable(
Cell::getRowKey, Cell::getColumnKey, Cell::getValue, Integer::sum);
CollectorTester.of(collector)
.expectCollects(ImmutableTable.of())
Reported by PMD.
Line: 58
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
TableCollectors.toImmutableTable(
Cell::getRowKey, Cell::getColumnKey, Cell::getValue, Integer::sum);
CollectorTester.of(collector)
.expectCollects(ImmutableTable.of())
.expectCollects(
ImmutableTable.of("one", "uno", 3),
Tables.immutableCell("one", "uno", 1),
Tables.immutableCell("one", "uno", 2));
Reported by PMD.
Line: 58
Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector =
TableCollectors.toImmutableTable(
Cell::getRowKey, Cell::getColumnKey, Cell::getValue, Integer::sum);
CollectorTester.of(collector)
.expectCollects(ImmutableTable.of())
.expectCollects(
ImmutableTable.of("one", "uno", 3),
Tables.immutableCell("one", "uno", 1),
Tables.immutableCell("one", "uno", 2));
Reported by PMD.
Line: 66
Tables.immutableCell("one", "uno", 2));
}
public void testBuilder() {
ImmutableTable.Builder<Character, Integer, String> builder = new ImmutableTable.Builder<>();
assertEquals(ImmutableTable.of(), builder.build());
assertEquals(ImmutableTable.of('a', 1, "foo"), builder.put('a', 1, "foo").build());
Table<Character, Integer, String> expectedTable = HashBasedTable.create();
expectedTable.put('a', 1, "foo");
Reported by PMD.
android/guava-tests/test/com/google/common/graph/AbstractStandardUndirectedNetworkTest.java
223 issues
Line: 17
* limitations under the License.
*/
package com.google.common.graph;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.TruthJUnit.assume;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
Reported by PMD.
Line: 34
* Abstract base class for testing undirected {@link Network} implementations defined in this
* package.
*/
public abstract class AbstractStandardUndirectedNetworkTest extends AbstractNetworkTest {
private static final EndpointPair<Integer> ENDPOINTS_N1N2 = EndpointPair.ordered(N1, N2);
private static final EndpointPair<Integer> ENDPOINTS_N2N1 = EndpointPair.ordered(N2, N1);
@After
public void validateUndirectedEdges() {
Reported by PMD.
Line: 34
* Abstract base class for testing undirected {@link Network} implementations defined in this
* package.
*/
public abstract class AbstractStandardUndirectedNetworkTest extends AbstractNetworkTest {
private static final EndpointPair<Integer> ENDPOINTS_N1N2 = EndpointPair.ordered(N1, N2);
private static final EndpointPair<Integer> ENDPOINTS_N2N1 = EndpointPair.ordered(N2, N1);
@After
public void validateUndirectedEdges() {
Reported by PMD.
Line: 41
@After
public void validateUndirectedEdges() {
for (Integer node : network.nodes()) {
new EqualsTester()
.addEqualityGroup(
network.inEdges(node), network.outEdges(node), network.incidentEdges(node))
.testEquals();
new EqualsTester()
.addEqualityGroup(
Reported by PMD.
Line: 45
.addEqualityGroup(
network.inEdges(node), network.outEdges(node), network.incidentEdges(node))
.testEquals();
new EqualsTester()
.addEqualityGroup(
network.predecessors(node), network.successors(node), network.adjacentNodes(node))
.testEquals();
for (Integer adjacentNode : network.adjacentNodes(node)) {
Reported by PMD.
Line: 51
.testEquals();
for (Integer adjacentNode : network.adjacentNodes(node)) {
assertThat(network.edgesConnecting(node, adjacentNode))
.containsExactlyElementsIn(network.edgesConnecting(adjacentNode, node));
}
}
}
Reported by PMD.
Line: 66
fail(ERROR_MODIFIABLE_COLLECTION);
} catch (UnsupportedOperationException e) {
addNode(N1);
assertThat(network.nodes()).containsExactlyElementsIn(nodes);
}
}
@Override
@Test
Reported by PMD.
Line: 79
fail(ERROR_MODIFIABLE_COLLECTION);
} catch (UnsupportedOperationException e) {
addEdge(N1, N2, E12);
assertThat(network.edges()).containsExactlyElementsIn(edges);
}
}
@Override
@Test
Reported by PMD.
Line: 93
fail(ERROR_MODIFIABLE_COLLECTION);
} catch (UnsupportedOperationException e) {
addEdge(N1, N2, E12);
assertThat(network.incidentEdges(N1)).containsExactlyElementsIn(incidentEdges);
}
}
@Override
@Test
Reported by PMD.
Line: 107
fail(ERROR_MODIFIABLE_COLLECTION);
} catch (UnsupportedOperationException e) {
addEdge(N1, N2, E12);
assertThat(network.adjacentNodes(N1)).containsExactlyElementsIn(adjacentNodes);
}
}
@Override
public void adjacentEdges_checkReturnedSetMutability() {
Reported by PMD.
android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java
222 issues
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.testing.SerializableTester.reserialize;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 17
* limitations under the License.
*/
package com.google.common.collect;
import static com.google.common.testing.SerializableTester.reserialize;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.annotations.GwtCompatible;
Reported by PMD.
Line: 69
* @author Jesse Wilson
*/
@GwtCompatible(emulated = true)
public class ImmutableMapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableMapTest.class);
Reported by PMD.
Line: 71
@GwtCompatible(emulated = true)
public class ImmutableMapTest extends TestCase {
@GwtIncompatible // suite
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ImmutableMapTest.class);
suite.addTest(
Reported by PMD.
Line: 185
protected void assertMoreInvariants(Map<K, V> map) {
// TODO: can these be moved to MapInterfaceTest?
for (Entry<K, V> entry : map.entrySet()) {
assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
Reported by PMD.
Line: 188
assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString());
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
Reported by PMD.
Line: 189
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
Reported by PMD.
Line: 189
}
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
Reported by PMD.
Line: 190
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
}
Reported by PMD.
Line: 190
assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString());
assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString());
assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString());
assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString());
assertEquals(MinimalSet.from(map.entrySet()), map.entrySet());
assertEquals(Sets.newHashSet(map.keySet()), map.keySet());
}
Reported by PMD.
guava-tests/test/com/google/common/primitives/CharsTest.java
219 issues
Line: 331
testReverse(new char[] {'A', '1', 'B', '2'}, new char[] {'2', 'B', '1', 'A'});
}
private static void testReverse(char[] input, char[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Chars.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 337
assertTrue(Arrays.equals(expectedOutput, input));
}
private static void testReverse(char[] input, int fromIndex, int toIndex, char[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Chars.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 360
testSortDescending(new char[] {'A', '1', 'B', '2'}, new char[] {'B', 'A', '2', '1'});
}
private static void testSortDescending(char[] input, char[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Chars.sortDescending(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 367
}
private static void testSortDescending(
char[] input, int fromIndex, int toIndex, char[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Chars.sortDescending(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 39
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class CharsTest extends TestCase {
private static final char[] EMPTY = {};
private static final char[] ARRAY1 = {(char) 1};
private static final char[] ARRAY234 = {(char) 2, (char) 3, (char) 4};
private static final char LEAST = Character.MIN_VALUE;
Reported by PMD.
Line: 39
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class CharsTest extends TestCase {
private static final char[] EMPTY = {};
private static final char[] ARRAY1 = {(char) 1};
private static final char[] ARRAY234 = {(char) 2, (char) 3, (char) 4};
private static final char LEAST = Character.MIN_VALUE;
Reported by PMD.
Line: 49
private static final char[] VALUES = {LEAST, 'a', '\u00e0', '\udcaa', GREATEST};
public void testHashCode() {
for (char value : VALUES) {
assertEquals(((Character) value).hashCode(), Chars.hashCode(value));
}
}
Reported by PMD.
Line: 51
public void testHashCode() {
for (char value : VALUES) {
assertEquals(((Character) value).hashCode(), Chars.hashCode(value));
}
}
public void testCheckedCast() {
for (char value : VALUES) {
Reported by PMD.
Line: 55
}
}
public void testCheckedCast() {
for (char value : VALUES) {
assertEquals(value, Chars.checkedCast((long) value));
}
assertCastFails(GREATEST + 1L);
assertCastFails(LEAST - 1L);
Reported by PMD.
Line: 55
}
}
public void testCheckedCast() {
for (char value : VALUES) {
assertEquals(value, Chars.checkedCast((long) value));
}
assertCastFails(GREATEST + 1L);
assertCastFails(LEAST - 1L);
Reported by PMD.
android/guava-tests/test/com/google/common/primitives/CharsTest.java
219 issues
Line: 331
testReverse(new char[] {'A', '1', 'B', '2'}, new char[] {'2', 'B', '1', 'A'});
}
private static void testReverse(char[] input, char[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Chars.reverse(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 337
assertTrue(Arrays.equals(expectedOutput, input));
}
private static void testReverse(char[] input, int fromIndex, int toIndex, char[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Chars.reverse(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 360
testSortDescending(new char[] {'A', '1', 'B', '2'}, new char[] {'B', 'A', '2', '1'});
}
private static void testSortDescending(char[] input, char[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Chars.sortDescending(input);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 367
}
private static void testSortDescending(
char[] input, int fromIndex, int toIndex, char[] expectedOutput) {
input = Arrays.copyOf(input, input.length);
Chars.sortDescending(input, fromIndex, toIndex);
assertTrue(Arrays.equals(expectedOutput, input));
}
Reported by PMD.
Line: 39
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class CharsTest extends TestCase {
private static final char[] EMPTY = {};
private static final char[] ARRAY1 = {(char) 1};
private static final char[] ARRAY234 = {(char) 2, (char) 3, (char) 4};
private static final char LEAST = Character.MIN_VALUE;
Reported by PMD.
Line: 39
*/
@GwtCompatible(emulated = true)
@SuppressWarnings("cast") // redundant casts are intentional and harmless
public class CharsTest extends TestCase {
private static final char[] EMPTY = {};
private static final char[] ARRAY1 = {(char) 1};
private static final char[] ARRAY234 = {(char) 2, (char) 3, (char) 4};
private static final char LEAST = Character.MIN_VALUE;
Reported by PMD.
Line: 49
private static final char[] VALUES = {LEAST, 'a', '\u00e0', '\udcaa', GREATEST};
public void testHashCode() {
for (char value : VALUES) {
assertEquals(((Character) value).hashCode(), Chars.hashCode(value));
}
}
Reported by PMD.
Line: 51
public void testHashCode() {
for (char value : VALUES) {
assertEquals(((Character) value).hashCode(), Chars.hashCode(value));
}
}
public void testCheckedCast() {
for (char value : VALUES) {
Reported by PMD.
Line: 55
}
}
public void testCheckedCast() {
for (char value : VALUES) {
assertEquals(value, Chars.checkedCast((long) value));
}
assertCastFails(GREATEST + 1L);
assertCastFails(LEAST - 1L);
Reported by PMD.
Line: 55
}
}
public void testCheckedCast() {
for (char value : VALUES) {
assertEquals(value, Chars.checkedCast((long) value));
}
assertCastFails(GREATEST + 1L);
assertCastFails(LEAST - 1L);
Reported by PMD.
android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java
216 issues
Line: 44
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public abstract class AbstractImmutableSetTest extends TestCase {
protected abstract <E extends Comparable<? super E>> Set<E> of();
protected abstract <E extends Comparable<? super E>> Set<E> of(E e);
Reported by PMD.
Line: 44
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public abstract class AbstractImmutableSetTest extends TestCase {
protected abstract <E extends Comparable<? super E>> Set<E> of();
protected abstract <E extends Comparable<? super E>> Set<E> of(E e);
Reported by PMD.
Line: 73
protected abstract <E extends Comparable<? super E>> Set<E> copyOf(
Iterator<? extends E> elements);
public void testCreation_noArgs() {
Set<String> set = of();
assertEquals(Collections.<String>emptySet(), set);
assertSame(of(), set);
}
Reported by PMD.
Line: 73
protected abstract <E extends Comparable<? super E>> Set<E> copyOf(
Iterator<? extends E> elements);
public void testCreation_noArgs() {
Set<String> set = of();
assertEquals(Collections.<String>emptySet(), set);
assertSame(of(), set);
}
Reported by PMD.
Line: 75
public void testCreation_noArgs() {
Set<String> set = of();
assertEquals(Collections.<String>emptySet(), set);
assertSame(of(), set);
}
public void testCreation_oneElement() {
Set<String> set = of("a");
Reported by PMD.
Line: 76
public void testCreation_noArgs() {
Set<String> set = of();
assertEquals(Collections.<String>emptySet(), set);
assertSame(of(), set);
}
public void testCreation_oneElement() {
Set<String> set = of("a");
assertEquals(Collections.singleton("a"), set);
Reported by PMD.
Line: 79
assertSame(of(), set);
}
public void testCreation_oneElement() {
Set<String> set = of("a");
assertEquals(Collections.singleton("a"), set);
}
public void testCreation_twoElements() {
Reported by PMD.
Line: 81
public void testCreation_oneElement() {
Set<String> set = of("a");
assertEquals(Collections.singleton("a"), set);
}
public void testCreation_twoElements() {
Set<String> set = of("a", "b");
assertEquals(Sets.newHashSet("a", "b"), set);
Reported by PMD.
Line: 84
assertEquals(Collections.singleton("a"), set);
}
public void testCreation_twoElements() {
Set<String> set = of("a", "b");
assertEquals(Sets.newHashSet("a", "b"), set);
}
public void testCreation_threeElements() {
Reported by PMD.
Line: 86
public void testCreation_twoElements() {
Set<String> set = of("a", "b");
assertEquals(Sets.newHashSet("a", "b"), set);
}
public void testCreation_threeElements() {
Set<String> set = of("a", "b", "c");
assertEquals(Sets.newHashSet("a", "b", "c"), set);
Reported by PMD.
guava-tests/test/com/google/common/hash/HashingTest.java
216 issues
Line: 48
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashingTest extends TestCase {
public void testMd5() {
HashTestUtils.checkAvalanche(Hashing.md5(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
Reported by PMD.
Line: 48
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashingTest extends TestCase {
public void testMd5() {
HashTestUtils.checkAvalanche(Hashing.md5(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
Reported by PMD.
Line: 48
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashingTest extends TestCase {
public void testMd5() {
HashTestUtils.checkAvalanche(Hashing.md5(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
Reported by PMD.
Line: 49
* @author Kurt Alfred Kluever
*/
public class HashingTest extends TestCase {
public void testMd5() {
HashTestUtils.checkAvalanche(Hashing.md5(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
assertEquals("Hashing.md5()", Hashing.md5().toString());
Reported by PMD.
Line: 54
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
assertEquals("Hashing.md5()", Hashing.md5().toString());
}
public void testSha1() {
HashTestUtils.checkAvalanche(Hashing.sha1(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
Reported by PMD.
Line: 54
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
assertEquals("Hashing.md5()", Hashing.md5().toString());
}
public void testSha1() {
HashTestUtils.checkAvalanche(Hashing.sha1(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
Reported by PMD.
Line: 57
assertEquals("Hashing.md5()", Hashing.md5().toString());
}
public void testSha1() {
HashTestUtils.checkAvalanche(Hashing.sha1(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
HashTestUtils.checkNoFunnels(Hashing.sha1());
HashTestUtils.assertInvariants(Hashing.sha1());
assertEquals("Hashing.sha1()", Hashing.sha1().toString());
Reported by PMD.
Line: 62
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
HashTestUtils.checkNoFunnels(Hashing.sha1());
HashTestUtils.assertInvariants(Hashing.sha1());
assertEquals("Hashing.sha1()", Hashing.sha1().toString());
}
public void testSha256() {
HashTestUtils.checkAvalanche(Hashing.sha256(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha256());
Reported by PMD.
Line: 62
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
HashTestUtils.checkNoFunnels(Hashing.sha1());
HashTestUtils.assertInvariants(Hashing.sha1());
assertEquals("Hashing.sha1()", Hashing.sha1().toString());
}
public void testSha256() {
HashTestUtils.checkAvalanche(Hashing.sha256(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha256());
Reported by PMD.
Line: 65
assertEquals("Hashing.sha1()", Hashing.sha1().toString());
}
public void testSha256() {
HashTestUtils.checkAvalanche(Hashing.sha256(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha256());
HashTestUtils.checkNoFunnels(Hashing.sha256());
HashTestUtils.assertInvariants(Hashing.sha256());
assertEquals("Hashing.sha256()", Hashing.sha256().toString());
Reported by PMD.
guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java
216 issues
Line: 44
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public abstract class AbstractImmutableSetTest extends TestCase {
protected abstract <E extends Comparable<? super E>> Set<E> of();
protected abstract <E extends Comparable<? super E>> Set<E> of(E e);
Reported by PMD.
Line: 44
* @author Jared Levy
*/
@GwtCompatible(emulated = true)
public abstract class AbstractImmutableSetTest extends TestCase {
protected abstract <E extends Comparable<? super E>> Set<E> of();
protected abstract <E extends Comparable<? super E>> Set<E> of(E e);
Reported by PMD.
Line: 73
protected abstract <E extends Comparable<? super E>> Set<E> copyOf(
Iterator<? extends E> elements);
public void testCreation_noArgs() {
Set<String> set = of();
assertEquals(Collections.<String>emptySet(), set);
assertSame(of(), set);
}
Reported by PMD.
Line: 73
protected abstract <E extends Comparable<? super E>> Set<E> copyOf(
Iterator<? extends E> elements);
public void testCreation_noArgs() {
Set<String> set = of();
assertEquals(Collections.<String>emptySet(), set);
assertSame(of(), set);
}
Reported by PMD.
Line: 75
public void testCreation_noArgs() {
Set<String> set = of();
assertEquals(Collections.<String>emptySet(), set);
assertSame(of(), set);
}
public void testCreation_oneElement() {
Set<String> set = of("a");
Reported by PMD.
Line: 76
public void testCreation_noArgs() {
Set<String> set = of();
assertEquals(Collections.<String>emptySet(), set);
assertSame(of(), set);
}
public void testCreation_oneElement() {
Set<String> set = of("a");
assertEquals(Collections.singleton("a"), set);
Reported by PMD.
Line: 79
assertSame(of(), set);
}
public void testCreation_oneElement() {
Set<String> set = of("a");
assertEquals(Collections.singleton("a"), set);
}
public void testCreation_twoElements() {
Reported by PMD.
Line: 81
public void testCreation_oneElement() {
Set<String> set = of("a");
assertEquals(Collections.singleton("a"), set);
}
public void testCreation_twoElements() {
Set<String> set = of("a", "b");
assertEquals(Sets.newHashSet("a", "b"), set);
Reported by PMD.
Line: 84
assertEquals(Collections.singleton("a"), set);
}
public void testCreation_twoElements() {
Set<String> set = of("a", "b");
assertEquals(Sets.newHashSet("a", "b"), set);
}
public void testCreation_threeElements() {
Reported by PMD.
Line: 86
public void testCreation_twoElements() {
Set<String> set = of("a", "b");
assertEquals(Sets.newHashSet("a", "b"), set);
}
public void testCreation_threeElements() {
Set<String> set = of("a", "b", "c");
assertEquals(Sets.newHashSet("a", "b", "c"), set);
Reported by PMD.
android/guava-tests/test/com/google/common/hash/HashingTest.java
216 issues
Line: 48
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashingTest extends TestCase {
public void testMd5() {
HashTestUtils.checkAvalanche(Hashing.md5(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
Reported by PMD.
Line: 48
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashingTest extends TestCase {
public void testMd5() {
HashTestUtils.checkAvalanche(Hashing.md5(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
Reported by PMD.
Line: 48
* @author Dimitris Andreou
* @author Kurt Alfred Kluever
*/
public class HashingTest extends TestCase {
public void testMd5() {
HashTestUtils.checkAvalanche(Hashing.md5(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
Reported by PMD.
Line: 49
* @author Kurt Alfred Kluever
*/
public class HashingTest extends TestCase {
public void testMd5() {
HashTestUtils.checkAvalanche(Hashing.md5(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
assertEquals("Hashing.md5()", Hashing.md5().toString());
Reported by PMD.
Line: 54
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
assertEquals("Hashing.md5()", Hashing.md5().toString());
}
public void testSha1() {
HashTestUtils.checkAvalanche(Hashing.sha1(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
Reported by PMD.
Line: 54
HashTestUtils.checkNo2BitCharacteristics(Hashing.md5());
HashTestUtils.checkNoFunnels(Hashing.md5());
HashTestUtils.assertInvariants(Hashing.md5());
assertEquals("Hashing.md5()", Hashing.md5().toString());
}
public void testSha1() {
HashTestUtils.checkAvalanche(Hashing.sha1(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
Reported by PMD.
Line: 57
assertEquals("Hashing.md5()", Hashing.md5().toString());
}
public void testSha1() {
HashTestUtils.checkAvalanche(Hashing.sha1(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
HashTestUtils.checkNoFunnels(Hashing.sha1());
HashTestUtils.assertInvariants(Hashing.sha1());
assertEquals("Hashing.sha1()", Hashing.sha1().toString());
Reported by PMD.
Line: 62
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
HashTestUtils.checkNoFunnels(Hashing.sha1());
HashTestUtils.assertInvariants(Hashing.sha1());
assertEquals("Hashing.sha1()", Hashing.sha1().toString());
}
public void testSha256() {
HashTestUtils.checkAvalanche(Hashing.sha256(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha256());
Reported by PMD.
Line: 62
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha1());
HashTestUtils.checkNoFunnels(Hashing.sha1());
HashTestUtils.assertInvariants(Hashing.sha1());
assertEquals("Hashing.sha1()", Hashing.sha1().toString());
}
public void testSha256() {
HashTestUtils.checkAvalanche(Hashing.sha256(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha256());
Reported by PMD.
Line: 65
assertEquals("Hashing.sha1()", Hashing.sha1().toString());
}
public void testSha256() {
HashTestUtils.checkAvalanche(Hashing.sha256(), 100, 0.4);
HashTestUtils.checkNo2BitCharacteristics(Hashing.sha256());
HashTestUtils.checkNoFunnels(Hashing.sha256());
HashTestUtils.assertInvariants(Hashing.sha256());
assertEquals("Hashing.sha256()", Hashing.sha256().toString());
Reported by PMD.