}
}
@Test
public void testGet(){
GenreCollection collection = new GenreCollectionImpl();
Genre genreMock1 = EasyMock.createMock(Genre.class);
Genre genreMock2 = EasyMock.createMock(Genre.class);
EasyMock.expect(genreMock1.getName()).andReturn("Genre1").times(2, 3); // times is 2 or 3, because we do not know the sorting inside the Set
EasyMock.expect(genreMock1.getId()).andReturn(1).times(2, 3);
EasyMock.expect(genreMock2.getName()).andReturn("Genre2").times(2, 3);
EasyMock.expect(genreMock2.getId()).andReturn(2).times(2, 3);
EasyMock.replay(genreMock1, genreMock2);
collection.add(genreMock1);
collection.add(genreMock2);
assertEquals(genreMock1, collection.get("Genre1"));
assertEquals(genreMock1, collection.get(1));
assertEquals(genreMock2, collection.get("Genre2"));
assertEquals(genreMock2, collection.get(2));
assertEquals(null, collection.get("Unkown Genre"));
assertEquals(null, collection.get(3));
EasyMock.verify(genreMock1, genreMock2);
}