Skip to content

Commit

Permalink
test update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bindambc committed Mar 25, 2023
1 parent fcc5dc1 commit bdcfc1e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()//
Expand All @@ -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());
}
Expand Down

0 comments on commit bdcfc1e

Please sign in to comment.