@Test
public void getStatesUserFilterTest() throws Exception {

    // Setup:
    Model state0Model = MODEL_FACTORY.createModel();
    state0Model.add(VALUE_FACTORY.createIRI("http://example.com/example/0"), VALUE_FACTORY.createIRI(DCTERMS.TITLE.stringValue()), VALUE_FACTORY.createLiteral("Title"));
    State state0 = stateFactory.createNew(VALUE_FACTORY.createIRI("http://mobi.com/states/0"));
    state0.setStateResource(stateResource0);
    state0.setForUser(user);
    Model state1Model = MODEL_FACTORY.createModel();
    state1Model.add(VALUE_FACTORY.createIRI("http://example.com/example/1"), VALUE_FACTORY.createIRI(DCTERMS.TITLE.stringValue()), VALUE_FACTORY.createLiteral("Title"));
    State state1 = stateFactory.createNew(VALUE_FACTORY.createIRI("http://mobi.com/states/1"));
    state1.setStateResource(stateResource1);
    state1.setForUser(userFactory.createNew(VALUE_FACTORY.createIRI("http://mobi.com/users/test1")));
    RepositoryConnection conn = repo.getConnection();
    conn.add(state0.getModel());
    conn.add(state0Model);
    conn.add(state1.getModel());
    conn.add(state1Model);
    Map<Resource, Model> result = manager.getStates("test", null, new HashSet<>());
    assertEquals(1, result.size());
    assertTrue(result.containsKey(state0.getResource()));
    assertTrue(result.get(state0.getResource()).equals(state0Model));
    conn.close();
}