BAEL-2514 - Removed unit tests for orElse cases removed from tutorial
This commit is contained in:
parent
a079636e79
commit
bed05a4289
@ -46,28 +46,6 @@ public class StreamMapUnitTest {
|
|||||||
assertEquals(false, optionalIsbn.isPresent());
|
assertEquals(false, optionalIsbn.isPresent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenStringVersionCalledForExistingTitle_thenReturnISBN() {
|
|
||||||
String isbn = books.entrySet().stream()
|
|
||||||
.filter(e -> "Effective Java".equals(e.getValue()))
|
|
||||||
.map(Map.Entry::getKey)
|
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
assertEquals("978-0134685991", isbn);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenStringVersionCalledForNonExistingTitle_thenReturnNull() {
|
|
||||||
String isbn = books.entrySet().stream()
|
|
||||||
.filter(e -> "Non Existent Title".equals(e.getValue()))
|
|
||||||
.map(Map.Entry::getKey)
|
|
||||||
.findFirst()
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
assertEquals(null, isbn);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenMultipleResultsVersionCalledForExistingTitle_aCollectionWithMultipleValuesIsReturned() {
|
public void whenMultipleResultsVersionCalledForExistingTitle_aCollectionWithMultipleValuesIsReturned() {
|
||||||
books.put("978-0321356680", "Effective Java: Second Edition");
|
books.put("978-0321356680", "Effective Java: Second Edition");
|
||||||
@ -100,8 +78,6 @@ public class StreamMapUnitTest {
|
|||||||
assertEquals(2, titlesForKeyPattern.size());
|
assertEquals(2, titlesForKeyPattern.size());
|
||||||
assertTrue(titlesForKeyPattern.contains("Design patterns : elements of reusable object-oriented software"));
|
assertTrue(titlesForKeyPattern.contains("Design patterns : elements of reusable object-oriented software"));
|
||||||
assertTrue(titlesForKeyPattern.contains("Effective Java"));
|
assertTrue(titlesForKeyPattern.contains("Effective Java"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user