Skip to content

Commit

Permalink
fix #76
Browse files Browse the repository at this point in the history
  • Loading branch information
Bindambc committed Mar 31, 2023
1 parent b6e5f7d commit fd321cb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class QuickReplyButton extends Button {
* Instantiates a new Quick reply button.
*/
protected QuickReplyButton() {

super(ButtonType.QUICK_REPLY);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class UrlButton extends Button {
* Instantiates a new Url button.
*/
protected UrlButton() {
super(ButtonType.URL);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.whatsapp.api.impl;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.whatsapp.api.MockServerUtilsTest;
import com.whatsapp.api.TestConstants;
import com.whatsapp.api.WhatsappApiFactory;
Expand All @@ -17,6 +18,7 @@
import com.whatsapp.api.domain.templates.PhoneNumberButton;
import com.whatsapp.api.domain.templates.QuickReplyButton;
import com.whatsapp.api.domain.templates.UrlButton;
import com.whatsapp.api.domain.templates.type.ButtonType;
import com.whatsapp.api.domain.templates.type.Category;
import com.whatsapp.api.domain.templates.type.HeaderFormat;
import com.whatsapp.api.domain.templates.type.LanguageType;
Expand Down Expand Up @@ -450,16 +452,21 @@ void testRetrieveMessageTemplate1() throws IOException, URISyntaxException, JSON

var templates = whatsappBusinessCloudApi.retrieveTemplates(WABA_ID);
//TODO: review button
//var returnedJson = new ObjectMapper().writeValueAsString(templates);
var returnedJson = new ObjectMapper().writeValueAsString(templates);

//JSONAssert.assertEquals(expectedJson, returnedJson,JSONCompareMode.STRICT);
JSONAssert.assertEquals(expectedJson, returnedJson,JSONCompareMode.STRICT);
// data[1].components[3].buttons[0]

Assertions.assertEquals(7, templates.data().size());
Assertions.assertEquals("welcome_template3", templates.data().get(0).name());
Assertions.assertEquals("Hello {{1}}, welcome to our {{2}} test.", templates.data().get(0).components().get(1).getText());
Assertions.assertEquals("1772832833109192", templates.data().get(6).id());

var buttonComponent = (ButtonComponent) templates.data().get(1).components().get(3);

Assertions.assertEquals(ButtonType.QUICK_REPLY,buttonComponent.getButtons().get(0).getType());


}

@Test
Expand Down

0 comments on commit fd321cb

Please sign in to comment.