@Test
public void storeStateTest() throws Exception {

    // Setup:
    Model newState = MODEL_FACTORY.createModel();
    newState.add(VALUE_FACTORY.createIRI("http://example.com/example"), VALUE_FACTORY.createIRI(DCTERMS.TITLE.stringValue()), VALUE_FACTORY.createLiteral("Title"));
    Resource result = manager.storeState(newState, "test");
    verify(engineManager, times(1)).retrieveUser(eq("test"));
    RepositoryConnection conn = repo.getConnection();
    Model stateModel = MODEL_FACTORY.createModel();
    conn.getStatements(result, null, null).forEach(stateModel::add);
    assertFalse(stateModel.isEmpty());
    assertTrue(stateModel.contains(result, VALUE_FACTORY.createIRI(RDF.TYPE.stringValue()), VALUE_FACTORY.createIRI(State.TYPE)));
    assertTrue(stateModel.contains(result, VALUE_FACTORY.createIRI(State.forUser_IRI), user.getResource()));
    newState.forEach(statement -> {
        assertTrue(stateModel.contains(result, VALUE_FACTORY.createIRI(State.stateResource_IRI), statement.getSubject()));
        assertTrue(conn.getStatements(statement.getSubject(), statement.getPredicate(), statement.getObject()).hasNext());
    });
    conn.close();
}