Skip to content

Commit

Permalink
maven spotless applied
Browse files Browse the repository at this point in the history
  • Loading branch information
ib-tjuhasz committed Nov 18, 2024
1 parent b65dc29 commit 761409c
Showing 1 changed file with 37 additions and 41 deletions.
78 changes: 37 additions & 41 deletions src/test/java/com/infobip/api/MessagesApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,60 +120,56 @@ void shouldSendValidateMessagesApiMessage() {
String givenTo = "111111111";
String givenMessageText = "May the Force be with you.";
String givenTextType = "TEXT";
String givenDescription = "Request can be sent through '/messages' endpoint and should be accepted by our platform.";
String givenDescription =
"Request can be sent through '/messages' endpoint and should be accepted by our platform.";
String givenAction = "No action is required, but it is recommended to check and address any violations.";
String givenProperty = "messages[0].metadata";
String givenViolation = "Unknown property";

String givenResponse = String.format(
"{\n" +
" \"description\": \"%s\",\n" +
" \"action\": \"%s\",\n" +
" \"skippableViolations\": [\n" +
" {\n" +
" \"property\": \"%s\",\n" +
" \"violation\": \"%s\"\n" +
" }\n" +
" ]\n" +
"}",
givenDescription, givenAction, givenProperty, givenViolation);
"{\n" + " \"description\": \"%s\",\n"
+ " \"action\": \"%s\",\n"
+ " \"skippableViolations\": [\n"
+ " {\n"
+ " \"property\": \"%s\",\n"
+ " \"violation\": \"%s\"\n"
+ " }\n"
+ " ]\n"
+ "}",
givenDescription, givenAction, givenProperty, givenViolation);

String expectedRequest = String.format(
"{\n" +
" \"messages\": [\n" +
" {\n" +
" \"channel\": \"%s\",\n" +
" \"sender\": \"%s\",\n" +
" \"destinations\": [\n" +
" {\n" +
" \"to\": \"%s\"\n" +
" }\n" +
" ],\n" +
" \"content\": {\n" +
" \"body\": {\n" +
" \"text\": \"%s\",\n" +
" \"type\": \"%s\"\n" +
" }\n" +
" }\n" +
" }\n" +
" ]\n" +
"}",
givenChannel, givenSender, givenTo, givenMessageText, givenTextType);
"{\n" + " \"messages\": [\n"
+ " {\n"
+ " \"channel\": \"%s\",\n"
+ " \"sender\": \"%s\",\n"
+ " \"destinations\": [\n"
+ " {\n"
+ " \"to\": \"%s\"\n"
+ " }\n"
+ " ],\n"
+ " \"content\": {\n"
+ " \"body\": {\n"
+ " \"text\": \"%s\",\n"
+ " \"type\": \"%s\"\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ " ]\n"
+ "}",
givenChannel, givenSender, givenTo, givenMessageText, givenTextType);

setUpSuccessPostRequest(VALIDATE, expectedRequest, givenResponse);

MessagesApi api = new MessagesApi(getApiClient());

var request = new MessagesApiRequest()
.messages(List.of(new MessagesApiMessage()
.channel(givenChannel)
.sender(givenSender)
.destinations(List.of(new MessagesApiToDestination().to(givenTo)))
.content(new MessagesApiMessageContent()
.body(new MessagesApiMessageTextBody()
.text(givenMessageText))
))
);
.messages(List.of(new MessagesApiMessage()
.channel(givenChannel)
.sender(givenSender)
.destinations(List.of(new MessagesApiToDestination().to(givenTo)))
.content(new MessagesApiMessageContent()
.body(new MessagesApiMessageTextBody().text(givenMessageText)))));

Consumer<MessagesApiValidationOkResponse> assertions = (response) -> {
then(response).isNotNull();
Expand Down

0 comments on commit 761409c

Please sign in to comment.