JenaPreparedStatement extends JenaStatement implements PreparedStatement { @Override public void setObject(String binding, Object value) { ensureOpen(); Objects.requireNonNull(binding); Objects.requireNonNull(value); holder.setParameter(binding, value.toString()); } JenaPreparedStatement(StatementExecutor executor, String sparql); @Override ResultSet executeQuery(); @Override void executeUpdate(); @Override void setObject(String binding, Object value); @Override void clearParameters();  }
@Test public void setParameterSetsParameterOnQuery() throws Exception { this.statement = new JenaPreparedStatement(executor, QUERY); final String value = "<" + Vocabulary.RDF_TYPE + ">"; statement.setObject("y", value); final StatementHolder holder = getStatementHolder(); assertThat(holder.assembleStatement(), containsString(value)); }
@Test public void setParameterThrowsIllegalStateOnClosedStatement() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage(containsString("Statement is closed")); this.statement = new JenaPreparedStatement(executor, QUERY); statement.close(); statement.setObject("y", "rdf:type"); }