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

net.masterthought.cucumber.ArtifactProcessor Maven / Gradle / Ivy

Go to download

Provides pretty html reports for Cucumber. It works by generating html from the cucumber json file.

There is a newer version: 5.8.2
Show newest version
package net.masterthought.cucumber;

import net.masterthought.cucumber.json.Artifact;

import java.util.HashMap;
import java.util.Map;

public class ArtifactProcessor {

    private String configuration;

    public ArtifactProcessor(String configuration) {
        this.configuration = configuration;
    }

    public Map process() {
        Map map = new HashMap<>();
        String[] lines = configuration.split("\\n");
        for (String line : lines) {
            String[] data = line.split("~");
            if (data.length == 5) {
                String scenario = data[0].trim();
                String step = data[1].trim();
                String keyword = data[2].trim();
                String artifactFile = data[3].trim();
                String contentType = data[4].trim();
                map.put(scenario + step, new Artifact(scenario, step, keyword, artifactFile, contentType));
            } else {
                throw new IllegalArgumentException(
                        "Error configuration should have 5 parts: Scenario ~ Step ~ Keyword ~ Artifact File ~ ContentType");
            }
        }
        return map;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy