AskResultSet extends AbstractResultSet { @Override public Object getObject(int columnIndex) { ensureState(); return result; } AskResultSet(boolean result); @Override int findColumn(String columnLabel); @Override int getColumnCount(); @Override boolean isBound(int variableIndex); @Override boolean isBound(String variableName); @Override boolean getBoolean(int columnIndex); @Override boolean getBoolean(String columnLabel); @Override byte getByte(int columnIndex); @Override byte getByte(String columnLabel); @Override double getDouble(int columnIndex); @Override double getDouble(String columnLabel); @Override float getFloat(int columnIndex); @Override float getFloat(String columnLabel); @Override int getInt(int columnIndex); @Override int getInt(String columnLabel); @Override long getLong(int columnIndex); @Override long getLong(String columnLabel); @Override Object getObject(int columnIndex); @Override Object getObject(String columnLabel); @Override T getObject(int columnIndex, Class<T> cls); @Override T getObject(String columnLabel, Class<T> cls); @Override short getShort(int columnIndex); @Override short getShort(String columnLabel); @Override String getString(int columnIndex); @Override String getString(String columnLabel); @Override boolean hasNext();  }
@Test public void getObjectByIndexReturnsResultBoxed() { resultSet.next(); final Object result = resultSet.getObject(0); assertTrue(result instanceof Boolean); assertTrue((Boolean) result); }
@Test public void getObjectByVariableReturnsResultBoxed() { resultSet.next(); final Object result = resultSet.getObject("result"); assertTrue(result instanceof Boolean); assertTrue((Boolean) result); }
@Test public void getObjectByClassReturnsValueCastToBoolean() throws Exception { resultSet.next(); final Boolean result = resultSet.getObject(0, Boolean.class); assertTrue(result); }
@Test public void getObjectByClassReturnsValueAsString() throws Exception { resultSet.next(); final String result = resultSet.getObject("x", String.class); assertEquals(Boolean.TRUE.toString(), result); }
@Test public void getObjectByClassConstructsObjectUsingConstructorWithBooleanParameter() throws Exception { resultSet.next(); final WithBooleanParameter result = resultSet.getObject(0, WithBooleanParameter.class); assertTrue(result.value); }
@Test public void getObjectByClassConstructsObjectUsingConstructorWithStringParameter() throws Exception { resultSet.next(); final WithStringParameter result = resultSet.getObject("x", WithStringParameter.class); assertTrue(result.value); }
@Test public void getObjectByClassThrowsJenaDriverExceptionWhenNoSuitableConstructorIsFound() throws Exception { resultSet.next(); thrown.expect(JenaDriverException.class); thrown.expectMessage(containsString("No suitable constructor for value ")); thrown.expectMessage(containsString("found in type ")); resultSet.getObject(0, AskResultSetTest.class); }