I need to make unit testing for a Java method, and I have a Set like this:
Set<CreditCard> creditCard = ...
And I need to test if an element of this Set is equal with a specific value. It is very easy to do that if creditCard is an ArrayList, I can do something like this:
assertEquals(creditCard.get(0).getCreditCardBalance(), CREDIT_CARD_BALANCE);
But unfortunately this is a Set and not an ArrayList. How can I test this? Thank you!