### Question:
JenaConnection implements RDFConnection { @Override public void update(Collection<STMT> removedStatements, Collection<STMT> addedStatements) { if (removedStatements != null && !removedStatements.isEmpty()) { for (STMT stmt : removedStatements) { graph.delete(convert(stmt)); } } if (addedStatements != null && !addedStatements.isEmpty()) { for (STMT stmt : addedStatements) { graph.add(convert(stmt)); } } } JenaConnection(DatasetGraph graph, Dataset dataset, JenaDialect dialect); @Override RDFBeanTransaction beginTransaction(boolean readOnly, int txTimeout, int isolationLevel); @Override void clear(); @Override void close(); @Override BID createBNode(); @SuppressWarnings("unchecked") @Override Q createUpdate(UpdateLanguage<D, Q> updateLanguage, D definition); @SuppressWarnings("unchecked") @Override Q createQuery(QueryLanguage<D, Q> queryLanguage, D definition); @Override boolean exists(ID subject, UID predicate, NODE object, UID context, boolean includeInferred); @Override CloseableIterator<STMT> findStatements(ID subject, UID predicate, NODE object, UID context, boolean includeInferred); @Override long getNextLocalId(); @Override void remove(ID subject, UID predicate, NODE object, UID context); @Override void update(Collection<STMT> removedStatements, Collection<STMT> addedStatements); @Override QueryOptions getQueryOptions(); @Override InferenceOptions getInferenceOptions();  }### Answer:
@Test public void Update_with_nulls() { connection.update(Collections.<STMT> emptySet(), null); connection.update(null, Collections.<STMT> emptySet()); connection.update(null, null); }
@Test public void Update() { ID sub = new UID(TEST.NS, "s" + System.currentTimeMillis()); ID type = new UID(TEST.NS, "TestType" + System.currentTimeMillis()); Collection<STMT> stmts = Collections.singleton(new STMT(sub, RDF.type, type)); connection.update(null, stmts); assertExists(sub, RDF.type, type, null); connection.update(stmts, null); assertNotExists(sub, RDF.type, type, null); }
@Test public void Update_named() { ID sub = new UID(TEST.NS, "s" + System.currentTimeMillis()); ID type = new UID(TEST.NS, "TestType" + System.currentTimeMillis()); Collection<STMT> stmts = Collections.singleton(new STMT(sub, RDF.type, type, context)); connection.update(null, stmts); assertExists(sub, RDF.type, type, null); connection.update(stmts, null); assertNotExists(sub, RDF.type, type, null); }