JUnit测试对象是否在数组列表中

大家好,我刚开始使用JUnit,我有一个pet和owner类,在owner类中,我目前正在尝试编写一个测试以查找某个Pet,并使用remove方法删除Pet并测试该宠物是否具有没了我在所有者中有一个方法,名为find pet,它通过ArrayList中的所有宠物进行id循环,并打印出具有匹配id的宠物

public int findPet(String petId)
    {
        int pos = -1;
        int i = 0;
        while (i < pets.size() && pos == -1)
        {
            if (pets.get(i).getPetId().equalsIgnoreCase(petId))
            {
                pos = i;
            }
            else
            {
                i++;
            }
        }
        return pos;
    }

这是我到目前为止的内容:

@Test
    public void testFindPet() {
        
        System.out.println("Testing the FindPet() method");
        Owner o1 = new Owner("OID57","John"); 
        o1.addPet("PID01","dog","bowwow",4); 
        o1.addPet("PID02","dog","shep",6); 
        o1.addPet("PID03","cat","meow",4); 
        o1.addPet("PID04","snake","wally",2);
        
        o1.removePet("PID01");
   
    }

那么,有人能帮助我找出如何编写测试以寻找宠物的方法吗?