@SuppressWarnings("unchecked")
@Test(expected=InternalServerErrorException.class)
public void testModifyInternalServerError() throws Exception {

    AdminUserResource resource = new AdminUserResource();
    // Inject OSGi services into the resource
    UkelonnServiceProvider ukelonn = new UkelonnServiceProvider();
    resource.ukelonn = ukelonn;
    UserManagementServiceProvider useradmin = new UserManagementServiceProvider();
    resource.useradmin = useradmin;
    MockLogService logservice = new MockLogService();
    resource.logservice = logservice;
    useradmin.setLogservice(logservice);
    // Create a mock datasource that throws exceptions and inject the datasource
    DataSource datasource = mock(DataSource.class);
    Connection connection = mock(Connection.class);
    when(datasource.getConnection()).thenReturn(connection);
    PreparedStatement statement = mock(PreparedStatement.class);
    when(connection.prepareStatement(anyString())).thenReturn(statement);
    when(statement.executeUpdate()).thenThrow(SQLException.class);
    useradmin.setDataSource(datasource);
    // Create a user bean
    User user = new User();
    // Save the modification
    resource.modify(user);
    // Verify that the update fails
    fail("Should never get here!");
}