### Question:
QueryUtils { public static Model getModelFromRepo(Repository repository, String sparqlQuery) { Objects.requireNonNull(repository, REPOSITORY_MSG); Objects.requireNonNull(repository, SPARQL_QUERY_MSG); return Repositories.graphQuery( repository, sparqlQuery, QueryResults::asModel ); } private  QueryUtils(); static Model getModelFromRepo(Repository repository, String sparqlQuery); static Model getModelFromRepo(Repository repository, Resource... contexts);  }### Answer:
@Test public void modelGetter_givenSparqlQuery_ShouldReturnAllCorrespondingStatements() { String sparqlQuery = "" + "CONSTRUCT {" + " ?s <http: + " ?s <http: + "} " + "FROM NAMED <http: + "WHERE { " + " GRAPH ?g { " + " ?s <http: + " ?s <http: + " } " + "}"; Model model = QueryUtils.getModelFromRepo(repo, sparqlQuery); assertThat( "All statements corresponding to sparql query should be loaded", model, hasSize(2) ); }
@Test public void modelGetter_givenSpecifiContexts_shouldLoadAllStatementsInRepo() { Model model = QueryUtils.getModelFromRepo(repo); assertThat( String.format("The in-memory store should contain %s statemtents", REPO_CONTEXTS_NR_STATEMENTS), model, hasSize(REPO_CONTEXTS_NR_STATEMENTS) ); }
@Test public void modelGetter_givenNoContext_shouldReturnAllStatementsInContexts() { Model model = QueryUtils.getModelFromRepo( repo, VF.createIRI(CONTEXT_A), VF.createIRI(CONTEXT_C) ); assertThat( String.format("The in-memory store should contain %s statemtents", REPO_CONTEXT_A_NR_STATEMENTS + REPO_CONTEXT_C_NR_STATEMENTS), model, hasSize(REPO_CONTEXT_A_NR_STATEMENTS + REPO_CONTEXT_C_NR_STATEMENTS) ); }
@Test public void modelGetter_givenSingleContext_shouldLoadAllStatementsOfContext() { Model model = QueryUtils.getModelFromRepo(repo, VF.createIRI(CONTEXT_A)); assertThat( String.format("The in-memory store should contain %s statemtents", REPO_CONTEXT_A_NR_STATEMENTS), model, hasSize(REPO_CONTEXT_A_NR_STATEMENTS) ); }