COLLECTIONS-699 more unit tests
unit tests for equals and toString of the dto entry
This commit is contained in:
parent
5b342e4372
commit
ba54ebc093
|
@ -220,6 +220,36 @@ public class PairingIteratorTest extends AbstractIteratorTest<Entry<String, Stri
|
||||||
Assert.assertEquals(entry1, entry1);
|
Assert.assertEquals(entry1, entry1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEntryEquals_null() {
|
||||||
|
final String firstValue = "A";
|
||||||
|
final String secondValue = "A";
|
||||||
|
final Entry<String, String> entry1 = new Entry<>(firstValue, secondValue);
|
||||||
|
|
||||||
|
Assert.assertNotEquals(entry1, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEntryEquals_differentClasses() {
|
||||||
|
final String firstValue = "A";
|
||||||
|
final String secondValue = "A";
|
||||||
|
final Entry<String, String> entry1 = new Entry<>(firstValue, secondValue);
|
||||||
|
|
||||||
|
Assert.assertNotEquals(entry1, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEntryToString() {
|
||||||
|
final String firstValue = "A";
|
||||||
|
final String secondValue = "A";
|
||||||
|
final Entry<String, String> entry = new Entry<>(firstValue, secondValue);
|
||||||
|
|
||||||
|
String string = entry.toString();
|
||||||
|
Assert.assertTrue(string.contains(firstValue));
|
||||||
|
Assert.assertTrue(string.contains(secondValue));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<Entry<String, String>> makeEmptyIterator() {
|
public Iterator<Entry<String, String>> makeEmptyIterator() {
|
||||||
return new PairingIterator<String, String>(IteratorUtils.<String>emptyIterator(),
|
return new PairingIterator<String, String>(IteratorUtils.<String>emptyIterator(),
|
||||||
|
|
Loading…
Reference in New Issue