@Test
public void getStatesApplicationFilterTest() 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"));
    ApplicationState state1 = applicationStateFactory.createNew(VALUE_FACTORY.createIRI("http://mobi.com/states/1"));
    state1.setStateResource(stateResource1);
    state1.setForUser(user);
    state1.setApplication(application);
    RepositoryConnection conn = repo.getConnection();
    conn.add(state0.getModel());
    conn.add(state0Model);
    conn.add(state1.getModel());
    conn.add(state1Model);
    Map<Resource, Model> result = manager.getStates(null, "test", new HashSet<>());
    assertEquals(1, result.size());
    assertTrue(result.containsKey(state1.getResource()));
    assertTrue(result.get(state1.getResource()).equals(state1Model));
    conn.close();
}