I have a list of Notification's objects, its name is notifications.I map it in a HashMap:
Map<String, String> recipientByMedia = new HashMap<>();
for (Notification obj : notifications) {
recipientByMedia.put(obj.getMedia(), obj.getRecipient());
}
my notification list have tow different value for "IM" :
"IM" : "+928292929"
"IM" : "test@yahoo.com"
I know, HashMap overrides new "IM" instead oldest one. finally, I want to use this HashMap to using in "Mockoto.assertEqual" .like this:
assertEquals(recipientByMedia.get("IM"), contact.getSmsNumber());
assertEquals(recipientByMedia.get("IM"), contact.getImAddress());
one of these test will fail. how can I compare "IM" in my test? which data structure can I use instead of HashMap?