### Question:
UserMapper implements DataMapper<User, UserDto> { @Override public Collection<User> mapDtosToEntities(Collection<UserDto> userDtos) { Collection<User> users = new ArrayList<>(); userDtos.forEach(userDto -> users.add(mapDtoToEntity(userDto))); return users; } @Autowired  UserMapper(AppEnvironment appEnvironment); @Override User mapDtoToEntity(UserDto dto); @Override UserDto mapEntityToDto(User user); @Override Collection<User> mapDtosToEntities(Collection<UserDto> userDtos); @Override Collection<UserDto> mapEntitiesToDtos(Collection<User> users);  }### Answer:
@Test public void test_mapDtosToEntities() { when(appEnvironment.getAuthMode()).thenReturn(AuthModes.AZURE); Collection<UserDto> dtos = Arrays.asList(userDto1, userDto2); Collection<User> users = userMapper.mapDtosToEntities(dtos); Assert.assertEquals(2, dtos.size()); Assert.assertEquals(dtos.size(), users.size()); Iterator<UserDto> dtoIt = dtos.iterator(); Iterator<User> userIt = users.iterator(); while (dtoIt.hasNext() && userIt.hasNext()) { assertDtoWithUser(dtoIt.next(), userIt.next()); } }