ActorDetailResponseToActor { public Actor map(ActorDetailResponse response){ Actor actor = new Actor(); actor.setActorId(response.getId()); actor.setProfileUrl(response.getProfilePath()); actor.setName(response.getName()); actor.setBiography(response.getBiography()); actor.setDeathDay((String) response.getDeathday()); actor.setPlaceOfBirth(defaultValueIfNull(response.getPlaceOfBirth())); actor.setPopularity(response.getPopularity()); checkAgeThenSet(response , actor); setCinemas(response , actor); setPosters(response , actor); setBackgroundPosters(response , actor); return actor; }  Actor map(ActorDetailResponse response); List<Actor> map(ActorResponse response);  }
@Test public void shouldMapId() { when(responseDetailMock.getId()).thenReturn(22); Actor actor = mapper.map(responseDetailMock); assertThat(actor.getActorId() , is(22)); }
@Test public void shouldMapListOfActor() { List<ActorNetwork> spyListOfActors = spy(new ArrayList<>()); spyListOfActors.add(new ActorNetwork()); doReturn(1).when(actorNetworkListMock).size(); doReturn(spyListOfActors).when(responseMock).getActors(); final List<Actor> actorList = mapper.map(responseMock); assertNotNull(actorList); assertFalse(actorList.isEmpty()); assertEquals(responseMock.getActors().size() , actorList.size()); }