Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #90 from khaing211/master
Browse files Browse the repository at this point in the history
#89 DeliveryReceipt, err:null error
  • Loading branch information
jjlauer committed Apr 17, 2015
2 parents 655e2e0 + 9efd875 commit bb9f370
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public DeliveryReceipt(String messageId, int submitCount,
this.submitDate = submitDate;
this.doneDate = doneDate;
this.state = state;
this.errorCode = errorCode;
setErrorCode(errorCode);
this.text = text;
}

Expand Down
11 changes: 11 additions & 0 deletions src/test/java/com/cloudhopper/smpp/util/DeliveryReceiptTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,17 @@ public void toShortMessageWith11DigitLongMessageId() {
Assert.assertEquals("id:12345678901 sub:000 dlvrd:000 submit date:0000000000 done date:0000000000 stat:BADSTAT err:000 text:", receipt0);
}


@Test
public void toShortMessageWithFullConstructor() throws DeliveryReceiptException {
DeliveryReceipt dlr = new DeliveryReceipt("12345", 1, 1, new DateTime(0L, DateTimeZone.UTC),
new DateTime(0L, DateTimeZone.UTC), SmppConstants.STATE_ENROUTE, 0, "text");

String receipt = dlr.toShortMessage();

Assert.assertEquals("id:12345 sub:001 dlvrd:001 submit date:7001010000 done date:7001010000 stat:ENROUTE err:000 text:text", receipt);
}

@Test
public void parseShortMessageWith11DigitLongMessageId() throws Exception {
DeliveryReceipt dlr = DeliveryReceipt.parseShortMessage("id:98765432101 sub:000 dlvrd:000 submit date:1001010000 done date:1001010000 stat:ENROUTE err:000 text:", DateTimeZone.UTC);
Expand Down

0 comments on commit bb9f370

Please sign in to comment.