use of com.ctrip.framework.apollo.portal.util.checker.CheckResult in project apollo by ctripcorp.
the class UserInfoControllerTest method testCreateOrUpdateUserFailed.
@Test(expected = BadRequestException.class)
public void testCreateOrUpdateUserFailed() {
UserPO user = new UserPO();
user.setUsername("username");
user.setPassword("password");
String msg = "fake error message";
Mockito.when(userPasswordChecker.checkWeakPassword(Mockito.anyString())).thenReturn(new CheckResult(Boolean.FALSE, msg));
try {
userInfoController.createOrUpdateUser(user);
} catch (BadRequestException e) {
Assert.assertEquals(msg, e.getMessage());
throw e;
}
}
Aggregations