diff --git a/src/test/java/org/opensearch/flowframework/transport/WorkflowRequestResponseTests.java b/src/test/java/org/opensearch/flowframework/transport/WorkflowRequestResponseTests.java index 85541e0c8..ab4d4a068 100644 --- a/src/test/java/org/opensearch/flowframework/transport/WorkflowRequestResponseTests.java +++ b/src/test/java/org/opensearch/flowframework/transport/WorkflowRequestResponseTests.java @@ -10,8 +10,12 @@ import org.opensearch.Version; import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.xcontent.XContentType; import org.opensearch.core.common.bytes.BytesReference; import org.opensearch.core.common.io.stream.BytesStreamInput; +import org.opensearch.core.xcontent.MediaTypeRegistry; +import org.opensearch.core.xcontent.ToXContent; +import org.opensearch.core.xcontent.XContentBuilder; import org.opensearch.flowframework.model.Template; import org.opensearch.flowframework.model.Workflow; import org.opensearch.flowframework.model.WorkflowEdge; @@ -55,6 +59,7 @@ public void testNullIdWorkflowRequest() throws IOException { WorkflowRequest nullIdRequest = new WorkflowRequest(null, template); assertNull(nullIdRequest.getWorkflowId()); assertEquals(template, nullIdRequest.getTemplate()); + assertNull(nullIdRequest.validate()); BytesStreamOutput out = new BytesStreamOutput(); nullIdRequest.writeTo(out); @@ -70,6 +75,7 @@ public void testNullTemplateWorkflowRequest() throws IOException { WorkflowRequest nullTemplateRequest = new WorkflowRequest("123", null); assertNotNull(nullTemplateRequest.getWorkflowId()); assertNull(nullTemplateRequest.getTemplate()); + assertNull(nullTemplateRequest.validate()); BytesStreamOutput out = new BytesStreamOutput(); nullTemplateRequest.writeTo(out); @@ -85,6 +91,7 @@ public void testWorkflowRequest() throws IOException { WorkflowRequest workflowRequest = new WorkflowRequest("123", template); assertNotNull(workflowRequest.getWorkflowId()); assertEquals(template, workflowRequest.getTemplate()); + assertNull(workflowRequest.validate()); BytesStreamOutput out = new BytesStreamOutput(); workflowRequest.writeTo(out); @@ -106,8 +113,12 @@ public void testWorkflowResponse() throws IOException { BytesStreamInput in = new BytesStreamInput(BytesReference.toBytes(out.bytes())); WorkflowResponse streamInputResponse = new WorkflowResponse(in); - assertEquals(response.getWorkflowId(), streamInputResponse.getWorkflowId()); + + XContentBuilder builder = MediaTypeRegistry.contentBuilder(XContentType.JSON); + response.toXContent(builder, ToXContent.EMPTY_PARAMS); + assertNotNull(builder); + assertEquals("{\"workflow_id\":\"123\"}", builder.toString()); } }