### Question:
RemoveAttachmentsEvent extends AbstractRemoveAttachmentEvent { @Override public void process(Step context) { Iterator<Attachment> iterator = context.getAttachments().listIterator(); while (iterator.hasNext()) { Attachment attachment = iterator.next(); if (pattern.matcher(attachment.getSource()).matches()) { deleteAttachment(attachment); iterator.remove(); } } for (Step step : context.getSteps()) { process(step); } } RemoveAttachmentsEvent(String regex); @Override void process(Step context);  }### Answer:
@Test public void shouldNotDeleteAnyByDefault() throws Exception { String[] files = resultsDirectory.list(); new RemoveAttachmentsEvent("a^").process(root); for (String file : files) { assertThat(resultsDirectory, contains(file)); } checkAttachmentsCount(root, 1); }
@Test public void removeAllAttachmentsTest() throws Exception { String[] files = resultsDirectory.list(); new RemoveAttachmentsEvent(".*").process(root); for (String file : files) { assertThat(resultsDirectory, notContains(file)); } checkAttachmentsCount(root, 0); }