SelectResultSet extends AbstractResultSet { @Override public Object getObject(int variableIndex) { ensureState(); assert current != null; return toObject(getCurrent(getVariableAt(variableIndex))); } SelectResultSet(QueryExecution execution, ResultSet jenaResult); @Override int findColumn(String variableName); @Override int getColumnCount(); @Override boolean isBound(int variableIndex); @Override boolean isBound(String variableName); @Override boolean getBoolean(int variableIndex); @Override boolean getBoolean(String variableName); @Override byte getByte(int variableIndex); @Override byte getByte(String variableName); @Override double getDouble(int variableIndex); @Override double getDouble(String variableName); @Override float getFloat(int variableIndex); @Override float getFloat(String variableName); @Override int getInt(int variableIndex); @Override int getInt(String variableName); @Override long getLong(int variableIndex); @Override long getLong(String variableName); @Override Object getObject(int variableIndex); @Override Object getObject(String variableName); @Override T getObject(int variableIndex, Class<T> cls); @Override T getObject(String variableName, Class<T> cls); @Override short getShort(int variableIndex); @Override short getShort(String variableName); @Override String getString(int variableIndex); @Override String getString(String variableName); @Override boolean hasNext(); @Override void next(); @Override void close();  }
@Test void getObjectByIndexReturnsLiteralValue() { saveValueAndExecuteQuery(117); final Object result = selectResult.getObject(2); assertTrue(result instanceof Integer); assertEquals(117, result); }
@Test void getObjectByVariableReturnsLiteralValue() { saveValueAndExecuteQuery(117); final Object result = selectResult.getObject("z"); assertTrue(result instanceof Integer); assertEquals(117, result); }
@Test void getObjectByIndexAndClassReturnsLiteralValueWhenItCanBeCastToExpectedClass() throws JenaDriverException { saveValueAndExecuteQuery(117); final Integer result = selectResult.getObject(2, Integer.class); assertNotNull(result); assertEquals(117, result.intValue()); }
@Test void getObjectByIndexUsesConstructorWithJenaBasedParameterToBuildResult() throws JenaDriverException { saveValueAndExecuteQuery(117); final ResultJenaBased result = selectResult.getObject(2, ResultJenaBased.class); assertEquals(117, result.value); }
@Test void getObjectByVariableAndClassRetrievesValueAsCorrectType() throws JenaDriverException { saveValueAndExecuteQuery(117); final ResultJenaBased result = selectResult.getObject("z", ResultJenaBased.class); assertEquals(117, result.value); }