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

com.testfabrik.webmate.javasdk.testmgmt.CreateTestExecutionResponse Maven / Gradle / Ivy

There is a newer version: 0.56
Show newest version
package com.testfabrik.webmate.javasdk.testmgmt;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Optional;
import com.testfabrik.webmate.javasdk.JacksonMapper;

/**
 * Contains TestExecutionId and optionally TestRunId.
 */
public class CreateTestExecutionResponse {
    public final TestExecutionId executionId;

    public final Optional optTestRunId;

    public CreateTestExecutionResponse(TestExecutionId executionId, Optional optTestRunId) {
        this.executionId = executionId;
        this.optTestRunId = optTestRunId;
    }

    @JsonCreator()
    public static CreateTestExecutionResponse fromJson(JsonNode json) {
        TestExecutionId executionId = TestExecutionId.of(json.get("testExecutionId").textValue());
        Optional testRunId = Optional.absent();

        if (json.has("testRunId")) {
            testRunId = Optional.of(TestRunId.of(json.get("testRunId").textValue()));
        }
        return new CreateTestExecutionResponse(executionId, testRunId);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy