Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion bvanalytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies {
testImplementation sdkTestDep.mockito
testImplementation sdkTestDep.mockWebServer
testImplementation sdkTestDep.robolectric
testImplementation sdkTestDep.roboPlayServices
testImplementation sdkTestDep.androidJson
testImplementation sdkTestDep.androidXTest

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.bazaarvoice.bvandroidsdk;

import android.content.Context;
import android.net.Network;
import android.security.NetworkSecurityPolicy;

import com.google.android.gms.ads.identifier.AdvertisingIdClient;
Expand Down Expand Up @@ -40,14 +39,6 @@ public static AdvertisingIdClient.Info getAdvertisingIdInfo(Context context) thr
}
}

/**
* Here because https://github.com/robolectric/robolectric/issues/2223
*/
@Implements(Network.class)
public static class ShadowNetwork {

}

@Implements(NetworkSecurityPolicy.class)
public static class NetworkSecurityPolicyWorkaround {
@Implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static org.junit.Assert.assertNotNull;

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowAdIdClientWithLimit.class, BaseShadows.ShadowNetwork.class})
@Config(shadows = {BaseShadows.ShadowAdIdClientWithLimit.class})
public class BvAdIdLimitTest {
private BvStubData stubData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static org.junit.Assert.assertTrue;

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowAdIdClientNoLimit.class, BaseShadows.ShadowNetwork.class})
@Config(shadows = {BaseShadows.ShadowAdIdClientNoLimit.class})
public class BvAdIdNoLimitTest {
private static final String UUID_PATTERN = "\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}";
private BvStubData stubData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static org.junit.Assert.assertNull;

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowAdIdClientNoPlayServices.class, BaseShadows.ShadowNetwork.class})
@Config(shadows = {BaseShadows.ShadowAdIdClientNoPlayServices.class})
public class BvAdIdNoPlayServicesTest {
private BvStubData stubData;

Expand Down
4 changes: 1 addition & 3 deletions bvanalytics/src/test/resources/robolectric.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
sdk: 18
constants: com.bazaarvoice.bvandroidsdk_analytics.BuildConfig
manifest: --default
sdk: 19
1 change: 0 additions & 1 deletion bvcommon/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
testImplementation sdkTestDep.mockito
testImplementation sdkTestDep.mockWebServer
testImplementation sdkTestDep.robolectric
testImplementation sdkTestDep.roboPlayServices
testImplementation sdkTestDep.androidXTest
testCompileOnly sdkDep.gson
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.io.File;
import java.io.FileOutputStream;
Expand All @@ -36,7 +35,6 @@
import static org.mockito.MockitoAnnotations.initMocks;

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowNetwork.class})
public abstract class BVBaseTest {

MockWebServer server = new MockWebServer();
Expand Down Expand Up @@ -189,4 +187,4 @@ private static File createFileFromInputStream(InputStream inputStream) {

return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

import java.util.concurrent.CountDownLatch;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowNetwork.class, BvSdkShadows.BvShadowAsyncTask.class, BaseShadows.ShadowAdIdClientNoLimit.class})
@Config(shadows = {BvSdkShadows.BvShadowAsyncTask.class, BaseShadows.ShadowAdIdClientNoLimit.class})
public class AdIdRequestTaskTest {

@Test(expected = IllegalArgumentException.class)
Expand All @@ -33,6 +34,7 @@ public void shouldFailWithNullContext() {
}

@Test
@LooperMode(LooperMode.Mode.LEGACY)
public void shouldReturnAnAdId() throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
AdIdRequestTask.AdIdCallback adIdCallback = result -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import static org.mockito.MockitoAnnotations.initMocks;

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowNetwork.class, BvSdkShadows.BvShadowAsyncTask.class, BaseShadows.ShadowAdIdClientNoLimit.class, BaseShadows.NetworkSecurityPolicyWorkaround.class})
@Config(shadows = {BvSdkShadows.BvShadowAsyncTask.class, BaseShadows.ShadowAdIdClientNoLimit.class, BaseShadows.NetworkSecurityPolicyWorkaround.class})
public class BVAuthenticatedUserTest extends BVBaseTest {

BVAuthenticatedUser subject;
Expand Down Expand Up @@ -90,4 +90,4 @@ private static String getJsonFile(Class clazz, String fileName) throws IOExcepti
return bufferedSource.readString(Charset.defaultCharset());
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import static org.mockito.MockitoAnnotations.initMocks;

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowNetwork.class, BvSdkShadows.BvShadowAsyncTask.class, BaseShadows.ShadowAdIdClientNoLimit.class})
@Config(shadows = {BvSdkShadows.BvShadowAsyncTask.class, BaseShadows.ShadowAdIdClientNoLimit.class})
public class BVSDKTest {

String clientId;
Expand Down
4 changes: 1 addition & 3 deletions bvcommon/src/test/resources/robolectric.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
sdk: 18
constants: com.bazaarvoice.bvandroidsdk_common.BuildConfig
manifest: --default
sdk: 19
4 changes: 1 addition & 3 deletions bvconversations/src/test/resources/robolectric.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
sdk: 18
constants: com.bazaarvoice.bvandroidsdk_conversations.BuildConfig
manifest: --default
sdk: 19
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowLooper;
Expand All @@ -29,7 +28,7 @@
*/

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowNetwork.class, BvSdkShadows.BvShadowAsyncTask.class, BaseShadows.ShadowAdIdClientNoLimit.class, BaseShadows.NetworkSecurityPolicyWorkaround.class})
@Config(shadows = {BvSdkShadows.BvShadowAsyncTask.class, BaseShadows.ShadowAdIdClientNoLimit.class, BaseShadows.NetworkSecurityPolicyWorkaround.class})
public class CurationsUnitTest extends BVBaseTest {

BVCurations curations;
Expand Down Expand Up @@ -620,4 +619,4 @@ public void onFailure(Throwable throwable) {
ShadowLooper.unPauseLooper(handlerThread.getLooper());
latch.await(10, TimeUnit.SECONDS);
}
}
}
4 changes: 1 addition & 3 deletions bvcurations/src/test/resources/robolectric.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
sdk: 18
constants: com.bazaarvoice.bvandroidsdk_curations.BuildConfig
manifest: --default
sdk:19
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
sdk: 18
constants: com.bazaarvoice.bvandroidsdk_productsentiments.BuildConfig
manifest: --default
sdk: 19
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -14,7 +12,6 @@
import static org.mockito.Mockito.when;

@RunWith(RobolectricTestRunner.class)
@Config(shadows = {BaseShadows.ShadowNetwork.class})
public class RecommendationsRequestTest extends BVBaseTest {

String adId = "testAdId";
Expand Down Expand Up @@ -139,4 +136,4 @@ public void productIdAndCategoryIdMutuallyExclusive() {
} catch (IllegalArgumentException expected) { /** expected **/}
}

}
}
4 changes: 1 addition & 3 deletions bvrecommendations/src/test/resources/robolectric.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
sdk: 18
constants: com.bazaarvoice.bvandroidsdk_recommendations.BuildConfig
manifest: --default
sdk: 19
4 changes: 1 addition & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ ext {
supportLibraryVersion : '28.0.0',
gimbalVersion : '2.72',
playServicesAdsIdentifier : '18.0.1',
robolectric: '4.3',
robolectricAddOn : '4.3',
robolectric: '4.12.2',
androidx: '1.0.0'
]

Expand Down Expand Up @@ -54,7 +53,6 @@ ext {
junit : 'junit:junit:4.12',
mockito : 'org.mockito:mockito-core:2.23.4',
robolectric : "org.robolectric:robolectric:$sdkSharedVersions.robolectric",
roboPlayServices : "org.robolectric:shadows-playservices:$sdkSharedVersions.robolectricAddOn",
androidJson : "org.json:json:20160810",
androidXTest : "androidx.test:core:1.4.0"

Expand Down