PostgresCreateTask implements IDatabaseTask { @Override public void prepare(final IObject query) throws TaskPrepareException { try { CreateCollectionMessage message = IOC.resolve(Keys.getOrAdd(CreateCollectionMessage.class.getCanonicalName()), query); collection = message.getCollectionName(); options = message.getOptions(); preparedQuery = new QueryStatement(); PostgresSchema.create(preparedQuery, collection, options); } catch (Exception e) { throw new TaskPrepareException(e); } } PostgresCreateTask(final IStorageConnection connection); @Override void prepare(final IObject query); @Override void execute();  }
@Test public void testCreateWithInvalidOptions() throws SQLException, TaskPrepareException, StorageException, InvalidArgumentException, ReadValueException { when(message.getOptions()).thenReturn(new DSObject("{ \"ordered\": 123 }")); try { task.prepare(null); fail(); } catch (TaskPrepareException e) { } verifyZeroInteractions(connection); verifyZeroInteractions(sqlStatement); }