SubscribeOptions { public static SubscribeOptionsBuilder builder() { return new SubscribeOptionsBuilder(); } private  SubscribeOptions(boolean autoConfirm, int credit, QOS qos, String shareName, long ttl); boolean getAutoConfirm(); int getCredit(); QOS getQOS(); String getShareName(); long getTtl(); @Override String toString(); static SubscribeOptionsBuilder builder();  }
@Test public void ttlValues() { SubscribeOptions.builder().setTtl(0); SubscribeOptions.builder().setTtl(4294967295L); SubscribeOptions.builder().setTtl(4294967296L); SubscribeOptions.builder().setTtl(4294967295L*1000L); SubscribeOptions.builder().setTtl(365, TimeUnit.DAYS); SubscribeOptions.builder().setTtl(365*136, TimeUnit.DAYS); try { SubscribeOptions.builder().setTtl(-1); throw new AssertionFailedError("Should have failed on -1"); } catch(IllegalArgumentException e) { } try { SubscribeOptions.builder().setTtl(-1, TimeUnit.MILLISECONDS); throw new AssertionFailedError("Should have failed on -1 milliseconds"); } catch(IllegalArgumentException e) { } try { SubscribeOptions.builder().setTtl(-1, TimeUnit.SECONDS); throw new AssertionFailedError("Should have failed on -1 seconds"); } catch(IllegalArgumentException e) { } try { SubscribeOptions.builder().setTtl(-1, TimeUnit.MINUTES); throw new AssertionFailedError("Should have failed on -1 minutes"); } catch(IllegalArgumentException e) { } try { SubscribeOptions.builder().setTtl(4294967296L*1000L); throw new AssertionFailedError("Should have failed on 4294967296000 milliseconds"); } catch(IllegalArgumentException e) { } try { SubscribeOptions.builder().setTtl(365*137, TimeUnit.DAYS); throw new AssertionFailedError("Should have failed on 137 years"); } catch (IllegalArgumentException e) { } }
@Test public void creditValues() { SubscribeOptions.builder().setCredit(0); SubscribeOptions.builder().setCredit(Integer.MAX_VALUE); try { SubscribeOptions.builder().setCredit(-1); throw new AssertionFailedError("setCredit -1 should have been rejected"); } catch(IllegalArgumentException e) { } }
@Test public void qosValues() { SubscribeOptions.builder().setQos(QOS.AT_LEAST_ONCE); SubscribeOptions.builder().setQos(QOS.AT_MOST_ONCE); try { SubscribeOptions.builder().setQos(null); throw new AssertionFailedError("setQos of null should have been rejected"); } catch(IllegalArgumentException e) { } }
@Test public void shareValues() { SubscribeOptions.builder().setShare(null); SubscribeOptions.builder().setShare(""); SubscribeOptions.builder().setShare("share"); try { SubscribeOptions.builder().setShare(":"); throw new AssertionFailedError("Colon should not be permitted in share name"); } catch(IllegalArgumentException e) { } }