### Question:
WarehouseUser { public static WarehouseUser createWithProfile(final Account profile, final WarehouseUserRole role) { notNull(role, "role cannot be null"); notNull(profile, "profile cannot be null"); return new WarehouseUser(role.getRoleName(), profile.getId(), null); } WarehouseUser(final String role, final String profile, final String login); @JsonCreator  WarehouseUser(@JsonProperty("role") String role, @JsonProperty("profile") String profile,
                         @JsonProperty("login") String login, @JsonProperty("links") Map<String, String> links); static WarehouseUser createWithProfileUri(final String profileUri, final WarehouseUserRole role); static WarehouseUser createWithProfile(final Account profile, final WarehouseUserRole role); static WarehouseUser createWithlogin(final String login, final WarehouseUserRole role); String getRole(); String getProfile(); String getLogin(); Map<String, String> getLinks(); @JsonIgnore String getId(); @JsonIgnore String getUri(); @Override String toString(); static final String URI; }### Answer:
@Test(expectedExceptions = IllegalArgumentException.class) public void testCreateWithProfileWithNullRole() throws Exception { final Account account = readObjectFromResource("/account/account.json", Account.class); WarehouseUser.createWithProfile(account, null); }
@Test public void testCreateWithProfile() throws Exception { final Account account = readObjectFromResource("/account/account.json", Account.class); final WarehouseUser user = WarehouseUser.createWithProfile(account, WarehouseUserRole.ADMIN); assertThat(user.getRole(), is(WarehouseUserRole.ADMIN.getRoleName())); assertThat(user.getProfile(), is(account.getId())); assertThat(user.getLogin(), nullValue()); }