From ef13dbee76d5d2f40e64f9bd01a124577785e4c3 Mon Sep 17 00:00:00 2001 From: Ephraim Kigamba Date: Mon, 22 Aug 2022 16:10:21 +0300 Subject: [PATCH] Add mockito-core for instrumented tests - Codacy code fixes --- README.md | 2 +- download-robolectric-deps.sh | 1 + library/build.gradle | 1 + .../downloaders/MapBoxOfflineResourcesDownloaderTest.java | 1 - library/src/main/java/io/ona/kujaku/KujakuLibrary.java | 2 +- 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f7a0da50..c63881c8 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ The library offers a view `KujakuMapView` that provides more functionality than - For Mapbox related functionality, [go here](https://docs.mapbox.com/android/maps/overview/) - For extra features provided by this library [go here](./SPECIFICATION.md) -#### `Unable to resolve artifact: Missing` while running tests +## `Unable to resolve artifact: Missing` while running tests This is encountered when Robolectric has problems downloading the jars it needs for different Android SDK levels. If you keep running into this you can download the JARs locally and point Robolectric to them by doing: diff --git a/download-robolectric-deps.sh b/download-robolectric-deps.sh index 1120cf2d..e5dcd539 100755 --- a/download-robolectric-deps.sh +++ b/download-robolectric-deps.sh @@ -1,3 +1,4 @@ +#!/bin/sh mkdir robolectric-deps wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.jar -P robolectric-deps wget -nc https://repo1.maven.org/maven2/org/robolectric/android-all/8.1.0-robolectric-4611349/android-all-8.1.0-robolectric-4611349.jar -P robolectric-deps diff --git a/library/build.gradle b/library/build.gradle index 0618382d..34f31ee3 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -150,6 +150,7 @@ private static void testDependencies(instance, configuration) { configuration.testImplementation instance.androidxTestCore configuration.androidTestImplementation instance.junit configuration.androidTestImplementation 'org.mockito:mockito-android:2.7.22' + configuration.androidTestImplementation 'org.mockito:mockito-core:2.7.22' configuration.androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.1.0', { exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'net.sf.kxml', module: 'kxml2' diff --git a/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java b/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java index e4ecbf61..33d92f61 100644 --- a/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java +++ b/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java @@ -28,7 +28,6 @@ import java.util.concurrent.CountDownLatch; import io.ona.kujaku.BaseTest; -import io.ona.kujaku.BuildConfig; import io.ona.kujaku.data.MapBoxDownloadTask; import io.ona.kujaku.listeners.IncompleteMapDownloadCallback; import io.ona.kujaku.listeners.OnDownloadMapListener; diff --git a/library/src/main/java/io/ona/kujaku/KujakuLibrary.java b/library/src/main/java/io/ona/kujaku/KujakuLibrary.java index cf03f93a..573a5858 100644 --- a/library/src/main/java/io/ona/kujaku/KujakuLibrary.java +++ b/library/src/main/java/io/ona/kujaku/KujakuLibrary.java @@ -63,7 +63,7 @@ public static void init(Context context) { AndroidThreeTen.init(context); if (Timber.treeCount() < 1) { - timber.log.Timber.plant(new DebugTree()); + Timber.plant(new DebugTree()); } }