Search in sources :

Example 6 with ReportCallback

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();
}
Also used : ReportCallback(com.google.api.ads.admanager.lib.utils.ReportCallback) Test(org.junit.Test)

Example 7 with ReportCallback

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();
}
Also used : ReportCallback(com.google.api.ads.admanager.lib.utils.ReportCallback) Test(org.junit.Test)

Example 8 with ReportCallback

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();
}
Also used : ReportCallback(com.google.api.ads.admanager.lib.utils.ReportCallback) Test(org.junit.Test)

Example 9 with ReportCallback

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);
}
Also used : ReportCallback(com.google.api.ads.admanager.lib.utils.ReportCallback) RemoteException(java.rmi.RemoteException) Test(org.junit.Test)

Example 10 with ReportCallback

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();
}
Also used : ReportCallback(com.google.api.ads.admanager.lib.utils.ReportCallback) Test(org.junit.Test)

Aggregations

ReportCallback (com.google.api.ads.admanager.lib.utils.ReportCallback)15 Test (org.junit.Test)12 RemoteException (java.rmi.RemoteException)7 ConfigurationLoadException (com.google.api.ads.common.lib.conf.ConfigurationLoadException)3 OAuthException (com.google.api.ads.common.lib.exception.OAuthException)3 ValidationException (com.google.api.ads.common.lib.exception.ValidationException)3 File (java.io.File)3 IOException (java.io.IOException)3 URL (java.net.URL)3 ReportDownloader (com.google.api.ads.admanager.axis.utils.v202108.ReportDownloader)1 ReportDownloader (com.google.api.ads.admanager.axis.utils.v202111.ReportDownloader)1 ReportDownloader (com.google.api.ads.admanager.axis.utils.v202202.ReportDownloader)1 ApiException (com.google.api.ads.admanager.axis.v202108.ApiException)1 ReportDownloadOptions (com.google.api.ads.admanager.axis.v202108.ReportDownloadOptions)1 ReportJob (com.google.api.ads.admanager.axis.v202108.ReportJob)1 ReportQuery (com.google.api.ads.admanager.axis.v202108.ReportQuery)1 ReportServiceInterface (com.google.api.ads.admanager.axis.v202108.ReportServiceInterface)1 ApiException (com.google.api.ads.admanager.axis.v202111.ApiException)1 ReportDownloadOptions (com.google.api.ads.admanager.axis.v202111.ReportDownloadOptions)1 ReportJob (com.google.api.ads.admanager.axis.v202111.ReportJob)1