nhojpatrick commented on a change in pull request #281:
URL:
https://github.com/apache/commons-collections/pull/281#discussion_r818408886
##########
File path:
src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java
##########
@@ -243,28 +242,26 @@ public void testPrefixMap() {
map = trie.prefixMap("Ab");
Assertions.assertTrue(map.isEmpty());
Assertions.assertEquals(0, map.size());
- try {
- final Object o = map.firstKey();
- Assertions.fail("got a first key: " + o);
- } catch(final NoSuchElementException nsee) {}
- try {
- final Object o = map.lastKey();
- Assertions.fail("got a last key: " + o);
- } catch(final NoSuchElementException nsee) {}
+
+ final SortedMap<String, String> map1 = map;
+ Assertions.assertThrows(NoSuchElementException.class, () ->
map1.firstKey());
+
+ final SortedMap<String, String> map2 = map;
+ Assertions.assertThrows(NoSuchElementException.class, () ->
map2.lastKey());
+
iterator = map.values().iterator();
Assertions.assertFalse(iterator.hasNext());
map = trie.prefixMap("Albertooo");
Assertions.assertTrue(map.isEmpty());
Assertions.assertEquals(0, map.size());
- try {
- final Object o = map.firstKey();
- Assertions.fail("got a first key: " + o);
- } catch(final NoSuchElementException nsee) {}
- try {
- final Object o = map.lastKey();
- Assertions.fail("got a last key: " + o);
- } catch(final NoSuchElementException nsee) {}
+
+ final SortedMap<String, String> map3 = map;
+ Assertions.assertThrows(NoSuchElementException.class, () ->
map3.firstKey());
+
+ final SortedMap<String, String> map4 = map;
+ Assertions.assertThrows(NoSuchElementException.class, () ->
map4.lastKey());
Review comment:
done, in next push
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]