@Test public void testWindowIdCompare() { long first = 1431714014123L; int ahead = 341; for (int windowWidthMillis : new int[] {500, 123}) { long window1 = WindowGenerator.getWindowId(first, first, windowWidthMillis); long window2 = WindowGenerator.getAheadWindowId(window1, first, windowWidthMillis, ahead); Assert.assertEquals( ahead, WindowGenerator.compareWindowId(window2, window1, first, windowWidthMillis)); } }
@Test public void testWindowIdAhead() { long first = 1431714014123L; int ahead = 678; for (int windowWidthMillis : new int[] {500, 123}) { long window1 = WindowGenerator.getWindowId(first, first, windowWidthMillis); long window2 = WindowGenerator.getAheadWindowId(window1, first, windowWidthMillis, ahead); for (int i = 0; i < ahead; i++) { window1 = WindowGenerator.getNextWindowId(window1, first, windowWidthMillis); } Assert.assertEquals(window2, window1); } }