use of com.google.api.ads.admanager.lib.utils.ReportCallback in project googleads-java-lib by googleads.
the class ReportDownloaderTest method testWhenReportReady_complete.
@Test
public void testWhenReportReady_complete() throws IOException, InterruptedException {
ReportDownloader downloader = new ReportDownloader(reportService, 1);
when(reportService.getReportJobStatus(ArgumentMatchers.anyLong())).thenReturn(ReportJobStatus.COMPLETED);
ReportCallback callback = mock(ReportCallback.class);
downloader.whenReportReady(callback).join();
Mockito.verify(callback).onSuccess();
}
use of com.google.api.ads.admanager.lib.utils.ReportCallback in project googleads-java-lib by googleads.
the class ReportDownloaderTest method testWhenReportReady_failed.
@Test
public void testWhenReportReady_failed() throws IOException, InterruptedException {
ReportDownloader downloader = new ReportDownloader(reportService, 1);
when(reportService.getReportJobStatus(ArgumentMatchers.anyLong())).thenReturn(ReportJobStatus.FAILED);
ReportCallback callback = mock(ReportCallback.class);
downloader.whenReportReady(callback).join();
Mockito.verify(callback).onFailure();
}
use of com.google.api.ads.admanager.lib.utils.ReportCallback in project googleads-java-lib by googleads.
the class ReportDownloaderTest method testWhenReportReady_complete.
@Test
public void testWhenReportReady_complete() throws IOException, InterruptedException {
ReportDownloader downloader = new ReportDownloader(reportService, 1);
when(reportService.getReportJobStatus(ArgumentMatchers.anyLong())).thenReturn(ReportJobStatus.COMPLETED);
ReportCallback callback = mock(ReportCallback.class);
downloader.whenReportReady(callback).join();
Mockito.verify(callback).onSuccess();
}
use of com.google.api.ads.admanager.lib.utils.ReportCallback in project googleads-java-lib by googleads.
the class ReportDownloaderTest method testWhenReportReady_remote.
@Test
public void testWhenReportReady_remote() throws IOException, InterruptedException {
ReportDownloader downloader = new ReportDownloader(reportService, 1);
RemoteException e = new RemoteException();
when(reportService.getReportJobStatus(ArgumentMatchers.anyLong())).thenThrow(e);
ReportCallback callback = mock(ReportCallback.class);
downloader.whenReportReady(callback).join();
Mockito.verify(callback).onException(e);
}
use of com.google.api.ads.admanager.lib.utils.ReportCallback in project googleads-java-lib by googleads.
the class ReportDownloaderTest method testWhenReportReady_failed.
@Test
public void testWhenReportReady_failed() throws IOException, InterruptedException {
ReportDownloader downloader = new ReportDownloader(reportService, 1);
when(reportService.getReportJobStatus(ArgumentMatchers.anyLong())).thenReturn(ReportJobStatus.FAILED);
ReportCallback callback = mock(ReportCallback.class);
downloader.whenReportReady(callback).join();
Mockito.verify(callback).onFailure();
}
Aggregations