@Test public void shouldLoadHistogramFromDefaultStorage(){ //given Date from = parse("2016-10-01 00:00:00"); Date to = parse("2016-10-01 23:58:00"); //when storage.loadHistogram("detailsId", from, to, "instance", "type", null); //then verify(defaultStorage).loadHistogram(eq("detailsId"), eq(from), eq(to), eq("instance"), eq("type"), isNull(String.class)); verifyNoMoreInteractions(dailyStorage); verifyNoMoreInteractions(weeklyStorage); verifyNoMoreInteractions(monthlyStorage); }
@Test public void shouldLoadWeeklyHistogramFromDailyStorage(){ //given Date from = parse("2016-10-01 00:00:00"); Date to = parse("2016-10-08 01:58:00"); //when storage.loadHistogram("detailsId", from, to, "instance", "type", null); //then verifyNoMoreInteractions(defaultStorage); verify(dailyStorage).loadHistogram(eq("detailsId"), eq(from), eq(to), isNull(String.class), eq("type"), isNull(String.class)); verifyNoMoreInteractions(weeklyStorage); verifyNoMoreInteractions(monthlyStorage); }
@Test public void shouldLoadMonthlyHistogramFromDailyStorage(){ //given Date from = parse("2016-10-01 00:00:00"); Date to = parse("2016-11-08 01:58:00"); //when storage.loadHistogram("detailsId", from, to, "instance", "type", null); //then verifyNoMoreInteractions(defaultStorage); verify(dailyStorage).loadHistogram(eq("detailsId"), eq(from), eq(to), isNull(String.class), eq("type"), isNull(String.class)); verifyNoMoreInteractions(weeklyStorage); verifyNoMoreInteractions(monthlyStorage); } }
@Test public void shouldLoadDailyHistogramFromDailyStorage(){ //given Date from = parse("2016-10-01 00:00:00"); Date to = parse("2016-10-02 01:58:00"); //when storage.loadHistogram("detailsId", from, to, "instance", "type", null); //then verifyNoMoreInteractions(defaultStorage); verify(dailyStorage).loadHistogram(eq("detailsId"), eq(from), eq(to), isNull(String.class), eq("type"), isNull(String.class)); verifyNoMoreInteractions(weeklyStorage); verifyNoMoreInteractions(monthlyStorage); }