### Question:
InMemoryDatabase implements IDatabase { @Override public void insert(final IObject document, final String collectionName) throws IDatabaseException { synchronized (this) { try { DataBaseItem item = IOC.resolve(Keys.getOrAdd(DataBaseItem.class.getCanonicalName()), document, collectionName); insert(item); } catch (ResolutionException e) { throw new IDatabaseException("Failed to create DataBaseItem", e); } } } InMemoryDatabase(); @Override void upsert(final IObject document, final String collectionName); @Override void createCollection(final String collectionName); @Override void insert(final IObject document, final String collectionName); @Override void update(final IObject document, final String collectionName); @Override IObject getById(final Object id, final String collectionName); @Override List<IObject> select(final IObject condition, final String collectionName); @Override void delete(final IObject document, final String collectionName); @Override Long count(final IObject condition, final String collectionName);  }### Answer:
@Test(expected = IDatabaseException.class) public void testInsertToNotExistingCollection() throws InvalidArgumentException, IDatabaseException, SerializeException, ReadValueException { InMemoryDatabase database = new InMemoryDatabase(); IObject document = new DSObject("{}"); database.insert(document, "collection_name"); }