All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.yandex.qatools.allure.events.MakeAttachEvent Maven / Gradle / Ivy

There is a newer version: 1.4.0.RC9
Show newest version
package ru.yandex.qatools.allure.events;

import ru.yandex.qatools.allure.model.Attachment;
import ru.yandex.qatools.allure.model.AttachmentType;
import ru.yandex.qatools.allure.model.Step;

import static ru.yandex.qatools.allure.utils.AllureResultsUtils.writeAttachment;

/**
 * @author Dmitry Baev [email protected]
 *         Date: 11.11.13
 */
public class MakeAttachEvent extends AbstractMakeAttachEvent {

    public MakeAttachEvent(String title, AttachmentType attachmentType, Object attach) {
        setTitle(title);
        setAttachmentType(attachmentType);
        setAttach(attach);
    }

    @Override
    public void process(Step step) {
        Attachment attachment = new Attachment();

        String source = writeAttachment(
                getAttach(),
                getAttachmentType()
        );

        attachment.setTitle(getTitle());
        attachment.setType(getAttachmentType());
        attachment.setSource(source);

        step.getAttachments().add(attachment);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy