use of org.pentaho.platform.security.userroledao.ws.UserRoleWebService in project pentaho-platform by pentaho.
the class UserRoleWebServiceBase method testCreateDuplicateUser.
@Test
public void testCreateDuplicateUser() throws UserRoleException {
UserRoleDaoMock userRoleDao = Mockito.mock(UserRoleDaoMock.class);
Mockito.doThrow(new AlreadyExistsException("That user name already exists.")).when(userRoleDao).createUser(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
UserRoleWebService userRoleWebService = new UserRoleWebService() {
@Override
protected IUserRoleDao getDao() throws UserRoleException {
return userRoleDao;
}
};
ProxyPentahoUser proxyPentahoUser = new ProxyPentahoUser();
proxyPentahoUser.setName("test");
proxyPentahoUser.setEnabled(true);
proxyPentahoUser.setPassword("test");
proxyPentahoUser.setDescription("testing");
try {
userRoleWebService.createUser(proxyPentahoUser);
Assert.fail();
} catch (AlreadyExistsException e) {
Assert.assertEquals(0, e.getStackTrace().length);
}
}
Aggregations