本文整理匯總了Java中com.belladati.sdk.exception.interval.InvalidRelativeIntervalException類的典型用法代碼示例。如果您正苦於以下問題:Java InvalidRelativeIntervalException類的具體用法?Java InvalidRelativeIntervalException怎麽用?Java InvalidRelativeIntervalException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
InvalidRelativeIntervalException類屬於com.belladati.sdk.exception.interval包,在下文中一共展示了InvalidRelativeIntervalException類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startAfterEndRelative
import com.belladati.sdk.exception.interval.InvalidRelativeIntervalException; //導入依賴的package包/類
/** start may not be greater than end in relative intervals */
public void startAfterEndRelative() {
try {
new RelativeInterval<IntervalUnit>(DateUnit.DAY, 10, -10);
fail("did not throw exception");
} catch (InvalidRelativeIntervalException e) {
assertEquals(e.getIntervalUnit(), DateUnit.DAY);
assertEquals((int) e.getStart(), 10);
assertEquals((int) e.getEnd(), -10);
}
}
示例2: RelativeInterval
import com.belladati.sdk.exception.interval.InvalidRelativeIntervalException; //導入依賴的package包/類
/**
* Creates a new absolute interval.
*
* @param intervalUnit the interval unit to use
* @param start start of the interval, in interval units from the current
* date/time
* @param end end of the interval, in interval units from the current
* date/time
* @throws NullIntervalException if the unit is <tt>null</tt>
* @throws InvalidAbsoluteIntervalException if the given start is after the
* given end
*/
public RelativeInterval(U intervalUnit, int start, int end) throws NullIntervalException, InvalidAbsoluteIntervalException {
super(intervalUnit);
if (start > end) {
throw new InvalidRelativeIntervalException(intervalUnit, start, end);
}
this.start = start;
this.end = end;
}