@Test public void givenXroadValidationWillReturnValidatedDocument() throws Exception { ValidationConclusion validationConclusion = new ValidationConclusion(); validationConclusion.setSignaturesCount(1); validationConclusion.setValidSignaturesCount(1); Reports reports = new Reports(new SimpleReport(validationConclusion), null, null); BDDMockito.given(restProxyService.validate(any(ValidationDocument.class))).willReturn(reports); ProxyDocument proxyDocument = mockProxyDocumentWithDocument(DocumentType.XROAD); SimpleReport validationReport = validationProxy.validate(proxyDocument); verify(restProxyService).validate(any(ValidationDocument.class)); Assertions.assertThat(validationReport.getValidationConclusion().getValidSignaturesCount()).isEqualTo(1); Assertions.assertThat(validationReport.getValidationConclusion().getSignaturesCount()).isEqualTo(1); }
public SimpleReport validate(ProxyRequest proxyRequest) { long validationStartTime = System.nanoTime(); SimpleReport report = validateRequest(proxyRequest); long validationDuration = System.nanoTime() - validationStartTime; publishStatistics(proxyRequest, report, validationDuration); addWarningForTestEnvironment(report); return report; }
ValidationProxy { public SimpleReport validate(ProxyRequest proxyRequest) { long validationStartTime = System.nanoTime(); SimpleReport report = validateRequest(proxyRequest); long validationDuration = System.nanoTime() - validationStartTime; publishStatistics(proxyRequest, report, validationDuration); addWarningForTestEnvironment(report); return report; } }
ValidationProxy { public SimpleReport validate(ProxyRequest proxyRequest) { long validationStartTime = System.nanoTime(); SimpleReport report = validateRequest(proxyRequest); long validationDuration = System.nanoTime() - validationStartTime; publishStatistics(proxyRequest, report, validationDuration); addWarningForTestEnvironment(report); return report; } @Autowired  ValidationProxy(StatisticsService statisticsService, ApplicationContext applicationContext, Environment environment); }
ValidationProxy { public SimpleReport validate(ProxyRequest proxyRequest) { long validationStartTime = System.nanoTime(); SimpleReport report = validateRequest(proxyRequest); long validationDuration = System.nanoTime() - validationStartTime; publishStatistics(proxyRequest, report, validationDuration); addWarningForTestEnvironment(report); return report; } @Autowired  ValidationProxy(StatisticsService statisticsService, ApplicationContext applicationContext, Environment environment); SimpleReport validate(ProxyRequest proxyRequest); }
ValidationProxy { public SimpleReport validate(ProxyRequest proxyRequest) { long validationStartTime = System.nanoTime(); SimpleReport report = validateRequest(proxyRequest); long validationDuration = System.nanoTime() - validationStartTime; publishStatistics(proxyRequest, report, validationDuration); addWarningForTestEnvironment(report); return report; } @Autowired  ValidationProxy(StatisticsService statisticsService, ApplicationContext applicationContext, Environment environment); SimpleReport validate(ProxyRequest proxyRequest);  }