@@ -0,0 +1,2633 @@
+package ru.yandex.qatools.allure.events;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TemporaryFolder;%0Aimport ru.yandex.qatools.allure.model.Attachment;%0Aimport ru.yandex.qatools.allure.model.AttachmentType;%0Aimport ru.yandex.qatools.allure.model.Step;%0Aimport ru.yandex.qatools.allure.utils.AllureResultsUtils;%0A%0Aimport java.io.File;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.core.Is.is;%0Aimport static ru.yandex.qatools.allure.utils.AllureResultsUtils.writeAttachment;%0Aimport static ru.yandex.qatools.allure.utils.DirectoryMatcher.contains;%0Aimport static ru.yandex.qatools.allure.utils.DirectoryMatcher.notContains;%0A%0A/**%0A * @author Dmitry Baev charlie@yandex-team.ru%0A *         Date: 05.05.14%0A */%0Apublic class RemoveAttachmentsEventTest %7B%0A%0A    @Rule%0A    public TemporaryFolder folder = new TemporaryFolder();%0A%0A    private Step root = new Step();%0A%0A    private File resultsDirectory;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        resultsDirectory = folder.newFolder();%0A        AllureResultsUtils.setResultsDirectory(resultsDirectory);%0A%0A        Step child1 = new Step().withName(%22child1%22);%0A        Step child2 = new Step().withName(%22child2%22);%0A%0A        child1.getAttachments().add(save(%22firstAttach%22));%0A        child2.getAttachments().add(save(%22secondAttach%22));%0A%0A        root.getAttachments().add(save(%22rootAttach%22));%0A        root.getSteps().add(child1);%0A        root.getSteps().add(child2);%0A    %7D%0A%0A    @Test%0A    public void removeAttachmentsByDefaultTest() throws Exception %7B%0A        String%5B%5D files = resultsDirectory.list();%0A%0A        new RemoveAttachmentsEvent(%22a%5E%22).process(root);%0A%0A        for (String file : files) %7B%0A            assertThat(resultsDirectory, contains(file));%0A        %7D%0A%0A        checkAttachmentsCount(root, 1);%0A    %7D%0A%0A    @Test%0A    public void removeAllAttachmentsTest() throws Exception %7B%0A        String%5B%5D files = resultsDirectory.list();%0A%0A        new RemoveAttachmentsEvent(%22.*%22).process(root);%0A%0A        for (String file : files) %7B%0A            assertThat(resultsDirectory, notContains(file));%0A        %7D%0A%0A        checkAttachmentsCount(root, 0);%0A    %7D%0A%0A    public void checkAttachmentsCount(Step root, int count) %7B%0A        assertThat(count, is(root.getAttachments().size()));%0A        for (Step step : root.getSteps()) %7B%0A            checkAttachmentsCount(step, count);%0A        %7D%0A    %7D%0A%0A    public Attachment save(String string) %7B%0A        String source = writeAttachment(string, AttachmentType.TXT);%0A%0A        return new Attachment().withSource(source).withType(AttachmentType.TXT).withTitle(%22other-title%22);%0A    %7D%0A%0A%7D%0A

add remove attachment event test