### Question:
SendTemplatedEmailProcess implements WorkflowProcess { @Override public final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaData) throws WorkflowException { final WorkflowData workflowData = workItem.getWorkflowData(); final String type = workflowData.getPayloadType(); if (!StringUtils.equals(type, "JCR_PATH")) { return; } String[] args = buildArguments(metaData); String emailTemplate = getValueFromArgs(Arguments.TEMPLATE.getArgumentName(), args); if (emailTemplate == null) { log.warn("Invalid process arguments, returning"); return; } String sdfParam = getValueFromArgs(Arguments.DATE_FORMAT.getArgumentName(), args); SimpleDateFormat sdf = getSimpleDateFormat(sdfParam); final String payloadPath = workflowData.getPayload().toString(); final Map<String, Object> authInfo = new HashMap<String, Object>(); authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, workflowSession.getSession()); try (ResourceResolver resourceResolver = resourceResolverFactory.getResourceResolver(authInfo) ) { Resource payloadRes = resourceResolver.getResource(payloadPath); Map<String, String> emailParams = new HashMap<String, String>(); emailParams.put(SendTemplatedEmailConstants.JCR_PATH, payloadPath); Map<String, String> payloadProp = SendTemplatedEmailUtils.getPayloadProperties(payloadRes, sdf); if (payloadProp != null) { emailParams.putAll(payloadProp); } Map<String, String> urlParams = getUrls(payloadRes); emailParams.putAll(urlParams); Map<String, String> wfParams = getAdditionalParams(workItem, workflowSession, payloadRes); emailParams.putAll(wfParams); String[] emailTo = getEmailAddrs(workItem, payloadRes, args); List<String> failureList = emailService.sendEmail(emailTemplate, emailParams, emailTo); if (failureList.isEmpty()) { log.info("Email sent successfully to {} recipients", emailTo.length); } else { log.error("Email sent failed"); } } catch (LoginException e) { log.error("Could not acquire a ResourceResolver object from the Workflow Session's JCR Session: {}", e); } }  @Override final void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaData);  }### Answer:
@Test public void test_with_payload_notJcrPath_is_noop() throws Exception { WorkflowData workflowData = mock(WorkflowData.class); when(workItem.getWorkflowData()).thenReturn(workflowData); when(workflowData.getPayloadType()).thenReturn(""); MetaDataMap metaData = new SimpleMetaDataMap(); process.execute(workItem, workflowSession, metaData); verifyNoInteractions(harness); }
@Test public void test_with_no_template_args_is_noop() throws Exception { WorkflowData workflowData = mock(WorkflowData.class); when(workItem.getWorkflowData()).thenReturn(workflowData); when(workflowData.getPayloadType()).thenReturn("JCR_PATH"); MetaDataMap metaData = new SimpleMetaDataMap(); metaData.put("PROCESS_ARGS", ""); process.execute(workItem, workflowSession, metaData); verifyNoInteractions(harness); }