### Question:
JdbcDataExporter implements DataExporter { @Override public void export(final StoreLoader loader, final Path output, final String username, final String password) throws SQLException, IOException { try (Connection conn = DriverManager.getConnection(jdbcUrl, username, password)) { try (Statement stmt = conn.createStatement()) { for (final String createTable : createTables) { stmt.executeUpdate(createTable); } } try (PreparedStatement insertStatement = conn.prepareStatement(insertRow)) { DataEntry next; while ((next = loader.nextEntry()) != null) { try (InputStream data = next.getValue()) { insertStatement.setBytes(1, next.getKey()); insertStatement.setBinaryStream(2, data); insertStatement.execute(); } } } } } JdbcDataExporter(final String jdbcUrl, final String insertRow, final List<String> createTables); @Override void export(final StoreLoader loader,
                       final Path output,
                       final String username,
                       final String password);  }### Answer:
@Test public void runAnExportAndVerifyRunStatements() throws Exception { final String createStatement = "CREATE TEST TABLE"; final String insertStatement = "INSERT INTO TABLE(?, ?)"; final JdbcDataExporter exporter = new JdbcDataExporter("jdbc:bogus", insertStatement, singletonList(createStatement)); final StoreLoader mockLoader = new MockDataLoader(singletonMap("HASH", "VALUE")); final Path output = mock(Path.class); exporter.export(mockLoader, output, "username", "password"); final List<String> executedSQLStatements = super.getExecutedSQLStatements(); assertThat(executedSQLStatements).hasSize(2).containsExactly(createStatement, insertStatement); final List<MockPreparedStatement> preparedStatements = super.getPreparedStatements(); assertThat(preparedStatements).hasSize(1); assertThat(preparedStatements.get(0).getSQL()).isEqualTo("INSERT INTO TABLE(?, ?)"); final byte[] key = (byte[])super.getPreparedStatementParameter(preparedStatements.get(0), 1); final InputStream value = (InputStream) super.getPreparedStatementParameter(preparedStatements.get(0), 2); assertThat(new String(key)).isEqualTo("HASH"); assertThat(new String(IOUtils.toByteArray(value))).isEqualTo("VALUE"); verifyAllStatementsClosed(); }