From d930f20be6ccbed92c1681235ebcfbcbc859eb6f Mon Sep 17 00:00:00 2001 From: Norbel Ambanumben Date: Wed, 17 May 2023 14:32:27 +0100 Subject: [PATCH 1/4] updated automated tests to use same calls as foreground tests --- .../common/service/RunTestService.java | 3 +- .../ooniprobe/common/service/ServiceUtil.java | 11 +++- .../domain/GenerateAutoRunServiceSuite.java | 50 +++------------ .../ooniprobe/test/TestAsyncTask.java | 15 ++++- .../GenerateAutoRunServiceSuiteTest.java | 63 +------------------ .../GenerateTestServiceSuiteAutoRun.java | 3 +- .../ooniprobe/test/TestAsyncTaskTest.java | 8 +-- 7 files changed, 41 insertions(+), 112 deletions(-) diff --git a/app/src/main/java/org/openobservatory/ooniprobe/common/service/RunTestService.java b/app/src/main/java/org/openobservatory/ooniprobe/common/service/RunTestService.java index 221399f12..3f7c9a92e 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/common/service/RunTestService.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/common/service/RunTestService.java @@ -61,6 +61,7 @@ public int onStartCommand(Intent intent, int flags, int startId) { if (testSuites == null || testSuites.size() == 0) return START_STICKY_COMPATIBILITY; boolean store_db = intent.getBooleanExtra("storeDB", true); + boolean unattended = intent.getBooleanExtra("unattended", false); Application app = ((Application) getApplication()); NotificationUtility.setChannel(getApplicationContext(), CHANNEL_ID, app.getString(R.string.Settings_AutomatedTesting_Label), false, false, false); Intent notificationIntent = new Intent(this, RunningActivity.class); @@ -78,7 +79,7 @@ public int onStartCommand(Intent intent, int flags, int startId) { .setProgress(100, 0, false) .build(); - task = (TestAsyncTask) new TestAsyncTask(app, testSuites, store_db).execute(); + task = (TestAsyncTask) new TestAsyncTask(app, testSuites, store_db, unattended).execute(); //This intent is used to manage the stop test button in the notification Intent broadcastIntent = new Intent(); broadcastIntent.setAction(RunTestService.ACTION_INTERRUPT); diff --git a/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java b/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java index 46d1a4de7..ce0ad60c2 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java @@ -79,20 +79,24 @@ public static void callCheckInAPI(Application app) { return; } - - AbstractSuite suite = d.generateAutoRunServiceSuite.generate(config); + AbstractSuite suite = d.generateAutoRunServiceSuite.generate(); ArrayList testSuites = new ArrayList<>(); testSuites.add(suite); testSuites.add(InstantMessagingSuite.initForAutoRun()); testSuites.add(CircumventionSuite.initForAutoRun()); testSuites.add(PerformanceSuite.initForAutoRun()); testSuites.add(ExperimentalSuite.initForAutoRun()); - ServiceUtil.startRunTestService(app, testSuites, false); + ServiceUtil.startRunTestService(app, testSuites, false, true); + d.generateAutoRunServiceSuite.markAsRan(); } public static void startRunTestService(Context context, ArrayList iTestSuites, boolean storeDB) { + startRunTestService(context, iTestSuites, storeDB,false); + } + + public static void startRunTestService(Context context, ArrayList iTestSuites, boolean storeDB, boolean unattended) { ArrayList testSuites = Lists.newArrayList( Iterables.filter(iTestSuites, testSuite -> !testSuite.isTestEmpty(d.preferenceManager)) ); @@ -100,6 +104,7 @@ public static void startRunTestService(Context context, ArrayList Intent serviceIntent = new Intent(context, RunTestService.class); serviceIntent.putExtra("testSuites", testSuites); serviceIntent.putExtra("storeDB", storeDB); + serviceIntent.putExtra("unattended", unattended); ContextCompat.startForegroundService(context, serviceIntent); } diff --git a/app/src/main/java/org/openobservatory/ooniprobe/domain/GenerateAutoRunServiceSuite.java b/app/src/main/java/org/openobservatory/ooniprobe/domain/GenerateAutoRunServiceSuite.java index b7c4b2579..a511b847e 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/domain/GenerateAutoRunServiceSuite.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/domain/GenerateAutoRunServiceSuite.java @@ -31,47 +31,17 @@ public class GenerateAutoRunServiceSuite { this.app = application; } - public AbstractSuite generate( - OONICheckInConfig config - ) { - - try { - OONISession session = EngineProvider.get().newSession( - EngineProvider.get().getDefaultSessionConfig( - app, - String.join("-",BuildConfig.SOFTWARE_NAME, AbstractTest.UNATTENDED), - BuildConfig.VERSION_NAME, - new LoggerArray(), - pm.getProxyURL() - ) - ); - OONIContext ooniContext = session.newContextWithTimeout(30); - OONICheckInResults results = session.checkIn(ooniContext, config); - - if (results.getWebConnectivity() != null) { - List inputs = new ArrayList<>(); - for (OONIURLInfo url : results.getWebConnectivity().getUrls()) { - inputs.add(url.getUrl()); - } - - markAsRan(); - - return AbstractSuite.getSuite( - app, - "web_connectivity", - inputs, - AbstractTest.AUTORUN - ); - } - - return null; - } catch (Exception e) { - e.printStackTrace(); - ThirdPartyServices.logException(e); - return null; - } + public AbstractSuite generate() { + + return AbstractSuite.getSuite( + app, + "web_connectivity", + null, + AbstractTest.AUTORUN + ); } + public boolean shouldStart(Boolean isWifi, Boolean isCharging, Boolean isVPNInUse) { if (pm.testWifiOnly() && !isWifi) return false; @@ -86,7 +56,7 @@ public boolean shouldStart(Boolean isWifi, Boolean isCharging, Boolean isVPNInUs return true; } - private void markAsRan() { + public void markAsRan() { pm.updateAutorunDate(); pm.incrementAutorun(); } diff --git a/app/src/main/java/org/openobservatory/ooniprobe/test/TestAsyncTask.java b/app/src/main/java/org/openobservatory/ooniprobe/test/TestAsyncTask.java index 5d3e685cd..f7e642221 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/test/TestAsyncTask.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/test/TestAsyncTask.java @@ -64,6 +64,7 @@ public class TestAsyncTask extends AsyncTask implements Abst private String proxy; private boolean store_db = true; + private boolean unattended; public static List getSuites() { return Arrays.asList(new WebsitesSuite(), new InstantMessagingSuite(), new CircumventionSuite(), new PerformanceSuite(), new ExperimentalSuite()); @@ -75,9 +76,10 @@ public TestAsyncTask(Application app, ArrayList testSuites) { this.proxy = app.getPreferenceManager().getProxyURL(); } - public TestAsyncTask(Application app, ArrayList testSuites, boolean store_db) { + public TestAsyncTask(Application app, ArrayList testSuites, boolean store_db, boolean unattended) { this(app, testSuites); this.store_db = store_db; + this.unattended = unattended; } private void registerConnChange() { @@ -159,8 +161,15 @@ private void runTest(AbstractTest... tests) { //This uses the wrapper private void downloadURLs() { try { - OONISession session = EngineProvider.get().newSession(EngineProvider.get().getDefaultSessionConfig( - app, BuildConfig.SOFTWARE_NAME, BuildConfig.VERSION_NAME, new LoggerArray(), proxy)); + OONISession session = EngineProvider.get().newSession( + EngineProvider.get().getDefaultSessionConfig( + app, + unattended ? String.join("-", BuildConfig.SOFTWARE_NAME, AbstractTest.UNATTENDED) : BuildConfig.SOFTWARE_NAME, + BuildConfig.VERSION_NAME, + new LoggerArray(), + proxy + ) + ); OONIContext ooniContext = session.newContextWithTimeout(30); OONICheckInConfig config = app.getOONICheckInConfig(); diff --git a/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateAutoRunServiceSuiteTest.java b/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateAutoRunServiceSuiteTest.java index f7c53c482..b220e7234 100644 --- a/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateAutoRunServiceSuiteTest.java +++ b/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateAutoRunServiceSuiteTest.java @@ -31,10 +31,7 @@ public class GenerateAutoRunServiceSuiteTest extends RobolectricAbstractTest { // Mocks - OONICheckInInfoWebConnectivity webConnectivityMock = mock(OONICheckInInfoWebConnectivity.class); PreferenceManager preferenceManagerMock = mock(PreferenceManager.class); - OONICheckInConfig ooniCheckConfigMock = mock(OONICheckInConfig.class); - OONICheckInResults ooniResultsMock = mock(OONICheckInResults.class); OONISession ooniSessionMock = mock(OONISession.class); // Engine && UseCase @@ -52,73 +49,19 @@ public void setUp() { } @Test - public void shouldNotStartTest() { + public void generateSuite() { // Act - AbstractSuite suite = generateSuite.generate(ooniCheckConfigMock); - - // Assert - Assert.assertNull(suite); - } - - @Test - public void generateSuite() throws Exception { - // Arrange - ArrayList suiteUrls = getTestUrls(); - - when(preferenceManagerMock.getEnabledCategoryArr()).thenReturn(new ArrayList() { - { - add("ALDR"); - add("REL"); - add("PORN"); - add("PROV"); - add("POLR"); - add("HUMR"); - add("ENV"); - } - }); - - when(webConnectivityMock.getUrls()).thenReturn(suiteUrls); - when(ooniResultsMock.getWebConnectivity()).thenReturn(webConnectivityMock); - when(ooniSessionMock.checkIn(any(), any())).thenReturn(ooniResultsMock); - - // Act - AbstractSuite suite = generateSuite.generate(ooniCheckConfigMock); + AbstractSuite suite = generateSuite.generate(); // Assert Assert.assertNotNull(suite); - verify(preferenceManagerMock, times(1)).updateAutorunDate(); - verify(preferenceManagerMock, times(1)).incrementAutorun(); Assert.assertEquals(1, suite.getTestList(preferenceManagerMock).length); AbstractTest webTest = suite.getTestList(preferenceManagerMock)[0]; Assert.assertEquals("web_connectivity", webTest.getName()); - Assert.assertEquals(suiteUrls.size(), webTest.getInputs().size()); - - for (int i = 0; i < webTest.getInputs().size(); i++) { - Assert.assertEquals( webTest.getInputs().get(i), suiteUrls.get(i).getUrl()); - } - } - - private ArrayList getTestUrls() { - Faker faker = new Faker(); - - OONIURLInfo url1 = mock(OONIURLInfo.class); - when(url1.getUrl()).thenReturn(faker.internet.url()); - - OONIURLInfo url2 = mock(OONIURLInfo.class); - when(url1.getUrl()).thenReturn(faker.internet.url()); - - OONIURLInfo url3 = mock(OONIURLInfo.class); - when(url1.getUrl()).thenReturn(faker.internet.url()); + Assert.assertNull(webTest.getInputs()); - return new ArrayList(){ - { - add(url1); - add(url2); - add(url3); - } - }; } } \ No newline at end of file diff --git a/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateTestServiceSuiteAutoRun.java b/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateTestServiceSuiteAutoRun.java index 705fe657e..d5b853908 100644 --- a/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateTestServiceSuiteAutoRun.java +++ b/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateTestServiceSuiteAutoRun.java @@ -1,3 +1,4 @@ +/* package org.openobservatory.ooniprobe.domain; import androidx.test.filters.SmallTest; @@ -117,4 +118,4 @@ private ArrayList getTestUrls() { }; } -} \ No newline at end of file +}*/ diff --git a/app/src/test/java/org/openobservatory/ooniprobe/test/TestAsyncTaskTest.java b/app/src/test/java/org/openobservatory/ooniprobe/test/TestAsyncTaskTest.java index 56816f49e..0e8c69813 100644 --- a/app/src/test/java/org/openobservatory/ooniprobe/test/TestAsyncTaskTest.java +++ b/app/src/test/java/org/openobservatory/ooniprobe/test/TestAsyncTaskTest.java @@ -161,7 +161,7 @@ public void runTest_withProgress() { AbstractTest test = mock(AbstractTest.class); when(mockedSuite.getTestList(any())).thenReturn(new AbstractTest[]{test}); - TestAsyncTask task = new TestAsyncTask(a, suiteList, false); + TestAsyncTask task = new TestAsyncTask(a, suiteList, false,false); // Act task.execute(); @@ -189,14 +189,14 @@ public void runTest_withError() { when(mockedSuite.getTestList(any())).thenReturn(new AbstractTest[]{test}); doThrow(new RuntimeException("")).when(test).run(any(), any(), any(), any(), any(), anyInt(), any()); - TestAsyncTask task = new TestAsyncTask(a, suiteList,false); + TestAsyncTask task = new TestAsyncTask(a, suiteList,false,false); // Act task.execute(); idleTaskUntilFinished(task); // Assert - verify(runService).stopSelf(); + verify(runService).stopSelf(); } @Test @@ -209,7 +209,7 @@ public void runTest_interrupt() { when(mockedSuite.getTestList(any())).thenReturn(new AbstractTest[]{test}); when(test.canInterrupt()).thenReturn(true); - TestAsyncTask task = new TestAsyncTask(a, suiteList, false); + TestAsyncTask task = new TestAsyncTask(a, suiteList, false,false); // Act task.execute(); From 64e3e6a055f8baa2d694295983b9ba3b612627fa Mon Sep 17 00:00:00 2001 From: Norbel AMBANUMBEN Date: Fri, 16 Jun 2023 10:33:11 +0100 Subject: [PATCH 2/4] Update app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java Co-authored-by: Simone Basso --- .../openobservatory/ooniprobe/common/service/ServiceUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java b/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java index ce0ad60c2..48fa8822f 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java @@ -93,7 +93,7 @@ public static void callCheckInAPI(Application app) { public static void startRunTestService(Context context, ArrayList iTestSuites, boolean storeDB) { - startRunTestService(context, iTestSuites, storeDB,false); + startRunTestService(context, iTestSuites, storeDB, false); } public static void startRunTestService(Context context, ArrayList iTestSuites, boolean storeDB, boolean unattended) { From 080dcc2e7c32fbd616e9c36f3a0e0d1f14955f02 Mon Sep 17 00:00:00 2001 From: Norbel Ambanumben Date: Fri, 16 Jun 2023 10:57:18 +0100 Subject: [PATCH 3/4] updated code based on review --- .../ooniprobe/activity/RunningActivity.java | 2 +- .../ooniprobe/common/service/RunTestJobService.java | 2 +- .../ooniprobe/common/service/ServiceUtil.java | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/openobservatory/ooniprobe/activity/RunningActivity.java b/app/src/main/java/org/openobservatory/ooniprobe/activity/RunningActivity.java index 31f42857d..0bf7fd7b2 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/activity/RunningActivity.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/activity/RunningActivity.java @@ -124,7 +124,7 @@ public static void runAsForegroundService(AbstractActivity context, private static void startRunTestService(AbstractActivity context, ArrayList testSuites, OnTestServiceStartedListener onTestServiceStartedListener) { - ServiceUtil.startRunTestService(context, testSuites, true); + ServiceUtil.startRunTestServiceManual(context, testSuites, true); onTestServiceStartedListener.onTestServiceStarted(); } diff --git a/app/src/main/java/org/openobservatory/ooniprobe/common/service/RunTestJobService.java b/app/src/main/java/org/openobservatory/ooniprobe/common/service/RunTestJobService.java index 2df95f322..37fe91292 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/common/service/RunTestJobService.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/common/service/RunTestJobService.java @@ -34,7 +34,7 @@ public JobTask(JobService jobService, Application app) { @Override protected JobParameters doInBackground(JobParameters... params) { - ServiceUtil.callCheckInAPI(app); + ServiceUtil.startRunTestServiceUnattended(app); return params[0]; } diff --git a/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java b/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java index ce0ad60c2..9d954c880 100644 --- a/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java +++ b/app/src/main/java/org/openobservatory/ooniprobe/common/service/ServiceUtil.java @@ -68,7 +68,7 @@ public static void stopJob(Context context) { } } - public static void callCheckInAPI(Application app) { + public static void startRunTestServiceUnattended(Application app) { app.getServiceComponent().inject(d); boolean isVPNInUse = ReachabilityManager.isVPNinUse(app); @@ -86,17 +86,17 @@ public static void callCheckInAPI(Application app) { testSuites.add(CircumventionSuite.initForAutoRun()); testSuites.add(PerformanceSuite.initForAutoRun()); testSuites.add(ExperimentalSuite.initForAutoRun()); - ServiceUtil.startRunTestService(app, testSuites, false, true); + ServiceUtil.startRunTestServiceCommon(app, testSuites, false, true); d.generateAutoRunServiceSuite.markAsRan(); } - public static void startRunTestService(Context context, ArrayList iTestSuites, boolean storeDB) { - startRunTestService(context, iTestSuites, storeDB,false); + public static void startRunTestServiceManual(Context context, ArrayList iTestSuites, boolean storeDB) { + startRunTestServiceCommon(context, iTestSuites, storeDB,false); } - public static void startRunTestService(Context context, ArrayList iTestSuites, boolean storeDB, boolean unattended) { + private static void startRunTestServiceCommon(Context context, ArrayList iTestSuites, boolean storeDB, boolean unattended) { ArrayList testSuites = Lists.newArrayList( Iterables.filter(iTestSuites, testSuite -> !testSuite.isTestEmpty(d.preferenceManager)) ); From 9d1f1c62fdeab6248ab04aca2e92f5ec61a56d1a Mon Sep 17 00:00:00 2001 From: Norbel Ambanumben Date: Thu, 29 Jun 2023 19:35:55 +0100 Subject: [PATCH 4/4] Deleted `GenerateTestServiceSuiteAutoRun` since its a duplicate of `GenerateAutoRunServiceSuiteTest` --- .../GenerateTestServiceSuiteAutoRun.java | 121 ------------------ 1 file changed, 121 deletions(-) delete mode 100644 app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateTestServiceSuiteAutoRun.java diff --git a/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateTestServiceSuiteAutoRun.java b/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateTestServiceSuiteAutoRun.java deleted file mode 100644 index d5b853908..000000000 --- a/app/src/test/java/org/openobservatory/ooniprobe/domain/GenerateTestServiceSuiteAutoRun.java +++ /dev/null @@ -1,121 +0,0 @@ -/* -package org.openobservatory.ooniprobe.domain; - -import androidx.test.filters.SmallTest; - -import org.junit.Assert; -import org.junit.Test; -import org.openobservatory.engine.OONICheckInConfig; -import org.openobservatory.engine.OONICheckInResults; -import org.openobservatory.engine.OONICheckInResults.OONICheckInInfoWebConnectivity; -import org.openobservatory.engine.OONISession; -import org.openobservatory.engine.OONIURLInfo; -import org.openobservatory.ooniprobe.RobolectricAbstractTest; -import org.openobservatory.ooniprobe.common.PreferenceManager; -import org.openobservatory.ooniprobe.engine.TestEngineInterface; -import org.openobservatory.ooniprobe.test.EngineInterface; -import org.openobservatory.ooniprobe.test.EngineProvider; -import org.openobservatory.ooniprobe.test.suite.AbstractSuite; -import org.openobservatory.ooniprobe.test.test.AbstractTest; - -import java.util.ArrayList; - -import io.bloco.faker.Faker; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@SmallTest -public class GenerateTestServiceSuiteAutoRun extends RobolectricAbstractTest { - - // Mocks - OONICheckInInfoWebConnectivity webConnectivityMock = mock(OONICheckInInfoWebConnectivity.class); - PreferenceManager preferenceManagerMock = mock(PreferenceManager.class); - OONICheckInConfig ooniCheckConfigMock = mock(OONICheckInConfig.class); - OONICheckInResults ooniResultsMock = mock(OONICheckInResults.class); - OONISession ooniSessionMock = mock(OONISession.class); - - // Engine && UseCase - EngineInterface mockedEngine = new TestEngineInterface(ooniSessionMock); - GenerateAutoRunServiceSuite generateSuite; - - @Override - public void setUp() { - super.setUp(); - generateSuite = new GenerateAutoRunServiceSuite(a, preferenceManagerMock); - EngineProvider.engineInterface = mockedEngine; - - when(preferenceManagerMock.testWifiOnly()).thenReturn(true); - when(preferenceManagerMock.testChargingOnly()).thenReturn(true); - } - - @Test - public void shouldNotStartTest() { - // Act - AbstractSuite suite = generateSuite.generate(ooniCheckConfigMock); - - // Assert - Assert.assertNull(suite); - } - - @Test - public void generateSuite() throws Exception { - // Arrange - ArrayList suiteUrls = getTestUrls(); - - when(preferenceManagerMock.getEnabledCategoryArr()).thenReturn(new ArrayList() { - { - add("ALDR"); - add("REL"); - add("PORN"); - add("PROV"); - add("POLR"); - add("HUMR"); - add("ENV"); - } - }); - - when(webConnectivityMock.getUrls()).thenReturn(suiteUrls); - when(ooniResultsMock.getWebConnectivity()).thenReturn(webConnectivityMock); - when(ooniSessionMock.checkIn(any(), any())).thenReturn(ooniResultsMock); - - // Act - AbstractSuite suite = generateSuite.generate(ooniCheckConfigMock); - - // Assert - Assert.assertNotNull(suite); - Assert.assertEquals(1, suite.getTestList(preferenceManagerMock).length); - - AbstractTest webTest = suite.getTestList(preferenceManagerMock)[0]; - - Assert.assertEquals("web_connectivity", webTest.getName()); - Assert.assertEquals(suiteUrls.size(), webTest.getInputs().size()); - - for (int i = 0; i < webTest.getInputs().size(); i++) { - Assert.assertEquals(webTest.getInputs().get(i), suiteUrls.get(i).getUrl()); - } - } - - private ArrayList getTestUrls() { - Faker faker = new Faker(); - - OONIURLInfo url1 = mock(OONIURLInfo.class); - when(url1.getUrl()).thenReturn(faker.internet.url()); - - OONIURLInfo url2 = mock(OONIURLInfo.class); - when(url1.getUrl()).thenReturn(faker.internet.url()); - - OONIURLInfo url3 = mock(OONIURLInfo.class); - when(url1.getUrl()).thenReturn(faker.internet.url()); - - return new ArrayList() { - { - add(url1); - add(url2); - add(url3); - } - }; - } - -}*/