diff --git a/README.md b/README.md index cc6568b79..b64dd3bb7 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-dialogflow-cx | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| Configure Webhook To Set Form Parameters As Optional Or Required | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/ConfigureWebhookToSetFormParametersAsOptionalOrRequired.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/ConfigureWebhookToSetFormParametersAsOptionalOrRequired.java) | | Create Agent | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/CreateAgent.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/CreateAgent.java) | | Create Flow | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/CreateFlow.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/CreateFlow.java) | | Create Intent | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/CreateIntent.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/CreateIntent.java) | @@ -99,6 +100,8 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-dialogflow-cx | List Test Case Results | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/ListTestCaseResults.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/ListTestCaseResults.java) | | List Training Phrases | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/ListTrainingPhrases.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/ListTrainingPhrases.java) | | Update Intent | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/UpdateIntent.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/UpdateIntent.java) | +| Webhook Configure Session Parameters | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/WebhookConfigureSessionParameters.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/WebhookConfigureSessionParameters.java) | +| Webhook Validate Form Parameter | [source code](https://github.com/googleapis/java-dialogflow-cx/blob/main/samples/snippets/src/main/java/dialogflow/cx/WebhookValidateFormParameter.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-dialogflow-cx&page=editor&open_in_editor=samples/snippets/src/main/java/dialogflow/cx/WebhookValidateFormParameter.java) | diff --git a/samples/snippets/src/main/java/dialogflow/cx/ConfigureWebhookToSetFormParametersAsOptionalOrRequired.java b/samples/snippets/src/main/java/dialogflow/cx/ConfigureWebhookToSetFormParametersAsOptionalOrRequired.java new file mode 100644 index 000000000..2db56b5de --- /dev/null +++ b/samples/snippets/src/main/java/dialogflow/cx/ConfigureWebhookToSetFormParametersAsOptionalOrRequired.java @@ -0,0 +1,84 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dialogflow.cx; + +// The following snippet is used in https://cloud.google.com/dialogflow/cx/docs/concept/webhook + +// [START dialogflow_cx_v3_configure_webhooks_to_set_form_parameter_as_optional_or_required] + +// TODO: Change class name to Example +// TODO: Uncomment the line below before running cloud function +// package com.example; + +import com.google.cloud.functions.HttpFunction; +import com.google.cloud.functions.HttpRequest; +import com.google.cloud.functions.HttpResponse; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import java.io.BufferedWriter; + +public class ConfigureWebhookToSetFormParametersAsOptionalOrRequired implements HttpFunction { + @Override + public void service(HttpRequest request, HttpResponse response) throws Exception { + JsonObject parameterObject = new JsonObject(); + parameterObject.addProperty("display_name", "order_number"); + parameterObject.addProperty("required", "true"); + parameterObject.addProperty("state", "VALID"); + + JsonArray parameterInfoList = new JsonArray(); + parameterInfoList.add(parameterObject); + + JsonObject parameterInfoObject = new JsonObject(); + parameterInfoObject.add("parameter_info", parameterInfoList); + + JsonObject formInfo = new JsonObject(); + formInfo.add("form_info", parameterInfoObject); + + // Constructs the webhook response object + JsonObject webhookResponse = new JsonObject(); + webhookResponse.add("page_info", formInfo); + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String jsonResponseObject = gson.toJson(webhookResponse); + + System.out.println("Response Object: \n"); + System.out.println(jsonResponseObject.toString()); + + /* { + * "page_info": { + * "form_info": { + * "parameter_info": [ + * { + * "display_name": "order_number", + * "required": "true", + * "state": "VALID" + * } + * ] + * } + * } + * } + */ + + BufferedWriter writer = response.getWriter(); + + // Sends the responseObject + writer.write(jsonResponseObject.toString()); + } +} +// [END dialogflow_cx_v3_configure_webhooks_to_set_form_parameter_as_optional_or_required] diff --git a/samples/snippets/src/main/java/dialogflow/cx/WebhookConfigureSessionParameters.java b/samples/snippets/src/main/java/dialogflow/cx/WebhookConfigureSessionParameters.java new file mode 100644 index 000000000..e9c026314 --- /dev/null +++ b/samples/snippets/src/main/java/dialogflow/cx/WebhookConfigureSessionParameters.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dialogflow.cx; + +// The following snippet is used in https://cloud.google.com/dialogflow/cx/docs/concept/webhook +// Configures a webhook to set a session parameter + +// [START dialogflow_cx_v3_webhook_configure_session_parameters] + +// TODO: Change class name to Example +// TODO: Uncomment the line below before running cloud function +// package com.example; + +import com.google.cloud.functions.HttpFunction; +import com.google.cloud.functions.HttpRequest; +import com.google.cloud.functions.HttpResponse; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import java.io.BufferedWriter; + +public class WebhookConfigureSessionParameters implements HttpFunction { + @Override + public void service(HttpRequest request, HttpResponse response) throws Exception { + JsonObject orderParameter = new JsonObject(); + orderParameter.addProperty("order_number", "12345"); + + JsonObject parameterObject = new JsonObject(); + parameterObject.add("parameters", orderParameter); + + // Creates webhook response object + JsonObject webhookResponse = new JsonObject(); + webhookResponse.add("session_info", parameterObject); + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String jsonResponseObject = gson.toJson(webhookResponse); + + System.out.println("Session Parameter Info: \n"); + System.out.println(jsonResponseObject.toString()); + + /** { "session_info": { "parameters": { "order_number": "12345" } } } */ + BufferedWriter writer = response.getWriter(); + // Sends the webhookResponseObject + writer.write(jsonResponseObject.toString()); + } +} +// [END dialogflow_cx_v3_webhook_configure_session_parameters] diff --git a/samples/snippets/src/main/java/dialogflow/cx/WebhookValidateFormParameter.java b/samples/snippets/src/main/java/dialogflow/cx/WebhookValidateFormParameter.java new file mode 100644 index 000000000..fadbef573 --- /dev/null +++ b/samples/snippets/src/main/java/dialogflow/cx/WebhookValidateFormParameter.java @@ -0,0 +1,81 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dialogflow.cx; + +// The following snippet is used in https://cloud.google.com/dialogflow/cx/docs/concept/webhook + +// [START dialogflow_cx_v3_configure_webhooks_to_set_form_parameter_as_optional_or_required] + +// TODO: Change class name to Example +// TODO: Uncomment the line below before running cloud function +// package com.example; + +import com.google.cloud.functions.HttpFunction; +import com.google.cloud.functions.HttpRequest; +import com.google.cloud.functions.HttpResponse; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import java.io.BufferedWriter; + +public class WebhookValidateFormParameter implements HttpFunction { + @Override + public void service(HttpRequest request, HttpResponse response) throws Exception { + JsonObject sessionInfo = new JsonObject(); + JsonObject sessionParameter = new JsonObject(); + + sessionParameter.addProperty("order_number", "null"); + sessionInfo.add("parameters", sessionParameter); + + JsonObject parameterObject = new JsonObject(); + parameterObject.addProperty("display_name", "order_number"); + parameterObject.addProperty("required", "true"); + parameterObject.addProperty("state", "INVALID"); + parameterObject.addProperty("value", "123"); + + JsonArray parameterInfoList = new JsonArray(); + parameterInfoList.add(parameterObject); + + JsonObject parameterInfoObject = new JsonObject(); + parameterInfoObject.add("parameter_info", parameterInfoList); + + JsonObject pageInfo = new JsonObject(); + pageInfo.add("form_info", parameterInfoObject); + + // Constructs the webhook response object + JsonObject webhookResponse = new JsonObject(); + webhookResponse.add("page_info", pageInfo); + webhookResponse.add("session_info", sessionInfo); + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String jsonResponseObject = gson.toJson(webhookResponse); + + System.out.println("Response Object: \n"); + System.out.println(jsonResponseObject.toString()); + /** + * { "page_info": { "form_info": { "parameter_info": [ { "display_name": "order_number", + * "required": "true", "state": "INVALID", "value": "123" } ] } }, "session_info": { + * "parameters": { "order_number": "null" } } } + */ + BufferedWriter writer = response.getWriter(); + + // Sends the responseObject + writer.write(jsonResponseObject.toString()); + } +} +// [END dialogflow_cx_v3_configure_webhooks_to_set_form_parameter_as_optional_or_required] diff --git a/samples/snippets/src/test/java/dialogflow/cx/ConfigureWebhookToSetFormParametersAsOptionalOrRequiredIT.java b/samples/snippets/src/test/java/dialogflow/cx/ConfigureWebhookToSetFormParametersAsOptionalOrRequiredIT.java new file mode 100644 index 000000000..b9a051bf7 --- /dev/null +++ b/samples/snippets/src/test/java/dialogflow/cx/ConfigureWebhookToSetFormParametersAsOptionalOrRequiredIT.java @@ -0,0 +1,98 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dialogflow.cx; + +import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.when; + +import com.google.cloud.dialogflow.cx.v3beta1.WebhookRequest; +import com.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo; +import com.google.cloud.functions.HttpRequest; +import com.google.cloud.functions.HttpResponse; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +public class ConfigureWebhookToSetFormParametersAsOptionalOrRequiredIT { + + @Mock HttpRequest request; + @Mock HttpResponse response; + + BufferedReader jsonReader; + StringReader stringReader; + BufferedWriter writerOut; + StringWriter responseOut; + + @Before + public void beforeTest() throws IOException { + MockitoAnnotations.initMocks(this); + + stringReader = new StringReader("{'fulfillmentInfo': {'tag': 'validate-form-parameter'}}"); + jsonReader = new BufferedReader(stringReader); + + responseOut = new StringWriter(); + writerOut = new BufferedWriter(responseOut); + + when(request.getReader()).thenReturn(jsonReader); + when(response.getWriter()).thenReturn(writerOut); + } + + @Test + public void helloHttp_bodyParamsPost() throws IOException, Exception { + + FulfillmentInfo fulfillmentInfo = + FulfillmentInfo.newBuilder().setTag("configure-session-parameters").build(); + + WebhookRequest webhookRequest = + WebhookRequest.newBuilder().setFulfillmentInfo(fulfillmentInfo).build(); + + new ConfigureWebhookToSetFormParametersAsOptionalOrRequired().service(request, response); + writerOut.flush(); + + JsonObject parameterObject = new JsonObject(); + parameterObject.addProperty("display_name", "order_number"); + parameterObject.addProperty("required", "true"); + parameterObject.addProperty("state", "VALID"); + + JsonArray parameterInfoList = new JsonArray(); + parameterInfoList.add(parameterObject); + + JsonObject parameterInfoObject = new JsonObject(); + parameterInfoObject.add("parameter_info", parameterInfoList); + + JsonObject formInfo = new JsonObject(); + formInfo.add("form_info", parameterInfoObject); + + JsonObject webhookResponse = new JsonObject(); + webhookResponse.add("page_info", formInfo); + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String expectedResponse = gson.toJson(webhookResponse); + + assertThat(responseOut.toString()).isEqualTo(expectedResponse); + } +} diff --git a/samples/snippets/src/test/java/dialogflow/cx/WebhookConfigureSessionParametersIT.java b/samples/snippets/src/test/java/dialogflow/cx/WebhookConfigureSessionParametersIT.java new file mode 100644 index 000000000..52cd6470d --- /dev/null +++ b/samples/snippets/src/test/java/dialogflow/cx/WebhookConfigureSessionParametersIT.java @@ -0,0 +1,86 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dialogflow.cx; + +import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.when; + +import com.google.cloud.dialogflow.cx.v3beta1.WebhookRequest; +import com.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo; +import com.google.cloud.functions.HttpRequest; +import com.google.cloud.functions.HttpResponse; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +public class WebhookConfigureSessionParametersIT { + + @Mock HttpRequest request; + @Mock HttpResponse response; + + BufferedReader jsonReader; + StringReader stringReader; + BufferedWriter writerOut; + StringWriter responseOut; + + @Before + public void beforeTest() throws IOException { + MockitoAnnotations.initMocks(this); + + stringReader = new StringReader("{'fulfillmentInfo': {'tag': 'validate-form-parameter'}}"); + jsonReader = new BufferedReader(stringReader); + + responseOut = new StringWriter(); + writerOut = new BufferedWriter(responseOut); + + when(request.getReader()).thenReturn(jsonReader); + when(response.getWriter()).thenReturn(writerOut); + } + + @Test + public void helloHttp_bodyParamsPost() throws IOException, Exception { + FulfillmentInfo fulfillmentInfo = + FulfillmentInfo.newBuilder().setTag("configure-session-parameters").build(); + + WebhookRequest webhookRequest = + WebhookRequest.newBuilder().setFulfillmentInfo(fulfillmentInfo).build(); + + new WebhookConfigureSessionParameters().service(request, response); + writerOut.flush(); + + JsonObject webhookResponse = new JsonObject(); + JsonObject parameterObject = new JsonObject(); + JsonObject orderParameter = new JsonObject(); + orderParameter.addProperty("order_number", "12345"); + parameterObject.add("parameters", orderParameter); + webhookResponse.add("session_info", parameterObject); + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String expectedResponse = gson.toJson(webhookResponse); + + assertThat(responseOut.toString()).isEqualTo(expectedResponse); + } +} diff --git a/samples/snippets/src/test/java/dialogflow/cx/WebhookValidateFormParameterIT.java b/samples/snippets/src/test/java/dialogflow/cx/WebhookValidateFormParameterIT.java new file mode 100644 index 000000000..f234c3f3e --- /dev/null +++ b/samples/snippets/src/test/java/dialogflow/cx/WebhookValidateFormParameterIT.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dialogflow.cx; + +import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.when; + +import com.google.cloud.dialogflow.cx.v3beta1.WebhookRequest; +import com.google.cloud.dialogflow.cx.v3beta1.WebhookRequest.FulfillmentInfo; +import com.google.cloud.functions.HttpRequest; +import com.google.cloud.functions.HttpResponse; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +public class WebhookValidateFormParameterIT { + + @Mock HttpRequest request; + @Mock HttpResponse response; + + BufferedReader jsonReader; + StringReader stringReader; + BufferedWriter writerOut; + StringWriter responseOut; + + @Before + public void beforeTest() throws IOException { + MockitoAnnotations.initMocks(this); + + stringReader = new StringReader("{'fulfillmentInfo': {'tag': 'validate-form-parameter'}}"); + jsonReader = new BufferedReader(stringReader); + + responseOut = new StringWriter(); + writerOut = new BufferedWriter(responseOut); + + when(request.getReader()).thenReturn(jsonReader); + when(response.getWriter()).thenReturn(writerOut); + } + + @Test + public void helloHttp_bodyParamsPost() throws IOException, Exception { + FulfillmentInfo fulfillmentInfo = + FulfillmentInfo.newBuilder().setTag("configure-session-parameters").build(); + + WebhookRequest webhookRequest = + WebhookRequest.newBuilder().setFulfillmentInfo(fulfillmentInfo).build(); + + new WebhookValidateFormParameter().service(request, response); + writerOut.flush(); + + JsonObject sessionParameter = new JsonObject(); + sessionParameter.addProperty("order_number", "null"); + + JsonObject sessionInfo = new JsonObject(); + sessionInfo.add("parameters", sessionParameter); + + JsonObject parameterObject = new JsonObject(); + parameterObject.addProperty("display_name", "order_number"); + parameterObject.addProperty("required", "true"); + parameterObject.addProperty("state", "INVALID"); + parameterObject.addProperty("value", "123"); + + JsonArray parameterInfoList = new JsonArray(); + parameterInfoList.add(parameterObject); + + JsonObject parameterInfoObject = new JsonObject(); + parameterInfoObject.add("parameter_info", parameterInfoList); + + JsonObject formInfo = new JsonObject(); + formInfo.add("form_info", parameterInfoObject); + + JsonObject webhookResponse = new JsonObject(); + webhookResponse.add("page_info", formInfo); + webhookResponse.add("session_info", sessionInfo); + + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + String expectedResponse = gson.toJson(webhookResponse); + + assertThat(responseOut.toString()).isEqualTo(expectedResponse); + } +}