@Test
public void testUpdateUser() {

    User newUser = userFactory.createNew(VALUE_FACTORY.createIRI(userId));
    newUser.setPassword(VALUE_FACTORY.createLiteral("123"));
    newUser.setUsername(VALUE_FACTORY.createLiteral("user"));
    engine.updateUser(newUser);
    Model userModel = MODEL_FACTORY.createModel();
    RepositoryConnection connection = repo.getConnection();
    RepositoryResult<Statement> statements = connection.getStatements(VALUE_FACTORY.createIRI(userId), null, null);
    statements.forEach(userModel::add);
    connection.close();
    assertFalse(userModel.isEmpty());
    Optional<User> optUser = userFactory.getExisting(VALUE_FACTORY.createIRI(userId), userModel);
    assertTrue(optUser.isPresent());
    User savedUser = optUser.get();
    assertTrue(savedUser.getPassword().isPresent() && savedUser.getPassword().get().stringValue().equals("123"));
    assertTrue(savedUser.getUsername().isPresent() && savedUser.getUsername().get().stringValue().equals("user"));
}