### Question:
BoundedTimeConstraint extends TimeConstraint { public static synchronized BoundedTimeConstraint getTimeConstraint(Object key, TimeSpan timeSpan, Duration minDuration, Duration maxDuration) { long minTime = timeSpan.isUnboundedStart() ? Long.MIN_VALUE : timeSpan.getStart(); long maxTime = timeSpan.isUnboundedEnd() ? Long.MAX_VALUE : timeSpan.getEnd(); int minDurationSeconds = minDuration == null ? 0 : new Seconds(minDuration).intValue(); int maxDurationSeconds = maxDuration == null ? Integer.MAX_VALUE : new Seconds(maxDuration).intValue(); return (BoundedTimeConstraint)getPool() .get(new BoundedTimeConstraint(key, minTime, maxTime, minDurationSeconds, maxDurationSeconds)); } protected  BoundedTimeConstraint(Object key, long minTime, long maxTime, int minDurationSeconds, int maxDurationSeconds); static synchronized BoundedTimeConstraint getTimeConstraint(Object key, TimeSpan timeSpan, Duration minDuration,
            Duration maxDuration); static synchronized BoundedTimeConstraint getTimeConstraint(TimeSpan timeSpan, Duration minDuration,
            Duration maxDuration); @Override boolean check(TimeSpan span); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testBadConstruct1() { BoundedTimeConstraint.getTimeConstraint(TimeSpan.TIMELESS, new Seconds(3600), new Seconds(3600)); }
@Test(expected = IllegalArgumentException.class) public void testBadConstruct2() { BoundedTimeConstraint.getTimeConstraint(TimeSpan.TIMELESS, new Seconds(3601), new Seconds(3600)); }
@Test public void testPool() { BoundedTimeConstraint con = BoundedTimeConstraint.getTimeConstraint(TimeSpan.TIMELESS, Seconds.ZERO, Hours.ONE); Assert.assertSame(con, BoundedTimeConstraint.getTimeConstraint(TimeSpan.TIMELESS, Seconds.ZERO, Hours.ONE)); Assert.assertNotSame(con, BoundedTimeConstraint.getTimeConstraint(TimeSpan.TIMELESS, Seconds.ONE, Hours.ONE)); Assert.assertNotSame(con, BoundedTimeConstraint.getTimeConstraint(TimeSpan.TIMELESS, Seconds.ZERO, new Hours(2))); Assert.assertNotSame(con, BoundedTimeConstraint.getTimeConstraint(TimeSpan.get(0L, 3600L), Seconds.ZERO, Hours.ONE)); Assert.assertNotSame(con, TimeConstraint.getTimeConstraint(TimeSpan.TIMELESS)); }