diff --git a/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/types/GoalInvocationId.java b/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/types/GoalInvocationId.java index 07acdc4cf6..9694940c7a 100644 --- a/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/types/GoalInvocationId.java +++ b/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/types/GoalInvocationId.java @@ -1,3 +1,12 @@ package gov.nasa.jpl.aerie.e2e.types; -public record GoalInvocationId(int goalId, int invocationId) { } +import javax.json.JsonObject; + +public record GoalInvocationId(int goalId, int invocationId) { + public static GoalInvocationId fromJSON(JsonObject json) { + return new GoalInvocationId( + json.getInt("goal_id"), + json.getInt("goal_invocation_id") + ); + } +} diff --git a/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/utils/HasuraRequests.java b/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/utils/HasuraRequests.java index 71a81e6ea6..385dc3327e 100644 --- a/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/utils/HasuraRequests.java +++ b/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/utils/HasuraRequests.java @@ -700,7 +700,7 @@ public GoalInvocationId createSchedulingSpecProcedure( final var resp = makeRequest(GQL.CREATE_SCHEDULING_SPEC_GOAL, variables) .getJsonObject("insert_scheduling_specification_goals_one"); - return new GoalInvocationId(resp.getInt("goal_id"), resp.getInt("goal_invocation_id")); + return GoalInvocationId.fromJSON(resp); } public GoalInvocationId createSchedulingSpecGoal( @@ -738,7 +738,7 @@ public GoalInvocationId createSchedulingSpecGoal( final var resp = makeRequest(GQL.CREATE_SCHEDULING_SPEC_GOAL, variables) .getJsonObject("insert_scheduling_specification_goals_one"); - return new GoalInvocationId(resp.getInt("goal_id"), resp.getInt("goal_invocation_id")); + return GoalInvocationId.fromJSON(resp); } public int updateGoalDefinition(int goalId, String definition) throws IOException {