@Test public void testAddAllProducers() throws Exception { Collection<Responsible> toAdd = new HashSet<>(); toAdd.add(RESPONSIBLE_FACTORY.getNext()); toAdd.add(RESPONSIBLE_FACTORY.getNext()); toAdd.add(RESPONSIBLE_FACTORY.getNext()); producers.addAll(toAdd); entity.addAllProducers(toAdd); assertEquals(producers, entity.getProducers()); }
@Test public void testAddAllActors() throws Exception { Collection<Role> toAdd = new HashSet<>(); toAdd.add(ROLE_FACTORY.getNext()); toAdd.add(ROLE_FACTORY.getNext()); toAdd.add(ROLE_FACTORY.getNext()); actors.addAll(toAdd); entity.addAllActors(toAdd); assertEquals(actors, entity.getActors()); }
@Test public void testAddAllScenarists() throws Exception { Collection<Responsible> toAdd = new HashSet<>(); toAdd.add(RESPONSIBLE_FACTORY.getNext()); toAdd.add(RESPONSIBLE_FACTORY.getNext()); toAdd.add(RESPONSIBLE_FACTORY.getNext()); scenarists.addAll(toAdd); entity.addAllScenarists(toAdd); assertEquals(scenarists, entity.getScenarists()); }
@Override public Person getNext(boolean withLink) { Person.Builder builder = Person.builder().from(RESPONSIBLE_FACTORY.getNext(withLink)); if (withLink) { builder.addRole(ROLE_FACTORY.getNext(false)).addRole(ROLE_FACTORY.getNext(false)); } index += 1; return builder.build(); }
@Override public SerieSeason getNext(boolean withLink) { SerieSeason.Builder builder = SerieSeason.builder().from(BASE_MEDIA_FACTORY.getNew(withLink)).setSeasonNumber(index); if (withLink) { builder .setSerie(SERIE_FACTORY.getNext()) .addEpisode(EPISODE_SERIE_FACTORY.getNext()) .addEpisode(EPISODE_SERIE_FACTORY.getNext()); } index += 1; return builder.build(); }
@Test public void testDifferentSeason() throws Exception { EpisodeSerie entity = getEntity(); EpisodeSerie copy = new EpisodeSerie(entity); entity.setSeason(SERIE_SEASON_FACTORY.getNext()); assertNotEquals(entity, copy); }
@Test public void testAddProducer() throws Exception { Responsible toAdd = RESPONSIBLE_FACTORY.getNext(); producers.add(toAdd); entity.addProducer(toAdd); assertEquals(producers, entity.getProducers()); }
@Test public void testAddActor() throws Exception { Role toAdd = ROLE_FACTORY.getNext(); actors.add(toAdd); entity.addActor(toAdd); assertEquals(actors, entity.getActors()); }
@Test public void testAddOtherStaffMember() throws Exception { Responsible toAdd = RESPONSIBLE_FACTORY.getNext(); otherStaffMembers.add(toAdd); entity.addOtherStaffMember(toAdd); assertEquals(otherStaffMembers, entity.getOtherStaffMembers()); }
@Test public void testAddScenarist() throws Exception { Responsible toAdd = RESPONSIBLE_FACTORY.getNext(); scenarists.add(toAdd); entity.addScenarist(toAdd); assertEquals(scenarists, entity.getScenarists()); }
@Test public void testAddDirector() throws Exception { Responsible toAdd = RESPONSIBLE_FACTORY.getNext(); directors.add(toAdd); entity.addDirector(toAdd); assertEquals(directors, entity.getDirectors()); }
@Before public void setUp() throws Exception { entity = FACTORY.getNext(); actors = entity.getActors(); producers = entity.getProducers(); directors = entity.getDirectors(); composers = entity.getComposers(); scenarists = entity.getScenarists(); otherStaffMembers = entity.getOtherStaffMembers(); }
@Test public void testRemoveAllProducers() throws Exception { Responsible base = RESPONSIBLE_FACTORY.getNext(); Responsible second = RESPONSIBLE_FACTORY.getNext(); Responsible third = RESPONSIBLE_FACTORY.getNext(); Collection<Responsible> toAdd = new HashSet<>(); toAdd.add(base); toAdd.add(second); toAdd.add(third); Collection<Responsible> toRemove = new HashSet<>(); toRemove.add(second); toRemove.add(third); producers.addAll(toAdd); entity.addAllProducers(toAdd); producers.removeAll(toRemove); entity.removeAllProducers(toRemove); assertEquals(producers, entity.getProducers()); }
@Test public void testRemoveAllActors() throws Exception { Role base = ROLE_FACTORY.getNext(); Role second = ROLE_FACTORY.getNext(); Role third = ROLE_FACTORY.getNext(); Collection<Role> toAdd = new HashSet<>(); toAdd.add(base); toAdd.add(second); toAdd.add(third); Collection<Role> toRemove = new HashSet<>(); toRemove.add(second); toRemove.add(third); actors.addAll(toAdd); entity.addAllActors(toAdd); actors.removeAll(toRemove); entity.removeAllActors(toRemove); assertEquals(actors, entity.getActors()); }
@Test public void testGetActorsForRole() throws Exception { Role role = ROLE_FACTORY.getNext(); entity.addActor(role); assertTrue(entity.getActorsForRole(role.getRole()).contains(role.getActor())); }
@Override protected BookSerie getNewData() { return FACTORY.getNext(); }