@Test public void testGetChildDocumentKey_ScnearioOne() { String mockFormDataCsv = "\"completed\",\"email\",\"role\",\"first\",\"last\",\"title\",\"company\",\"Transaction Number\""; GetFormDataResult mockGetFormDataResult=mock(GetFormDataResult.class); doReturn(mockFormDataCsv).when(mockGetFormDataResult).getFormDataCsv(); doReturn(mockGetFormDataResult).when(service).getFormData(mockEchoSignApiKey, mockDocumentKey); Assert.assertNull(sut.getChildDocumentKey(mockDocumentKey)); }
@Override public String getChildDocumentKey(String documentKey) { GetFormDataResult getFormDataResult = getCachedService().getFormData( echoSignApiKey, documentKey); String formDataCsv = getFormDataResult.getFormDataCsv(); String childDocumentKey = null; if (formDataCsv != null) { logger.info(formDataCsv); String[] splittedFormDataCsv = formDataCsv.split("\\r?\\n"); String[] keys = splittedFormDataCsv[0].replace("\"", "").split(","); int documentKeyIndex = Arrays.asList(keys).indexOf("Document Key"); if( documentKeyIndex != -1) { String[] values = splittedFormDataCsv[1].replace("\"", "").split(","); childDocumentKey = values[documentKeyIndex]; } } return childDocumentKey; }
EchoSignSignatureServiceImpl implements EchoSignSignatureService { @Override public String getChildDocumentKey(String documentKey) { GetFormDataResult getFormDataResult = getCachedService().getFormData( echoSignApiKey, documentKey); String formDataCsv = getFormDataResult.getFormDataCsv(); String childDocumentKey = null; if (formDataCsv != null) { logger.info(formDataCsv); String[] splittedFormDataCsv = formDataCsv.split("\\r?\\n"); String[] keys = splittedFormDataCsv[0].replace("\"", "").split(","); int documentKeyIndex = Arrays.asList(keys).indexOf("Document Key"); if( documentKeyIndex != -1) { String[] values = splittedFormDataCsv[1].replace("\"", "").split(","); childDocumentKey = values[documentKeyIndex]; } } return childDocumentKey; } }
EchoSignSignatureServiceImpl implements EchoSignSignatureService { @Override public String getChildDocumentKey(String documentKey) { GetFormDataResult getFormDataResult = getCachedService().getFormData( echoSignApiKey, documentKey); String formDataCsv = getFormDataResult.getFormDataCsv(); String childDocumentKey = null; if (formDataCsv != null) { logger.info(formDataCsv); String[] splittedFormDataCsv = formDataCsv.split("\\r?\\n"); String[] keys = splittedFormDataCsv[0].replace("\"", "").split(","); int documentKeyIndex = Arrays.asList(keys).indexOf("Document Key"); if( documentKeyIndex != -1) { String[] values = splittedFormDataCsv[1].replace("\"", "").split(","); childDocumentKey = values[documentKeyIndex]; } } return childDocumentKey; } EchoSignSignatureServiceImpl(String echoSignServiceUrl,
			String echoSignApiKey); }
EchoSignSignatureServiceImpl implements EchoSignSignatureService { @Override public String getChildDocumentKey(String documentKey) { GetFormDataResult getFormDataResult = getCachedService().getFormData( echoSignApiKey, documentKey); String formDataCsv = getFormDataResult.getFormDataCsv(); String childDocumentKey = null; if (formDataCsv != null) { logger.info(formDataCsv); String[] splittedFormDataCsv = formDataCsv.split("\\r?\\n"); String[] keys = splittedFormDataCsv[0].replace("\"", "").split(","); int documentKeyIndex = Arrays.asList(keys).indexOf("Document Key"); if( documentKeyIndex != -1) { String[] values = splittedFormDataCsv[1].replace("\"", "").split(","); childDocumentKey = values[documentKeyIndex]; } } return childDocumentKey; } EchoSignSignatureServiceImpl(String echoSignServiceUrl,
			String echoSignApiKey); @Override String sendDocumentToSign(byte[] documentBytes,
			String documentFileName, String documentName,
			String recipientEmail, String messageToRecipient); @Override String sendDocumentToSign(byte[] documentBytes,
			String documentFileName, String documentName,
			String recipientEmail, String messageToRecipient,
			String signedDocumentUrl); @Override DocumentInfo getDocumentInfo(String documentKey); @Override byte[] getLatestDocument(String documentKey); @Override String getChildDocumentKey(String documentKey); Pong testPing(); byte[] testEchoFile(byte[] input); @Override EmbeddedWidgetCreationResult createEmbeddedWidget(
			byte[] documentBytes, String documentFileName, String documentName,
			String signedDocumentUrl, String email); }
EchoSignSignatureServiceImpl implements EchoSignSignatureService { @Override public String getChildDocumentKey(String documentKey) { GetFormDataResult getFormDataResult = getCachedService().getFormData( echoSignApiKey, documentKey); String formDataCsv = getFormDataResult.getFormDataCsv(); String childDocumentKey = null; if (formDataCsv != null) { logger.info(formDataCsv); String[] splittedFormDataCsv = formDataCsv.split("\\r?\\n"); String[] keys = splittedFormDataCsv[0].replace("\"", "").split(","); int documentKeyIndex = Arrays.asList(keys).indexOf("Document Key"); if( documentKeyIndex != -1) { String[] values = splittedFormDataCsv[1].replace("\"", "").split(","); childDocumentKey = values[documentKeyIndex]; } } return childDocumentKey; } EchoSignSignatureServiceImpl(String echoSignServiceUrl,
			String echoSignApiKey); @Override String sendDocumentToSign(byte[] documentBytes,
			String documentFileName, String documentName,
			String recipientEmail, String messageToRecipient); @Override String sendDocumentToSign(byte[] documentBytes,
			String documentFileName, String documentName,
			String recipientEmail, String messageToRecipient,
			String signedDocumentUrl); @Override DocumentInfo getDocumentInfo(String documentKey); @Override byte[] getLatestDocument(String documentKey); @Override String getChildDocumentKey(String documentKey); Pong testPing(); byte[] testEchoFile(byte[] input); @Override EmbeddedWidgetCreationResult createEmbeddedWidget(
			byte[] documentBytes, String documentFileName, String documentName,
			String signedDocumentUrl, String email);  }