From bdcfc1e2b15bfd367fd3b24b8847e327c1bbccff Mon Sep 17 00:00:00 2001 From: Mauricio Binda da Costa Date: Sat, 25 Mar 2023 19:50:52 -0300 Subject: [PATCH] test update --- .../whatsapp/api/impl/WhatsappBusinessCloudApiTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/whatsapp/api/impl/WhatsappBusinessCloudApiTest.java b/src/test/java/com/whatsapp/api/impl/WhatsappBusinessCloudApiTest.java index 4881b0bfb..8e38dd5cd 100644 --- a/src/test/java/com/whatsapp/api/impl/WhatsappBusinessCloudApiTest.java +++ b/src/test/java/com/whatsapp/api/impl/WhatsappBusinessCloudApiTest.java @@ -337,9 +337,11 @@ void testSendTemplateDocumentPdfMessage() throws IOException, URISyntaxException @Test - void testSendAudioMessage() throws IOException, URISyntaxException, InterruptedException { + void testSendAudioMessage() throws IOException, URISyntaxException, InterruptedException, JSONException { mockWebServer.enqueue(new MockResponse().setResponseCode(200).setBody(DEFAULT_SEND_MESSAGE_RESPONSE)); + var expectedJson = fromResource(EXPECTED_FOLDER + "expectedMessage7.json"); + var message = MessageBuilder.builder()// .setTo(PHONE_NUMBER_1)// .buildAudioMessage(new AudioMessage()// @@ -352,7 +354,9 @@ void testSendAudioMessage() throws IOException, URISyntaxException, InterruptedE Assertions.assertEquals("POST", recordedRequest.getMethod()); Assertions.assertEquals("/" + API_VERSION + "/" + PHONE_NUMBER_ID + "/messages", recordedRequest.getPath()); - Assertions.assertEquals(String.format("{\"messaging_product\":\"whatsapp\",\"recipient_type\":\"individual\",\"to\":\"%s\",\"type\":\"audio\",\"audio\":{\"id\":\"4545454545454\"}}", PHONE_NUMBER_1), recordedRequest.getBody().readUtf8()); + //System.out.println(recordedRequest.getBody().readUtf8()); + + JSONAssert.assertEquals(expectedJson, recordedRequest.getBody().readUtf8(), JSONCompareMode.STRICT); Assertions.assertEquals("wamid.gBGGSFcCNEOPAgkO_KJ55r4w_ww", response.messages().get(0).id()); }