@Test public void updateInvalidStateFailTest() { LocationHelper locationHelper = new LocationHelper(US_CODE, "FAKE", CITY_NAME); CandidateInfoHelper infoHelper = new CandidateInfoHelper(); infoHelper.firstName = FIRST_NAME; infoHelper.lastName = LAST_NAME; infoHelper.summary = SUMMARY; infoHelper.location = locationHelper; expectedEx.expect(BusinessValidationException.class); expectedEx.expectMessage("Can't find state"); candidateService.update(user, infoHelper); }
@Test public void updateStateRequiredFOrUsFailTest() { LocationHelper locationHelper = new LocationHelper(US_CODE, null, CITY_NAME); CandidateInfoHelper infoHelper = new CandidateInfoHelper(); infoHelper.firstName = FIRST_NAME; infoHelper.lastName = LAST_NAME; infoHelper.summary = SUMMARY; infoHelper.location = locationHelper; expectedEx.expect(BusinessValidationException.class); expectedEx.expectMessage("StateModel should be specified"); candidateService.update(user, infoHelper); }
@Test public void updateSuccessTest() { LocationHelper locationHelper = new LocationHelper(COUNTRY_CODE, null, CITY_NAME); CandidateInfoHelper infoHelper = new CandidateInfoHelper(); infoHelper.firstName = FIRST_NAME; infoHelper.lastName = LAST_NAME; infoHelper.summary = SUMMARY; infoHelper.location = locationHelper; UserModel updatedUser = candidateService.update(user, infoHelper); assertThat(updatedUser.candidate.firstName).isEqualTo(FIRST_NAME); assertThat(updatedUser.candidate.lastName).isEqualTo(LAST_NAME); assertThat(updatedUser.candidate.summary).isEqualTo(SUMMARY); assertThat(updatedUser.candidate.cityName).isEqualTo(CITY_NAME); assertThat(updatedUser.candidate.countryCode).isEqualTo(COUNTRY_CODE); }