@Test
public void testCreateConsentEmbeddedWidget() {

	Consent consent = mock(Consent.class);
	Patient patient = mock(Patient.class);
	when(consentRepository.findOne(anyLong())).thenReturn(consent);
	ConsentService spy = spy(cst);
	ConsentPdfDto consentPdfDto = mock(ConsentPdfDto.class);
	when(consentPdfDto.getContent()).thenReturn(DOCUMENT_BYTES);
	when(consentPdfDto.getFilename()).thenReturn(DOCUMENT_FILE_NAME);
	when(consentPdfDto.getConsentName()).thenReturn(DOCUMENT_NAME);
	when(consentPdfDto.getId()).thenReturn((long) 1);
	SignedPDFConsent signedPdfConsent = mock(SignedPDFConsent.class);
	when(spy.makeSignedPdfConsent()).thenReturn(signedPdfConsent);
	when(consent.getPatient()).thenReturn(patient);
	when(patient.getEmail()).thenReturn(EMAIL);
	EmbeddedWidgetCreationResult result = mock(EmbeddedWidgetCreationResult.class);
	when(
			echoSignSignatureService
					.createEmbeddedWidget(DOCUMENT_BYTES,
							DOCUMENT_FILE_NAME, DOCUMENT_NAME,
							null, EMAIL)).thenReturn(result);
	spy.createConsentEmbeddedWidget(consentPdfDto);
	verify(consentRepository).save(consent);
}