RtfDocumentCommand extends HystrixCommand<Document> { private String pid2HexString(String pid) { return new BigInteger(pid.getBytes()).toString(16); } RtfDocumentCommand(DodDocumentConfiguration config,
                              String complexNoteUrl, PatientIds patientIds, String eventId, Document vprDocument); Document retrieveConvertAndStoreRTFDocument(); @Override Document getFallback(); static final HystrixCommandGroupKey GROUP_KEY; static final HystrixCommandKey COMMAND_KEY; static final HystrixThreadPoolKey THREAD_KEY; }
@Test public void testDocumentCommand() { try { Document resultVprDocument = testDocumentCommand.queue().get(); verify(mockRetrieveDodDocumentService).retrieveDodDocument(any(JMeadowsQuery.class)); verify(mockConvertDocumentService).convert2HTML(any(File.class), any(File.class)); verify(mockConvertDocumentService).convert2Text(any(File.class), any(File.class)); assertNotNull(resultVprDocument); assertThat(resultVprDocument.getUid(), is(VPR_DOC_UID)); assertNotNull(resultVprDocument.getText()); assertThat(resultVprDocument.getText().get(0).getContent(), is(NOTE_TEXT)); assertThat(resultVprDocument.getDodComplexNoteUri(), is(String.format("%s/%s/%s.html", STORAGE_SERVICE_PATH, pid2HexString("test.pid"), FILENAME))); } catch (Exception e) { fail(e.getMessage()); } }