use of io.opencensus.testing.common.TestClock in project instrumentation-java by census-instrumentation.
the class MeasureToViewMapTest method testRegisterAndGetView.
@Test
public void testRegisterAndGetView() {
MeasureToViewMap measureToViewMap = new MeasureToViewMap();
TestClock clock = TestClock.create(Timestamp.create(10, 20));
measureToViewMap.registerView(VIEW, clock);
clock.setTime(Timestamp.create(30, 40));
ViewData viewData = measureToViewMap.getView(VIEW_NAME, clock, State.ENABLED);
assertThat(viewData.getView()).isEqualTo(VIEW);
assertThat(viewData.getWindowData()).isEqualTo(CumulativeData.create(Timestamp.create(10, 20), Timestamp.create(30, 40)));
assertThat(viewData.getAggregationMap()).isEmpty();
}