### Question:
WorkflowRemover extends ProcessDefinition { void parseParameters() throws ParseException { if (payloadPaths != null) { payloads = payloadPaths.stream().map(Pattern::compile).collect(Collectors.toList()); } if (StringUtils.isNotEmpty(olderThanVal)) { final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Date d = sdf.parse(olderThanVal); olderThan = Calendar.getInstance(); olderThan.setTime(d); } } WorkflowRemover(WorkflowInstanceRemover workflowInstanceRemover); @Override void buildProcess(ProcessInstance instance, ResourceResolver rr); @Override void storeReport(ProcessInstance instance, ResourceResolver rr); @Override void init(); List<String> getModelIds(); List<Pattern> getPayloads(); Calendar getOlderThan(); List<String> getStatuses(); @FormField(name = "Workflow Payload Paths", description = "Payload path regex", hint = "/content/dam/.*",
            component = MultifieldComponent.class)
    public List<String> payloadPaths; @FormField(name = "Workflows Older Than", description = "only remove workflows older than the specified date",
            component = DatePickerComponent.class)
    public String olderThanVal; @FormField(
            name = "Workflow Models",
            description = "If no Workflow Models are selected, Workflow Instances will not be filtered by Workflow Model.",
            component = MultifieldComponent.class, options = { MultifieldComponent.USE_CLASS
                    + "=com.adobe.acs.commons.mcp.form.workflow.WorkflowModelSelector" })
    public List<String> modelIds; @FormField(name = "Workflow Statuses", component = MultifieldComponent.class, required = true,
            options = { MultifieldComponent.USE_CLASS
                    + "=com.adobe.acs.commons.mcp.form.workflow.WorkflowStatusSelector" })
    public List<String> statuses; }### Answer:
@Test(expected = ParseException.class) public void parseParametersBadDateInput() throws Exception { remover.payloadPaths = new ArrayList<>(); remover.payloadPaths.add("/content/dam/.*"); remover.payloadPaths.add("/content/mySite/.*"); remover.olderThanVal = "8-24-201900:00:00"; remover.modelIds = new ArrayList<>(); remover.modelIds.add("/var/workflow/models/dam/update_asset"); remover.modelIds.add("/var/workflow/models/dam/process_subasset"); remover.modelIds.add("/var/workflow/models/request_for_deletion"); remover.statuses = new ArrayList<>(); remover.statuses.add(WorkflowStatusSelector.WorkflowStatus.STALE.name()); remover.statuses.add(WorkflowStatusSelector.WorkflowStatus.ABORTED.name()); remover.statuses.add(WorkflowStatusSelector.WorkflowStatus.COMPLETED.name()); remover.statuses.add(WorkflowStatusSelector.WorkflowStatus.SUSPENDED.name()); remover.parseParameters(); }
@Test(expected = PatternSyntaxException.class) public void parseParametersBadRegexInput() throws Exception { remover.payloadPaths = new ArrayList<>(); remover.payloadPaths.add("/content/dam/.*"); remover.payloadPaths.add("["); remover.olderThanVal = "2019-08-24T00:00:00"; remover.modelIds = new ArrayList<>(); remover.modelIds.add("/var/workflow/models/dam/update_asset"); remover.modelIds.add("/var/workflow/models/dam/process_subasset"); remover.modelIds.add("/var/workflow/models/request_for_deletion"); remover.statuses = new ArrayList<>(); remover.statuses.add(WorkflowStatusSelector.WorkflowStatus.STALE.name()); remover.statuses.add(WorkflowStatusSelector.WorkflowStatus.ABORTED.name()); remover.statuses.add(WorkflowStatusSelector.WorkflowStatus.COMPLETED.name()); remover.statuses.add(WorkflowStatusSelector.WorkflowStatus.SUSPENDED.name()); remover.parseParameters(); }