Skip to content

Commit 3c402ca

Browse files
verifying content variables in request
1 parent df11dd7 commit 3c402ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

saas-modules/twilio-whatsapp/src/test/java/com/baeldung/twilio/whatsapp/WhatsAppMessageDispatcherIntegrationTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ void whenNewArticleNotificationDispatched_thenTwilioApiCalledWithCorrectParamete
6060
String contentSid = twilioConfigurationProperties.getNewArticleNotification().getContentSid();
6161
String messagingSid = twilioConfigurationProperties.getMessagingSid();
6262
String contactNumber = "+911001001000";
63+
String articleUrl = RandomString.make();
6364

6465
// Configure mock server expectations
6566
mockServerClient
@@ -69,6 +70,7 @@ void whenNewArticleNotificationDispatched_thenTwilioApiCalledWithCorrectParamete
6970
.withBody(new ParameterBody(
7071
param("To", String.format("whatsapp:%s", contactNumber)),
7172
param("ContentSid", contentSid),
73+
param("ContentVariables", String.format("{\"ArticleURL\":\"%s\"}", articleUrl)),
7274
param("MessagingServiceSid", messagingSid)
7375
))
7476
)
@@ -77,7 +79,7 @@ void whenNewArticleNotificationDispatched_thenTwilioApiCalledWithCorrectParamete
7779
.withBody(EMPTY_JSON));
7880

7981
// Invoke method under test
80-
whatsAppMessageDispatcher.dispatchNewArticleNotification(contactNumber, RandomString.make());
82+
whatsAppMessageDispatcher.dispatchNewArticleNotification(contactNumber, articleUrl);
8183

8284
// Verify the expected request was made
8385
mockServerClient.verify(request()

0 commit comments

Comments
 (0)