@Test public void testConvertFrom() throws Exception { UserResource userResource = new UserResource(); userResource.setRoles(Arrays.asList(1, 2)); User user = mapper.map(userResource, User.class); List<Integer> roles = new ArrayList<>(); for (Role role : user.getRoles()) { roles.add(role.getId()); } Collections.sort(roles); assertThat(roles, is(userResource.getRoles())); }
@Override public Role convertFrom(Integer source, Role destination) { if (source == null) { return null; } return new Role(source); }
RoleToRoleIdConverter extends DozerConverter<Role, Integer> { @Override public Role convertFrom(Integer source, Role destination) { if (source == null) { return null; } return new Role(source); } }
RoleToRoleIdConverter extends DozerConverter<Role, Integer> { @Override public Role convertFrom(Integer source, Role destination) { if (source == null) { return null; } return new Role(source); } RoleToRoleIdConverter(); }
RoleToRoleIdConverter extends DozerConverter<Role, Integer> { @Override public Role convertFrom(Integer source, Role destination) { if (source == null) { return null; } return new Role(source); } RoleToRoleIdConverter(); @Override Integer convertTo(Role source, Integer destination); @Override Role convertFrom(Integer source, Role destination); }
RoleToRoleIdConverter extends DozerConverter<Role, Integer> { @Override public Role convertFrom(Integer source, Role destination) { if (source == null) { return null; } return new Role(source); } RoleToRoleIdConverter(); @Override Integer convertTo(Role source, Integer destination); @Override Role convertFrom(Integer source, Role destination);  }