### Question:
JdbcAccessor extends JdbcBasePlugin implements Accessor { @Override public boolean openForWrite() throws SQLException, SQLTimeoutException, ParseException, ClassNotFoundException { if (queryName != null) { throw new IllegalArgumentException("specifying query name in data path is not supported for JDBC writable external tables"); } if (statementWrite != null && !statementWrite.isClosed()) { throw new SQLException("The connection to an external database is already open."); } Connection connection = super.getConnection(); SQLQueryBuilder sqlQueryBuilder = new SQLQueryBuilder(context, connection.getMetaData()); if (quoteColumns == null) { sqlQueryBuilder.autoSetQuoteString(); } else if (quoteColumns) { sqlQueryBuilder.forceSetQuoteString(); } queryWrite = sqlQueryBuilder.buildInsertQuery(); LOG.trace("Insert query: {}", queryWrite); statementWrite = super.getPreparedStatement(connection, queryWrite); if (!connection.getMetaData().supportsBatchUpdates()) { if ((batchSizeIsSetByUser) && (batchSize > 1)) { throw new SQLException("The external database does not support batch updates"); } else { batchSize = 1; } } if (poolSize < 1) { poolSize = Runtime.getRuntime().availableProcessors(); LOG.info( "The POOL_SIZE is set to the number of CPUs available (" + Integer.toString(poolSize) + ")" ); } if (poolSize > 1) { executorServiceWrite = Executors.newFixedThreadPool(poolSize); poolTasks = new LinkedList<>(); } writerCallableFactory = new WriterCallableFactory(this, queryWrite, statementWrite, batchSize, poolSize); writerCallable = writerCallableFactory.get(); return true; } JdbcAccessor();   JdbcAccessor(ConnectionManager connectionManager); @Override boolean openForRead(); @Override OneRow readNextObject(); @Override void closeForRead(); @Override boolean openForWrite(); @Override boolean writeNextObject(OneRow row); @Override void closeForWrite();  }### Answer:
@Test public void testWriteFailsWhenQueryIsSpecified() throws Exception { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("specifying query name in data path is not supported for JDBC writable external tables"); context.setDataSource("query:foo"); accessor.initialize(context); accessor.openForWrite(); }