SoapDataFilesRequestToProxyDocumentTransformer { public ProxyDocument transform(SoapDataFilesRequest dataFilesRequest) { ProxyDocument proxyDocument = new ProxyDocument(); proxyDocument.setName(dataFilesRequest.getFilename()); proxyDocument.setBytes(Base64.decodeBase64(dataFilesRequest.getDocument())); return proxyDocument; }  ProxyDocument transform(SoapDataFilesRequest dataFilesRequest);  }
@Test public void contentIsCorrectlyTransformedToBytes() { String documentContent = "ZmlsZWNvbnRlbnQ="; SoapDataFilesRequest dataFilesRequest = createSoapDataFilesRequest(documentContent, "test.ddoc"); assertEquals(dataFilesRequest.getDocument(), Base64.encodeBase64String(transformer.transform(dataFilesRequest).getBytes())); }
@Test public void pdfTypeIsCorrectlyTransformedToDocumentType() { SoapDataFilesRequest dataFilesRequest = createSoapDataFilesRequest("Ymxh", "test.pdf"); assertEquals(dataFilesRequest.getFilename(), transformer.transform(dataFilesRequest).getName()); }
@Test public void bdocTypeIsCorrectlyTransformedToDocumentType() { SoapDataFilesRequest dataFilesRequest = createSoapDataFilesRequest("Ymxh", "test.bdoc"); assertEquals(dataFilesRequest.getFilename(), transformer.transform(dataFilesRequest).getName()); }
@Test public void ddocTypeIsCorrectlyTransformedToDocumentType() { SoapDataFilesRequest dataFilesRequest = createSoapDataFilesRequest("Ymxh", "test.ddoc"); assertEquals(dataFilesRequest.getFilename(), transformer.transform(dataFilesRequest).getName()); }
@Test public void xroadTypeIsCorrectlyTransformedToDocumentType() { SoapDataFilesRequest dataFilesRequest = createSoapDataFilesRequest("Ymxh", "test.xroad"); assertEquals(dataFilesRequest.getFilename(), transformer.transform(dataFilesRequest).getName()); }