use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method restrictTo_fullyOutside.
@Test
public void restrictTo_fullyOutside() {
Range r1 = Range.between(4, 11);
Range r2 = Range.between(5, 10);
Range r3 = r1.restrictTo(r2);
assertTrue(r2 == r3);
}
use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method restrictTo_startOutside.
@Test
public void restrictTo_startOutside() {
Range r1 = Range.between(5, 10);
Range r2 = Range.between(7, 15);
Range r3 = r1.restrictTo(r2);
assertEquals(Range.between(7, 10), r3);
assertEquals(r2.restrictTo(r1), r3);
}
use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method rangeEndsBeforeTest.
@Test
public void rangeEndsBeforeTest() {
final Range former = Range.between(0, 5);
final Range latter = Range.between(5, 10);
assertTrue("latter should end before former", former.endsBefore(latter));
assertTrue("former shouldn't end before latter", !latter.endsBefore(former));
assertTrue("no overlap allowed", !Range.between(5, 10).endsBefore(Range.between(9, 15)));
}
use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method combine_emptyInside.
@Test
public void combine_emptyInside() {
Range r1 = Range.between(0, 10);
Range r2 = Range.between(5, 5);
// Test both ways, should give the same result
Range combined1 = r1.combineWith(r2);
Range combined2 = r2.combineWith(r1);
assertEquals(combined1, combined2);
assertEquals(r1, combined1);
}
use of com.vaadin.flow.internal.Range in project flow by vaadin.
the class RangeTest method expand_negativeIllegal2.
@Test(expected = IllegalArgumentException.class)
public void expand_negativeIllegal2() {
Range r1 = Range.between(5, 10);
// Should throw because the end would contract beyond the start
r1.expand(3, -9);
}
Aggregations