TimeSpanMap incorrect with repeated date
Behavior matches documentation, but without this feature there is no way to make a value valid for all time after the constructor.
Failing test case
@Test
public void testValidAllTime() {
AbsoluteDate ref = AbsoluteDate.ARBITRARY_EPOCH.shiftedBy(1);
TimeSpanMap<Integer> map = new TimeSpanMap<>(0);
// action
map.addValidAfter(1, ref);
map.addValidBefore(2, ref);
// verify
Assert.assertEquals(1, (int) map.get(ref.shiftedBy(1)));
Assert.assertEquals(2, (int) map.get(ref.shiftedBy(-1)));
Assert.assertEquals(1, (int) map.get(ref));
}
Fails on the first assert with
java.lang.AssertionError:
Expected :1
Actual :2
After executing the action the map contains: [-inf, ref]: 0 (should be 2) [ref, inf]: 2 (should be 1)
Came across this while attempting to fix #798 (closed)