mirror of
https://gitee.com/dromara/hutool.git
synced 2025-11-24 08:33:22 +08:00
add test
This commit is contained in:
@@ -1139,6 +1139,22 @@ public class CollUtilTest {
|
||||
assertEquals("3", CollUtil.getFirst(deque));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getFirstTestWithPredicateTest(){
|
||||
Animal dog = new Animal("dog", 2);
|
||||
Animal cat = new Animal("cat", 3);
|
||||
Animal bear = new Animal("bear", 4);
|
||||
|
||||
List<Animal> list = new ArrayList<>();
|
||||
list.add(dog);
|
||||
list.add(cat);
|
||||
list.add(bear);
|
||||
|
||||
final Animal cat1 = CollUtil.getFirst(list, (t) -> t.getName().equals("cat"));
|
||||
assertNotNull(cat1);
|
||||
assertEquals("cat", cat1.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void popPartTest() {
|
||||
final Stack<Integer> stack = new Stack<>();
|
||||
|
||||
Reference in New Issue
Block a user