### Question:
DbDumpContentProvider implements ContentProvider { @Override public void writeContent(OutputStream output) throws FileDownloadException { try { dbDumpFactory.newDbDumpCommand().execute(output); } catch (CreateDbDumpCommandException e) { throw new DatabaseExportingException(e); } catch (SQLException e) { throw new DatabaseExportingException(e); } catch (IOException e) { throw new DatabaseExportingException(e); } } DbDumpContentProvider(DatabaseDumpFactory dbDumpFactory); @Override void writeContent(OutputStream output); @Override String getMimeContentType(); @Override String getContentFileNameExt();  }### Answer:
@Test public void writeContentTest() throws Exception { Pair<DbDumpCommand, OutputStream> pair = getDumpCommandAndOutput(); DbDumpCommand command = pair.getLeft(); OutputStream output = pair.getRight(); sut.writeContent(output); verify(command).execute(output); }
@Test(expectedExceptions = DatabaseExportingException.class) public void IOErrorsThrowException() throws Exception { Pair<DbDumpCommand, OutputStream> pair = getDumpCommandAndOutput(); DbDumpCommand command = pair.getLeft(); OutputStream output = pair.getRight(); doThrow(IOException.class).when(command).execute(output); sut.writeContent(output); }
@Test(expectedExceptions = DatabaseExportingException.class) public void SQLErrorsThrowException() throws Exception { Pair<DbDumpCommand, OutputStream> pair = getDumpCommandAndOutput(); DbDumpCommand command = pair.getLeft(); OutputStream output = pair.getRight(); doThrow(SQLException.class).when(command).execute(output); sut.writeContent(output); }