@Test public void testSetExpirationTime() { ParsePush push = new ParsePush(); push.setExpirationTime(10000); // Right now it is hard for us to test a builder, so we build a state to test the builder is // set correctly // We have to set message otherwise build() will throw an exception push.setMessage("message"); ParsePush.State state = push.builder.build(); assertEquals(10000, state.expirationTime().longValue()); }
@Test public void testClearExpiration() { ParsePush push = new ParsePush(); push.setExpirationTimeInterval(10000); // Right now it is hard for us to test a builder, so we build a state to test the builder is // set correctly // We have to set message otherwise build() will throw an exception push.setMessage("message"); // Make sure interval has value before clear ParsePush.State state = push.builder.build(); assertEquals(10000, state.expirationTimeInterval().longValue()); // Make sure interval is empty after clear push.clearExpiration(); state = push.builder.build(); assertNull(state.expirationTimeInterval()); push.setExpirationTime(200); // Make sure expiration time has value before clear state = push.builder.build(); assertEquals(200, state.expirationTime().longValue()); // Make sure interval is empty after clear push.clearExpiration(); state = push.builder.build(); assertNull(state.expirationTime()); }