本文整理汇总了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;
}