@Test public void scanservice_does_NOT_execute_reportservice_when_webscan_throws_sechubexception() throws Exception { DomainMessage request = prepareValidRequest(); doThrow(new SecHubExecutionException("ups...", new RuntimeException())).when(webScanProductExecutionService).executeProductsAndStoreResults(any()); DomainMessageSynchronousResult result = serviceToTest.receiveSynchronMessage(request); assertTrue(result.hasFailed()); verify(webScanProductExecutionService).executeProductsAndStoreResults(any()); verify(reportService, never()).createReport(any()); }
@Override @IsRecevingSyncMessage(MessageID.START_SCAN) public DomainMessageSynchronousResult receiveSynchronMessage(DomainMessage request) { notNull(request, "Request may not be null!"); if (!request.hasID(MessageID.START_SCAN)) { return new DomainMessageSynchronousResult(MessageID.UNSUPPORTED_OPERATION, new UnsupportedOperationException("Can only handle " + MessageID.START_SCAN)); } return startScan(request); }
ScanService implements SynchronMessageHandler { @Override @IsRecevingSyncMessage(MessageID.START_SCAN) public DomainMessageSynchronousResult receiveSynchronMessage(DomainMessage request) { notNull(request, "Request may not be null!"); if (!request.hasID(MessageID.START_SCAN)) { return new DomainMessageSynchronousResult(MessageID.UNSUPPORTED_OPERATION, new UnsupportedOperationException("Can only handle " + MessageID.START_SCAN)); } return startScan(request); } }
ScanService implements SynchronMessageHandler { @Override @IsRecevingSyncMessage(MessageID.START_SCAN) public DomainMessageSynchronousResult receiveSynchronMessage(DomainMessage request) { notNull(request, "Request may not be null!"); if (!request.hasID(MessageID.START_SCAN)) { return new DomainMessageSynchronousResult(MessageID.UNSUPPORTED_OPERATION, new UnsupportedOperationException("Can only handle " + MessageID.START_SCAN)); } return startScan(request); }  }
ScanService implements SynchronMessageHandler { @Override @IsRecevingSyncMessage(MessageID.START_SCAN) public DomainMessageSynchronousResult receiveSynchronMessage(DomainMessage request) { notNull(request, "Request may not be null!"); if (!request.hasID(MessageID.START_SCAN)) { return new DomainMessageSynchronousResult(MessageID.UNSUPPORTED_OPERATION, new UnsupportedOperationException("Can only handle " + MessageID.START_SCAN)); } return startScan(request); }  @Override @IsRecevingSyncMessage(MessageID.START_SCAN) DomainMessageSynchronousResult receiveSynchronMessage(DomainMessage request); }
ScanService implements SynchronMessageHandler { @Override @IsRecevingSyncMessage(MessageID.START_SCAN) public DomainMessageSynchronousResult receiveSynchronMessage(DomainMessage request) { notNull(request, "Request may not be null!"); if (!request.hasID(MessageID.START_SCAN)) { return new DomainMessageSynchronousResult(MessageID.UNSUPPORTED_OPERATION, new UnsupportedOperationException("Can only handle " + MessageID.START_SCAN)); } return startScan(request); }  @Override @IsRecevingSyncMessage(MessageID.START_SCAN) DomainMessageSynchronousResult receiveSynchronMessage(DomainMessage request);  }