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

net.masterthought.cucumber.json.deserializers.StatusDeserializer 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.json.deserializers;

import java.util.Arrays;
import java.util.List;

import com.fasterxml.jackson.databind.JsonNode;

import net.masterthought.cucumber.Configuration;
import net.masterthought.cucumber.json.support.Status;

/**
 * Deserializes Status and maps all known but not supported into UNDEFINED status.
 *
 * @author Damian Szczepanik (damianszczepanik@github)
 */
public class StatusDeserializer extends CucumberJsonDeserializer {

    // https://github.com/cucumber/cucumber-js/blob/master/lib/cucumber/status.js
    static final List UNKNOWN_STATUSES = Arrays.asList("ambiguous");

    @Override
    public Status deserialize(JsonNode rootNode, Configuration configuration) {

        String status = rootNode.asText();
        if (UNKNOWN_STATUSES.contains(status)) {
            return Status.UNDEFINED;
        } else {
            return Status.valueOf(status.toUpperCase());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy