Skip to content

Commit

Permalink
Added unit test for history report
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimanaev committed Nov 14, 2023
1 parent 85b2522 commit 3f1acb0
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,27 @@ public void testHappyFlow_TopCampaignContent() throws Exception {
.getTopCampaignContentReport(auth.getToken().getAccessTokenForHeader(), "accountId", dateStr, dateStr, Collections.emptyMap());
}

@Test
public void testHappyFlow_History() throws Exception {
BackstageAuthentication auth = generateDummyClientCredentialsBackstageAuth();
LocalDate date = LocalDate.of(2018, 1, 2);
String dateStr = DateTimeFormatter.ISO_LOCAL_DATE.format(date);
HistoryReport expected = generateDummyReport(HistoryReport.class, HistoryReportRow.class, 3);
when(advertiserReportMock.getCampaignHistoryByAccountReport(auth.getToken().getAccessTokenForHeader(), "accountId", dateStr, dateStr)).thenReturn(expected);

HistoryReport actual = testInstance.getHistoryReport(auth, "accountId", date, date);
assertNotNull("Missing report", actual);
assertEquals("Invalid timezone", expected.getTimezone(), actual.getTimezone());
assertEquals("Invalid last used rawdata update time", expected.getLastUsedRawdataUpdateTime(), actual.getLastUsedRawdataUpdateTime());
Collection<HistoryReportRow> actualResults = actual.getResults();
assertNotNull("Missing report results", actualResults);
assertEquals("Invalid number of rows", 3, actualResults.size());
assertEquals("Invalid rows", expected.getResults(), actualResults);

verify(advertiserReportMock, times(1))
.getCampaignHistoryByAccountReport(auth.getToken().getAccessTokenForHeader(), "accountId", dateStr, dateStr);
}

@Test
public void testHappyFlow_RevenueSummary() throws Exception {
BackstageAuthentication auth = generateDummyClientCredentialsBackstageAuth();
Expand Down

0 comments on commit 3f1acb0

Please sign in to comment.