@@ -22,7 +22,7 @@ public void testIllegalOverrideMsgId() {
2222
2323 @ Test (expected = IllegalArgumentException .class )
2424 public void testIllegalTimeToLive () {
25- Options .newBuilder ().setTimeToLive (-1 ).build ();
25+ Options .newBuilder ().setTimeToLive (-2 ).build ();
2626 }
2727
2828 @ Test
@@ -34,6 +34,44 @@ public void testSendno() {
3434 Assert .assertEquals ("" , json , options .toJSON ());
3535 }
3636
37+ @ Test
38+ public void testTimeToLive_int () {
39+ JsonObject json = new JsonObject ();
40+ json .add ("sendno" , new JsonPrimitive (111 ));
41+ json .add ("apns_production" , new JsonPrimitive (false ));
42+ json .add ("time_to_live" , new JsonPrimitive (640 ));
43+
44+ Options options = Options .newBuilder ()
45+ .setSendno (111 )
46+ .setTimeToLive (640 ).build ();
47+ Assert .assertEquals ("" , json , options .toJSON ());
48+ }
49+
50+ @ Test
51+ public void testTimeToLive_0 () {
52+ JsonObject json = new JsonObject ();
53+ json .add ("sendno" , new JsonPrimitive (111 ));
54+ json .add ("apns_production" , new JsonPrimitive (false ));
55+ json .add ("time_to_live" , new JsonPrimitive (0 ));
56+
57+ Options options = Options .newBuilder ()
58+ .setSendno (111 )
59+ .setTimeToLive (0 ).build ();
60+ Assert .assertEquals ("" , json , options .toJSON ());
61+ }
62+
63+ @ Test
64+ public void testTimeToLive_default () {
65+ JsonObject json = new JsonObject ();
66+ json .add ("sendno" , new JsonPrimitive (111 ));
67+ json .add ("apns_production" , new JsonPrimitive (false ));
68+
69+ Options options = Options .newBuilder ()
70+ .setSendno (111 )
71+ .setTimeToLive (-1 ).build ();
72+ Assert .assertEquals ("" , json , options .toJSON ());
73+ }
74+
3775 @ Test
3876 public void testApnsProduction_defaultFalse () {
3977 int sendno = ServiceHelper .generateSendno ();
0 commit comments