COLLECTIONS-699 more unit tests

unit tests for equals and toString of the dto entry
This commit is contained in:
Dennis Goermann 2019-05-23 18:33:20 +02:00
parent 5b342e4372
commit ba54ebc093
1 changed files with 30 additions and 0 deletions

View File

@ -220,6 +220,36 @@ public class PairingIteratorTest extends AbstractIteratorTest<Entry<String, Stri
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
public Iterator<Entry<String, String>> makeEmptyIterator() {
return new PairingIterator<String, String>(IteratorUtils.<String>emptyIterator(),