Skip to content

Commit

Permalink
MSLRES-4816 Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustav committed Jan 27, 2022
1 parent df64eb0 commit 6034f89
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public void canSerializeMinimal() throws Exception {
" 'from': '1234',",
" 'to': [ '987654321' ],",
" 'canceled': false,",
" 'flash_message': false,",
" 'delivery_report': 'none',",
" 'id': '" + input.id() + "',",
" 'body': 'SGVsbG8sIHdvcmxkIQ==',",
" 'udh': '01020304'",
Expand All @@ -69,6 +71,8 @@ private static MtBatchBinarySmsResult.Builder minimalBatchBuilder() {
return new MtBatchBinarySmsResult.Builder()
.sender("1234")
.addRecipient("987654321")
.flashMessage(false)
.deliveryReport(ReportType.NONE)
.body("Hello, world!".getBytes(TestUtils.US_ASCII))
.udh(new byte[] {1, 2, 3, 4})
.canceled(false)
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/com/sinch/xms/api/MtBatchTextSmsResultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public void canSerializeMinimal() throws Exception {
" 'to': [ '987654321' ],",
" 'body': 'Hello, world!',",
" 'canceled': false,",
" 'flash_message': false,",
" 'delivery_report': 'none',",
" 'id': '" + input.id() + "'",
"}")
.replace('\'', '"');
Expand Down Expand Up @@ -86,6 +88,8 @@ public void canSerializeWithParameters() throws Exception {
" 'to': [ '987654321' ],",
" 'body': 'Hello, world!',",
" 'canceled': false,",
" 'flash_message': false,",
" 'delivery_report': 'none',",
" 'id': '" + input.id() + "',",
" 'parameters': {",
" 'param1': {",
Expand Down Expand Up @@ -142,6 +146,8 @@ public void canSerializeWithParametersAndDefault() throws Exception {
" 'to': [ '987654321' ],",
" 'body': 'Hello, world!',",
" 'canceled': false,",
" 'flash_message': false,",
" 'delivery_report': 'none',",
" 'id': '" + input.id() + "',",
" 'parameters': {",
" 'param1': {",
Expand Down Expand Up @@ -182,6 +188,8 @@ private static MtBatchTextSmsResult.Builder minimalBatchBuilder() {
return new MtBatchTextSmsResult.Builder()
.sender("1234")
.addRecipient("987654321")
.flashMessage(false)
.deliveryReport(ReportType.NONE)
.body("Hello, world!")
.canceled(false)
.id(TestUtils.freshBatchId());
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/com/sinch/xms/api/PagedBatchResultTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception {
.id(batchId1)
.createdAt(smsTime)
.modifiedAt(smsTime)
.flashMessage(false)
.deliveryReport(ReportType.NONE)
.build();

MtBatchSmsResult batchResult2 =
Expand All @@ -88,6 +90,8 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception {
.id(batchId2)
.body("foobar".getBytes(TestUtils.US_ASCII))
.udh(new byte[] {1, 2, 3})
.flashMessage(false)
.deliveryReport(ReportType.NONE)
.build();

PagedBatchResult input =
Expand Down Expand Up @@ -117,6 +121,8 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception {
" 'canceled': false,",
" 'id': '" + batchId1 + "',",
" 'from': '12345',",
" 'flash_message': false,",
" 'delivery_report': 'none',",
" 'created_at': " + smsTimeString + ",",
" 'modified_at': " + smsTimeString + "",
" },",
Expand All @@ -131,6 +137,8 @@ public void canSerializeJsonWithNonEmptyBatches() throws Exception {
" 'canceled': false,",
" 'id': '" + batchId2 + "',",
" 'from': '12345',",
" 'flash_message': false,",
" 'delivery_report': 'none',",
" 'created_at': " + smsTimeString + ",",
" 'modified_at': " + smsTimeString + "",
" }",
Expand All @@ -156,6 +164,8 @@ public void canDeserializeJsonWithNonEmptyBatches() throws Exception {
.body("Hello, world!")
.canceled(false)
.id(batchId1)
.flashMessage(false)
.deliveryReport(ReportType.NONE)
.createdAt(smsTime)
.modifiedAt(smsTime)
.build();
Expand All @@ -164,6 +174,8 @@ public void canDeserializeJsonWithNonEmptyBatches() throws Exception {
new MtBatchBinarySmsResult.Builder()
.using(batchResult1)
.id(batchId2)
.flashMessage(false)
.deliveryReport(ReportType.NONE)
.body("Hello, again!".getBytes())
.udh("udh".getBytes())
.build();
Expand Down

0 comments on commit 6034f89

Please sign in to comment.