SoapHashcodeValidationRequestToProxyDocumentTransformer { public ProxyHashcodeDataSet transform(SoapHashcodeValidationRequest validationRequest) { ProxyHashcodeDataSet proxyHashcodeDataSet = new ProxyHashcodeDataSet(); setReportType(validationRequest, proxyHashcodeDataSet); proxyHashcodeDataSet.setSignaturePolicy(validationRequest.getSignaturePolicy()); proxyHashcodeDataSet.setSignatureFiles(mapSignatureFiles(validationRequest.getSignatureFiles().getSignatureFile())); return proxyHashcodeDataSet; }  ProxyHashcodeDataSet transform(SoapHashcodeValidationRequest validationRequest);  }
@Test public void contentIsCorrectlyTransformedToBytes() throws IOException, URISyntaxException { SoapHashcodeValidationRequest validationRequest = mockValidValidationRequest(); ProxyHashcodeDataSet proxyDocument = transformer.transform(validationRequest); assertEquals(validationRequest.getSignatureFiles().getSignatureFile().get(0).getSignature(), Base64.encodeBase64String(proxyDocument.getSignatureFiles().get(0).getSignature())); }
@Test public void signaturePolicyRemainsUnchanged() throws IOException, URISyntaxException { SoapHashcodeValidationRequest validationRequest = mockValidValidationRequest(); ProxyHashcodeDataSet proxyDocument = transformer.transform(validationRequest); assertEquals(proxyDocument.getSignaturePolicy(), proxyDocument.getSignaturePolicy()); }
@Test public void dataFilesTransformedCorrectlyWhileValuesRemainingUnchanged() throws URISyntaxException, IOException { SoapHashcodeValidationRequest validationRequest = mockValidValidationRequest(); ProxyHashcodeDataSet proxyDocument = transformer.transform(validationRequest); List<HashDataFile> requestDatafiles = validationRequest.getSignatureFiles().getSignatureFile().get(0).getDataFiles().getDataFile(); List<Datafile> proxyDataFiles = proxyDocument.getSignatureFiles().get(0).getDatafiles(); assertFalse(proxyDataFiles.isEmpty()); assertSame(requestDatafiles.size(), proxyDataFiles.size()); assertDataFileValues(proxyDataFiles.get(0), requestDatafiles.get(0)); }