@Test public void printWithTemplateArgumentTest() { PrintTemplateInfo printTemplateInfo = new PrintTemplateInfo(); PrintRequestInfo createInfo = new PrintRequestInfo(); createInfo.setPrintTemplateInfo(printTemplateInfo); createInfo.setFileName("test.pdf"); createInfo.setPostPrintAction(PostPrintAction.OPEN); Callback<PrintFinishedInfo, Void> callbackMock = mock(Callback.class); printService.print(createInfo, callbackMock); ArgumentCaptor<GwtCommand> commandCaptor = ArgumentCaptor.forClass(GwtCommand.class); ArgumentCaptor<CommandCallback> callbackCaptor = ArgumentCaptor.forClass(CommandCallback.class); verify(commandServiceMock).execute(commandCaptor.capture(), callbackCaptor.capture()); GwtCommand command = commandCaptor.getValue(); Assert.assertEquals(PrintGetTemplateRequest.COMMAND, command.getCommandName()); Assert.assertTrue(command.getCommandRequest() instanceof PrintGetTemplateRequest); PrintGetTemplateRequest request = (PrintGetTemplateRequest) command.getCommandRequest(); Assert.assertEquals(printTemplateInfo, request.getTemplate()); }
@Override public void print(PrintRequestInfo printRequestInfo, final Callback<PrintFinishedInfo, Void> callback) { if (printRequestInfo.isSync()) { runSync(callback, printRequestInfo); } else { runAsync(callback, printRequestInfo); } }
PrintServiceImpl implements PrintService { @Override public void print(PrintRequestInfo printRequestInfo, final Callback<PrintFinishedInfo, Void> callback) { if (printRequestInfo.isSync()) { runSync(callback, printRequestInfo); } else { runAsync(callback, printRequestInfo); } } }
PrintServiceImpl implements PrintService { @Override public void print(PrintRequestInfo printRequestInfo, final Callback<PrintFinishedInfo, Void> callback) { if (printRequestInfo.isSync()) { runSync(callback, printRequestInfo); } else { runAsync(callback, printRequestInfo); } }  }
PrintServiceImpl implements PrintService { @Override public void print(PrintRequestInfo printRequestInfo, final Callback<PrintFinishedInfo, Void> callback) { if (printRequestInfo.isSync()) { runSync(callback, printRequestInfo); } else { runAsync(callback, printRequestInfo); } }  @Override void print(PrintRequestInfo printRequestInfo, final Callback<PrintFinishedInfo, Void> callback); @Override void print(PrintRequestInfo printRequestInfo, final PrintRequestHandler printRequestHandler); }
PrintServiceImpl implements PrintService { @Override public void print(PrintRequestInfo printRequestInfo, final Callback<PrintFinishedInfo, Void> callback) { if (printRequestInfo.isSync()) { runSync(callback, printRequestInfo); } else { runAsync(callback, printRequestInfo); } }  @Override void print(PrintRequestInfo printRequestInfo, final Callback<PrintFinishedInfo, Void> callback); @Override void print(PrintRequestInfo printRequestInfo, final PrintRequestHandler printRequestHandler);  }