### Question:
JEObjectDatabase extends AbstractObjectDatabase implements ObjectDatabase { @Override public synchronized void close() { if (env == null) { LOGGER.trace("Database already closed."); return; } final File envHome = env.getHome(); try { LOGGER.debug("Closing object database at {}", envHome); if (writerService != null) { writerService.shutdown(); waitForServiceShutDown(writerService); } if (objectDb != null) { objectDb.close(); objectDb = null; } if (dbSyncService != null) { dbSyncService.shutdown(); waitForServiceShutDown(dbSyncService); } LOGGER.trace("ObjectDatabase closed. Closing environment..."); if (!readOnly) { env.sync(); env.cleanLog(); } } finally { env.close(); env = null; } LOGGER.debug("Database {} closed.", envHome); } JEObjectDatabase(final ObjectSerializingFactory serialization,
            final ConfigDatabase configDB, final EnvironmentBuilder envProvider,
            final boolean readOnly, final String envName); @Override synchronized void close(); @Override boolean isOpen(); @Override synchronized void open(); @Override boolean exists(final ObjectId id); @Override void putAll(final Iterator<? extends RevObject> objects, final BulkOpListener listener); @Override boolean delete(final ObjectId id); @Override long deleteAll(Iterator<ObjectId> ids, final BulkOpListener listener); @Override Iterator<RevObject> getAll(final Iterable<ObjectId> ids, final BulkOpListener listener); void checkWritable(); @Override String toString();  }### Answer:
@Test public void testReadOnlyHint2() { hints.set(Hints.OBJECTS_READ_ONLY, Boolean.TRUE); db = createDb(); RevObject obj = RevTree.EMPTY; try { db.put(obj); fail("Expected UOE on read only hint"); } catch (UnsupportedOperationException e) { assertTrue(true); } db.close(); hints.set(Hints.OBJECTS_READ_ONLY, Boolean.FALSE); db = createDb(); Assert.assertTrue(db.put(obj)); }
@Test public void testReadOnlyHint3() { hints.set(Hints.OBJECTS_READ_ONLY, Boolean.TRUE); db = createDb(); RevObject obj = RevTree.EMPTY; try { db.put(obj); fail("Expected UOE on read only hint"); } catch (UnsupportedOperationException e) { assertTrue(true); } hints.set(Hints.OBJECTS_READ_ONLY, Boolean.FALSE); ObjectDatabase db2 = createDb(); Assert.assertTrue(db2.put(obj)); db.close(); db2.close(); }