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.
 */
class CreateTestExecutionResponse {
    public final TestExecutionId executionId;

    public final Optional<TestRunId> optTestRunId;

    CreateTestExecutionResponse(TestExecutionId executionId, Optional<TestRunId> optTestRunId) {
        this.executionId = executionId;
        this.optTestRunId = optTestRunId;
    }

    @JsonCreator()
    public static CreateTestExecutionResponse fromJson(JsonNode json) {
        TestExecutionId executionId = TestExecutionId.of(json.get("textExecutionId").asText());
        Optional<TestRunId> testRunId = Optional.absent();

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

@@ -352,16 +352,23 @@
 Id.%0A */%0A
+public 
 class Cr
@@ -395,16 +395,16 @@
 ponse %7B%0A
-
     publ
@@ -498,16 +498,23 @@
 d;%0A%0A    
+public 
 CreateTe
@@ -847,17 +847,17 @@
 .get(%22te
-x
+s
 tExecuti
@@ -863,22 +863,25 @@
 ionId%22).
-asText
+textValue
 ());%0A   
@@ -1049,14 +1049,17 @@
 d%22).
-asText
+textValue
 ()))

Fix for changed createTestExecution API WMKNBN-6045