AbstractResultSet implements ResultSet { public static ResultSet createResultSet(QueryResult<OWLObject> result, Statement statement, String query) { if (isAskQuery(query)) { return new AskResultSet(result, statement); } else { return new SelectResultSet(result, statement); } } protected  AbstractResultSet(Statement statement); @Override Statement getStatement(); @Override void close(); @Override boolean isOpen(); @Override void registerObserver(Observer observer); static ResultSet createResultSet(QueryResult<OWLObject> result, Statement statement, String query);  }
@Test void createResultSetReturnAskResultSetForAskQuery() { final QueryResult<OWLObject> qr = mock(QueryResult.class); final ResultSet result = AbstractResultSet.createResultSet(qr, statement, ASK_QUERY); assertTrue(result instanceof AskResultSet); }
@Test void createResultSetReturnSelectResultSetForSelectQuery() { final QueryResult<OWLObject> qr = initSelectResult(); final ResultSet result = AbstractResultSet.createResultSet(qr, statement, SELECT_QUERY); assertTrue(result instanceof SelectResultSet); }