()
| 636 | } |
| 637 | |
| 638 | @Test |
| 639 | public void testSplitsEligibleRollupQuery() throws Exception { |
| 640 | final TSQuery queryUnderTest = getMetricForValidate(); |
| 641 | |
| 642 | TSDB tsdb = PowerMockito.mock(TSDB.class); |
| 643 | TsdbQuery mockTsdbQuery = PowerMockito.mock(TsdbQuery.class); |
| 644 | when(mockTsdbQuery.configureFromQuery(eq(queryUnderTest), anyInt())).thenReturn(Deferred.fromResult(null)); |
| 645 | when(mockTsdbQuery.needsSplitting()).thenReturn(true); |
| 646 | when(tsdb.newQuery()).thenReturn(mockTsdbQuery); |
| 647 | |
| 648 | SplitRollupQuery mockSplitQuery = PowerMockito.mock(SplitRollupQuery.class); |
| 649 | when(mockSplitQuery.configureFromQuery(eq(queryUnderTest), anyInt())).thenReturn(Deferred.fromResult(null)); |
| 650 | |
| 651 | PowerMockito.whenNew(SplitRollupQuery.class).withAnyArguments().thenReturn(mockSplitQuery); |
| 652 | |
| 653 | queryUnderTest.buildQueriesAsync(tsdb); |
| 654 | |
| 655 | verify(mockSplitQuery).configureFromQuery(queryUnderTest, 0); |
| 656 | } |
| 657 | |
| 658 | @Test |
| 659 | public void testDoesNotSplitIneligibleRollupQuery() { |
nothing calls this directly
no test coverage detected