### Question:
ExportToRawFormatSessionCommand extends AbstractExportSessionCommand { @SuppressWarnings("unchecked") @Override protected void export(final String fileName) { clientDiagramService.getRawContent(getSession().getCanvasHandler().getDiagram(), new ServiceCallback<String>() { @Override public void onSuccess(String rawContent) { textFileExport.export(TextContent.create(rawContent), fileName); } @Override public void onError(ClientRuntimeError error) { errorPopupPresenter.showMessage(error.getMessage()); } }); } protected  ExportToRawFormatSessionCommand(); @Inject  ExportToRawFormatSessionCommand(final ClientDiagramService clientDiagramService,
                                           final ErrorPopupPresenter errorPopupPresenter,
                                           final TextFileExport textFileExport);   }### Answer:
@Test @SuppressWarnings("unchecked") public void testExportSuccessful() { command.execute(callback); verify(clientDiagramService, times(1)).getRawContent(eq(diagram), callbackCaptor.capture()); callbackCaptor.getValue().onSuccess(FILE_RAW_CONTENT); verify(textFileExport, times(1)).export(textContentCaptor.capture(), eq(FILE_NAME)); assertEquals(FILE_RAW_CONTENT, textContentCaptor.getValue().getText()); }
@Test @SuppressWarnings("unchecked") public void testExportUnSuccessful() { command.execute(callback); verify(clientDiagramService, times(1)).getRawContent(eq(diagram), callbackCaptor.capture()); callbackCaptor.getValue().onError(new ClientRuntimeError(ERROR)); verify(textFileExport, never()).export(anyObject(), anyObject()); verify(errorPopupPresenter, times(1)).showMessage(ERROR); }