### Question:
ChangePasswordMapper implements DataMapper<ChangePasswordData, ChangePasswordDto> { @Override public Collection<ChangePasswordData> mapDtosToEntities(Collection<ChangePasswordDto> input) { Collection<ChangePasswordData> changePasswordDataSets = new ArrayList<>(); input.forEach( changePasswordDto -> changePasswordDataSets.add(mapDtoToEntity(changePasswordDto))); return changePasswordDataSets; }  @Override ChangePasswordData mapDtoToEntity(ChangePasswordDto changePasswordDto); @Override ChangePasswordDto mapEntityToDto(ChangePasswordData changePasswordData); @Override Collection<ChangePasswordData> mapDtosToEntities(Collection<ChangePasswordDto> input); @Override Collection<ChangePasswordDto> mapEntitiesToDtos(
      Collection<ChangePasswordData> changePasswordDataSets);  }### Answer:
@Test public void mapDtosToEntities_expectAllMapped() { ArrayList<ChangePasswordDto> dtoList = new ArrayList<>(); ChangePasswordDto changePasswordDto1 = new ChangePasswordDto(); changePasswordDto1.setNewPassword("newPassword1"); changePasswordDto1.setOldPassword("oldPassword1"); changePasswordDto1.setEmail("e@mail1"); dtoList.add(changePasswordDto1); ChangePasswordDto changePasswordDto2 = new ChangePasswordDto(); changePasswordDto2.setNewPassword("newPassword2"); changePasswordDto2.setOldPassword("oldPassword2"); changePasswordDto2.setEmail("e@mail2"); dtoList.add(changePasswordDto2); ChangePasswordDto changePasswordDto3 = new ChangePasswordDto(); changePasswordDto3.setNewPassword("newPassword3"); changePasswordDto3.setOldPassword("oldPassword3"); changePasswordDto3.setEmail("e@mail3"); dtoList.add(changePasswordDto3); ArrayList<ChangePasswordData> dataList = (ArrayList<ChangePasswordData>) this.changePasswordMapper.mapDtosToEntities(dtoList); assertEquals(3, dtoList.size()); assertEquals(dtoList.size(), dataList.size()); for (int i = 0; i < dataList.size(); i++) { assertEnitityMappedCorrectly(dtoList.get(i), dataList.get(i)); } }
@Test public void mapDtosToEntities_expectOutputToBeEmpty() { ArrayList<ChangePasswordDto> dtoList = new ArrayList<>(); ArrayList<ChangePasswordData> dataList = (ArrayList<ChangePasswordData>) this.changePasswordMapper.mapDtosToEntities(dtoList); assertTrue(dataList.isEmpty()); }