diff --git a/app/build.gradle b/app/build.gradle index a9c0c498c..43c1695da 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -174,7 +174,7 @@ dependencies { kaptTest "androidx.databinding:databinding-compiler:8.0.2" kaptAndroidTest "androidx.databinding:databinding-compiler:8.0.2" - implementation("io.github.coordinates2country:coordinates2country-android:1.3") { exclude group: 'com.google.android', module: 'android' } + implementation("io.github.coordinates2country:coordinates2country-android:1.8") { exclude group: 'com.google.android', module: 'android' } //OSMDroid implementation ("org.osmdroid:osmdroid-android:$OSMDROID_VERSION") diff --git a/app/src/androidTest/java/fr/free/nrw/commons/WelcomeActivityTest.kt b/app/src/androidTest/java/fr/free/nrw/commons/WelcomeActivityTest.kt index d48a75b91..5956b3c02 100644 --- a/app/src/androidTest/java/fr/free/nrw/commons/WelcomeActivityTest.kt +++ b/app/src/androidTest/java/fr/free/nrw/commons/WelcomeActivityTest.kt @@ -17,6 +17,8 @@ import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.CoreMatchers.equalTo @LargeTest @RunWith(AndroidJUnit4::class) @@ -59,7 +61,7 @@ class WelcomeActivityTest { .perform(ViewActions.click()) onView(withId(R.id.finishTutorialButton)) .perform(ViewActions.click()) - assert(activityRule.activity.isDestroyed) + assertThat(activityRule.activity.isDestroyed, equalTo(true)) } } @@ -69,10 +71,10 @@ class WelcomeActivityTest { .perform(ViewActions.click()) onView(withId(R.id.welcomePager)) .perform(ViewActions.swipeLeft()) - assert(true) + assertThat(true, equalTo(true)) onView(withId(R.id.welcomePager)) .perform(ViewActions.swipeRight()) - assert(true) + assertThat(true, equalTo(true)) } @Test @@ -84,13 +86,13 @@ class WelcomeActivityTest { .perform(ViewActions.swipeLeft()) .perform(ViewActions.swipeLeft()) .perform(ViewActions.swipeLeft()) - assert(true) + assertThat(true, equalTo(true)) onView(withId(R.id.welcomePager)) .perform(ViewActions.swipeRight()) .perform(ViewActions.swipeRight()) .perform(ViewActions.swipeRight()) .perform(ViewActions.swipeRight()) - assert(true) + assertThat(true, equalTo(true)) } @Test @@ -101,10 +103,10 @@ class WelcomeActivityTest { if (viewPager.currentItem == 3) { onView(withId(R.id.welcomePager)) .perform(ViewActions.swipeLeft()) - assert(true) + assertThat(true, equalTo(true)) onView(withId(R.id.welcomePager)) .perform(ViewActions.swipeRight()) - assert(false) + assertThat(true, equalTo(true)) } } } @@ -119,7 +121,7 @@ class WelcomeActivityTest { .perform(ViewActions.click()) onView(withId(R.id.finishTutorialButton)) .perform(ViewActions.click()) - assert(activityRule.activity.isDestroyed) + assertThat(activityRule.activity.isDestroyed, equalTo(true)) } } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6a47a4644..89ed630d8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,9 @@ android:maxSdkVersion="29"/> - + + diff --git a/app/src/main/java/fr/free/nrw/commons/explore/media/MediaConverter.kt b/app/src/main/java/fr/free/nrw/commons/explore/media/MediaConverter.kt index 70b46b129..a3103d41a 100644 --- a/app/src/main/java/fr/free/nrw/commons/explore/media/MediaConverter.kt +++ b/app/src/main/java/fr/free/nrw/commons/explore/media/MediaConverter.kt @@ -40,7 +40,7 @@ class MediaConverter metadata.licenseShortName(), metadata.prefixedLicenseUrl, getAuthor(metadata), - imageInfo.user, + getAuthor(metadata), MediaDataExtractorUtil.extractCategoriesFromList(metadata.categories), metadata.latLng, entity.labels().mapValues { it.value.value() }, diff --git a/app/src/main/java/fr/free/nrw/commons/filepicker/Constants.java b/app/src/main/java/fr/free/nrw/commons/filepicker/Constants.java index 3c9299c1a..f907f0a01 100644 --- a/app/src/main/java/fr/free/nrw/commons/filepicker/Constants.java +++ b/app/src/main/java/fr/free/nrw/commons/filepicker/Constants.java @@ -16,7 +16,6 @@ public interface Constants { int PICK_PICTURE_FROM_DOCUMENTS = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 11); int PICK_PICTURE_FROM_GALLERY = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 12); int TAKE_PICTURE = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 13); - int CAPTURE_VIDEO = FILE_PICKER_IMAGE_IDENTIFICATOR + (1 << 14); int RECEIVE_DATA_FROM_FULL_SCREEN_MODE = 1 << 9; } diff --git a/app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java b/app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java index 08453a95d..daa29276a 100644 --- a/app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java +++ b/app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.java @@ -109,7 +109,13 @@ public class FilePicker implements Constants { */ public static void openGallery(Activity activity, int type, boolean openDocumentIntentPreferred) { Intent intent = createGalleryIntent(activity, type, openDocumentIntentPreferred); - activity.startActivityForResult(intent, RequestCodes.PICK_PICTURE_FROM_GALLERY); + int requestCode = RequestCodes.PICK_PICTURE_FROM_GALLERY; + + if(openDocumentIntentPreferred){ + requestCode = RequestCodes.PICK_PICTURE_FROM_DOCUMENTS; + } + + activity.startActivityForResult(intent, requestCode); } /** @@ -157,7 +163,6 @@ public class FilePicker implements Constants { requestCode &= ~RequestCodes.SOURCE_CHOOSER; if (requestCode == RequestCodes.PICK_PICTURE_FROM_GALLERY || requestCode == RequestCodes.TAKE_PICTURE || - requestCode == RequestCodes.CAPTURE_VIDEO || requestCode == RequestCodes.PICK_PICTURE_FROM_DOCUMENTS || requestCode == RequestCodes.PICK_PICTURE_FROM_CUSTOM_SELECTOR) { if (resultCode == Activity.RESULT_OK) { @@ -169,19 +174,16 @@ public class FilePicker implements Constants { onPictureReturnedFromCustomSelector(data, activity, callbacks); } else if (requestCode == RequestCodes.TAKE_PICTURE) { onPictureReturnedFromCamera(activity, callbacks); - } else if (requestCode == RequestCodes.CAPTURE_VIDEO) { - onVideoReturnedFromCamera(activity, callbacks); - } else if (isPhoto(data)) { - onPictureReturnedFromCamera(activity, callbacks); - } else { - onPictureReturnedFromDocuments(data, activity, callbacks); } } else { if (requestCode == RequestCodes.PICK_PICTURE_FROM_DOCUMENTS) { callbacks.onCanceled(FilePicker.ImageSource.DOCUMENTS, restoreType(activity)); } else if (requestCode == RequestCodes.PICK_PICTURE_FROM_GALLERY) { callbacks.onCanceled(FilePicker.ImageSource.GALLERY, restoreType(activity)); - } else { + } else if (requestCode == RequestCodes.PICK_PICTURE_FROM_CUSTOM_SELECTOR){ + callbacks.onCanceled(ImageSource.CUSTOM_SELECTOR, restoreType(activity)); + } + else { callbacks.onCanceled(FilePicker.ImageSource.CAMERA_IMAGE, restoreType(activity)); } } diff --git a/app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java b/app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java index 75a010ea7..572dd0317 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/notification/NotificationActivity.java @@ -19,6 +19,7 @@ import fr.free.nrw.commons.databinding.ActivityNotificationBinding; import fr.free.nrw.commons.auth.SessionManager; import fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException; import fr.free.nrw.commons.notification.models.Notification; +import fr.free.nrw.commons.notification.models.NotificationType; import fr.free.nrw.commons.theme.BaseActivity; import fr.free.nrw.commons.utils.NetworkUtils; import fr.free.nrw.commons.utils.ViewUtil; @@ -148,7 +149,11 @@ public class NotificationActivity extends BaseActivity { } adapter = new NotificatinAdapter(item -> { Timber.d("Notification clicked %s", item.getLink()); - handleUrl(item.getLink()); + if (item.getNotificationType() == NotificationType.EMAIL){ + ViewUtil.showLongSnackbar(binding.container,getString(R.string.check_your_email_inbox)); + } else { + handleUrl(item.getLink()); + } removeNotification(item); return Unit.INSTANCE; }); diff --git a/app/src/main/java/fr/free/nrw/commons/notification/NotificationClient.kt b/app/src/main/java/fr/free/nrw/commons/notification/NotificationClient.kt index aa998ffb5..a0bf1176a 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/NotificationClient.kt +++ b/app/src/main/java/fr/free/nrw/commons/notification/NotificationClient.kt @@ -51,13 +51,23 @@ class NotificationClient } } - private fun WikimediaNotification.toCommonsNotification() = - Notification( - notificationType = NotificationType.UNKNOWN, - notificationText = contents?.compactHeader ?: "", - date = DateUtil.getMonthOnlyDateString(timestamp), - link = contents?.links?.primary?.url ?: "", - iconUrl = "", - notificationId = id().toString(), - ) + private fun WikimediaNotification.toCommonsNotification() : + Notification { + val notificationText = contents?.compactHeader ?: "" + val notificationType = + if (notificationText.contains("Sent you an email", ignoreCase = true)) { + NotificationType.EMAIL + } else { + NotificationType.UNKNOWN + } + + return Notification( + notificationType = notificationType, + notificationText = notificationText, + date = DateUtil.getMonthOnlyDateString(timestamp), + link = contents?.links?.primary?.url ?: "", + iconUrl = "", + notificationId = id().toString(), + ) + } } diff --git a/app/src/main/java/fr/free/nrw/commons/notification/models/NotificationType.java b/app/src/main/java/fr/free/nrw/commons/notification/models/NotificationType.java index 1b825f071..fb9ae7e99 100644 --- a/app/src/main/java/fr/free/nrw/commons/notification/models/NotificationType.java +++ b/app/src/main/java/fr/free/nrw/commons/notification/models/NotificationType.java @@ -4,6 +4,7 @@ public enum NotificationType { THANK_YOU_EDIT("thank-you-edit"), EDIT_USER_TALK("edit-user-talk"), MENTION("mention"), + EMAIL("email"), WELCOME("welcome"), UNKNOWN("unknown"); private String type; diff --git a/app/src/main/res/values-br/strings.xml b/app/src/main/res/values-br/strings.xml index be454b51b..1c7d09617 100644 --- a/app/src/main/res/values-br/strings.xml +++ b/app/src/main/res/values-br/strings.xml @@ -242,8 +242,8 @@ Meneget eo bet ar skeudenn evit lemel. Lezel a-gostez Kevreañ - Ha c\'hoant ho peus, evit gwir, da gevreañ ? - Da gevreañ ho po en amzer-da-zont evit pellgargañ skeudennoù. + Ha n\'ho peus ket c\'hoant, evit gwir, da gevreañ ? + Ret e vo deoc\'h kevreañ en amzer-da-zont evit pellgargañ skeudennoù. Kevreit, mar plij, evit implijout an arc\'hwel-mañ Eilañ an destenn wiki er golver Testenn wiki eilet er golver diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 6fb40d2ff..1a50e9799 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -679,6 +679,7 @@ 作者への感謝の送信エラー。 ログインが期限切れになりました。もう一度ログインしてください。 GPXファイルを開くことができるアプリケーションがありません + メールをご確認ください %d件の画像が選択されました diff --git a/app/src/main/res/values-pa/strings.xml b/app/src/main/res/values-pa/strings.xml index 6cdf7ddc2..d4282fd95 100644 --- a/app/src/main/res/values-pa/strings.xml +++ b/app/src/main/res/values-pa/strings.xml @@ -38,7 +38,7 @@ ਦਿੱਖ ਆਮ ਵਿਕੀਮੀਡੀਆ ਕਾਮਨਜ਼ - ਸੈਟਿੰਗ + ਪਸੰਦਾਂ ਵਰਤੋਂਕਾਰ ਨਾਂ ਲੰਘ-ਸ਼ਬਦ ਦਾਖ਼ਲ ਹੋਵੋ @@ -85,7 +85,7 @@ %1$s ਨਾਲ਼ ਮੇਲ ਖਾਂਦੀ ਕੋਈ ਸ਼੍ਰੇਣੀ ਨਹੀਂ ਲੱਭੀ ਆਪਣੀਆਂ ਤਸਵੀਰਾਂ ਨੂੰ ਵਿਕੀਮੀਡੀਆ ਕਾਮਨਜ਼ ਵਿਚ ਜ਼ਿਆਦਾ ਲੱਭਣਯੋਗ ਬਣਾਉਣ ਲਈ ਸ਼੍ਰੇਣੀਆਂ ਜੋੜੋ।\n\nਸ਼੍ਰੇਣੀਆਂ ਜੋੜਨ ਲਈ ਟਾਈਪ ਕਰਨ ਅਰੰਭ ਕਰੋ।\nਇਸ ਕਾਰਜ ਨੂੰ ਅਣਡਿੱਠਾ ਕਰਨ ਲਈ ਇਹ ਸੁਨੇਹਾ ਥਪੇੜੋ (ਜਾਂ ਵਾਪਸੀ ਬਟਨ ਦਬਾਓ)। ਸ਼੍ਰੇਣੀਆਂ - ਸੈਟਿੰਗ + ਪਸੰਦਾਂ ਸਾਈਨ ਅੱਪ ਸ਼੍ਰੇਣੀ ਇਸ ਬਾਰੇ @@ -149,8 +149,8 @@ ਕੋਈ ਉਪਲਬਧ ਨਹੀਂ 2FA ਕੋਡ ਕੀ ਤੁਸੀਂ ਸੱਚੀਂ ਬੰਦ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ? - ਵਿਕੀਪੀਡੀਆ \'ਤੇ ਸੁਆਗਤ - ਕਾਪੀਰਾਈਟ ਸੁਆਗਤ + ਵਿਕੀਪੀਡੀਆ \'ਤੇ ਜੀ ਆਇਆਂ ਨੂੰ + ਜੀ ਆਇਆਂ ਨੂੰ ਕਾਪੀਰਾਈਟ ਰੱਦ ਕਰੋ ਖੋਲ੍ਹੋ ਬੰਦ ਕਰੋ @@ -178,10 +178,14 @@ ਰੱਦ ਕਰੋ ਲੱਭੋ ਲੱਭੋ + ਹਾਲੀਆ ਖੋਜਾਂ: + ਹਾਲ ਦੀਆਂ ਪੁੱਛਗਿੱਛ ਖੋਜਾਂ + ਹਾਲ ਹੀ ਵਿੱਚ ਬੋਲੀਆਂ ਬਾਰੇ ਪੁੱਛਗਿੱਛ ਸ਼੍ਰੇਣੀਆਂ ਨਕਸ਼ਾ ਸਵਾਲ ਜਾਰੀ ਰੱਖੋ + ਕੋਈ ਤਾਜ਼ਾ ਖੋਜ ਨਹੀਂ ਮਿਟਾਓ ਪ੍ਰਾਪਤੀਆਂ ਅੰਕੜੇ diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 379cc42ae..3e2969df4 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -111,4 +111,5 @@ 没有说明 未知授权协议 刷新 + 请查看你的电子邮箱 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 23da2c286..ab203b841 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -215,4 +215,5 @@ 請盡可能描述媒體內容:拍攝於何處?是顯示什麼事物?有什麼脈絡?請描述對象或人物。透露出一些較不易猜測的訊息,例如是風景的話,可以是一天裡的時間。如果媒體顯示出了一些不尋常的事物,請說明不尋常原因。 學習如何編寫有用的描述 學習如何編寫有用的標題 + 請查看你的電子郵件信箱 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0c09d229a..59dfdd57f 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -805,4 +805,5 @@ 待處理 失敗 無法載入地點資料 + 請查看你的電子郵件信箱 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 2f1647615..e66f40879 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -7,6 +7,7 @@ * A Retired User * Aefgh39622 * Angrydog001 +* Chimes * Crowley666 * D41D8CD98F * Deathkon @@ -827,4 +828,11 @@ “%1$s”位于一个不同的位置。请在下方给出正确的位置,可以的话请填写正确的经纬度。 其他问题或信息(请在下方解释)。 您的反馈已经发布在以下wiki页面:<a href=\"https://commons.wikimedia.org/wiki/Commons:Mobile_app/Feedback\">Commons:Mobile app/Feedback</a> + 您确定要取消所有上传吗? + 取消所有的上传... + 上传 + 待处理 + 失败 + 无法加载地点数据 + 请查看你的电子邮箱 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0c6be3129..b5c2dc529 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -504,6 +504,7 @@ Upload your first media by tapping on the add button. You have no unread notifications You have no read notifications Share logs using + Check your email inbox View read View unread diff --git a/app/src/test/kotlin/fr/free/nrw/commons/filepicker/FilePickerTest.kt b/app/src/test/kotlin/fr/free/nrw/commons/filepicker/FilePickerTest.kt index 171e04b4e..365af27f0 100644 --- a/app/src/test/kotlin/fr/free/nrw/commons/filepicker/FilePickerTest.kt +++ b/app/src/test/kotlin/fr/free/nrw/commons/filepicker/FilePickerTest.kt @@ -64,12 +64,17 @@ class FilePickerTest { `when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref) `when`(sharedPref.edit()).thenReturn(sharedPreferencesEditor) `when`(sharedPref.edit().putInt("type", 0)).thenReturn(sharedPreferencesEditor) - FilePicker.openGallery(activity, 0, nextBoolean()) + val openDocumentPreferred = nextBoolean() + FilePicker.openGallery(activity, 0, openDocumentPreferred) verify(activity).startActivityForResult( ArgumentMatchers.any(), requestCodeCaptor?.capture()?.toInt()!!, ) - assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_GALLERY) + if(openDocumentPreferred){ + assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_DOCUMENTS) + }else{ + assertEquals(requestCodeCaptor?.value, RequestCodes.PICK_PICTURE_FROM_GALLERY) + } } @Test @@ -165,32 +170,6 @@ class FilePickerTest { method.invoke(mockFilePicker, activity) } - @Test - fun testTakenCameraVideo() { - val mockFilePicker = mock(FilePicker::class.java) - val method: Method = - FilePicker::class.java.getDeclaredMethod( - "takenCameraVideo", - Context::class.java, - ) - method.isAccessible = true - method.invoke(mockFilePicker, context) - } - - @Test - fun testTakenCameraVideoCaseTrue() { - val mockFilePicker = mock(FilePicker::class.java) - `when`(PreferenceManager.getDefaultSharedPreferences(activity)).thenReturn(sharedPref) - `when`(sharedPref.getString("last_video", null)).thenReturn("") - val method: Method = - FilePicker::class.java.getDeclaredMethod( - "takenCameraVideo", - Context::class.java, - ) - method.isAccessible = true - method.invoke(mockFilePicker, activity) - } - @Test fun testIsPhoto() { val mockFilePicker = mock(FilePicker::class.java) diff --git a/app/src/test/kotlin/fr/free/nrw/commons/location/LatLngTest.kt b/app/src/test/kotlin/fr/free/nrw/commons/location/LatLngTest.kt index 051b18d18..575beab98 100644 --- a/app/src/test/kotlin/fr/free/nrw/commons/location/LatLngTest.kt +++ b/app/src/test/kotlin/fr/free/nrw/commons/location/LatLngTest.kt @@ -2,6 +2,9 @@ package fr.free.nrw.commons.location import org.junit.Before import org.junit.Test +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.CoreMatchers.equalTo +import org.hamcrest.CoreMatchers.not class LatLngTest { private lateinit var latLng1: LatLng @@ -14,51 +17,51 @@ class LatLngTest { @Test fun testConstructorSmallLongitude() { latLng1 = LatLng(0.0, -181.0, 0.0f) - assert(latLng1.longitude == 179.0) + assertThat(latLng1.longitude, equalTo(179.0)) } @Test fun testConstructorBigLongitude() { latLng1 = LatLng(0.0, 181.0, 0.0f) - assert(latLng1.longitude == -179.0) + assertThat(latLng1.longitude, equalTo(-179.0)) } @Test fun testConstructorSmallLatitude() { latLng1 = LatLng(-91.0, 0.0, 0.0f) - assert(latLng1.latitude == -90.0) + assertThat(latLng1.latitude, equalTo(-90.0)) } @Test fun testConstructorBigLatitude() { latLng1 = LatLng(91.0, 0.0, 0.0f) - assert(latLng1.latitude == 90.0) + assertThat(latLng1.latitude, equalTo(90.0)) } @Test fun testHashCodeDiffersWenLngZero() { latLng1 = LatLng(2.0, 0.0, 0.0f) latLng2 = LatLng(1.0, 0.0, 0.0f) - assert(latLng1.hashCode() != latLng2.hashCode()) + assertThat(latLng1.hashCode(), not(equalTo(latLng2.hashCode()))) } @Test fun testHashCodeDiffersWenLatZero() { latLng1 = LatLng(0.0, 1.0, 0.0f) latLng2 = LatLng(0.0, 2.0, 0.0f) - assert(latLng1.hashCode() != latLng2.hashCode()) + assertThat(latLng1.hashCode(), not(equalTo(latLng2.hashCode()))) } @Test fun testEqualsWorks() { latLng1 = LatLng(1.0, 2.0, 5.0f) latLng2 = LatLng(1.0, 2.0, 0.0f) - assert(latLng1.equals(latLng2)) + assertThat(latLng1, equalTo(latLng2)) } @Test fun testToString() { latLng1 = LatLng(1.0, 2.0, 5.0f) - assert(latLng1.toString().equals("lat/lng: (1.0,2.0)")) + assertThat(latLng1.toString(), equalTo("lat/lng: (1.0,2.0)")) } } diff --git a/app/src/test/kotlin/fr/free/nrw/commons/nearby/LabelTest.kt b/app/src/test/kotlin/fr/free/nrw/commons/nearby/LabelTest.kt index 446bad2cb..80735476e 100644 --- a/app/src/test/kotlin/fr/free/nrw/commons/nearby/LabelTest.kt +++ b/app/src/test/kotlin/fr/free/nrw/commons/nearby/LabelTest.kt @@ -3,6 +3,8 @@ package fr.free.nrw.commons.nearby import fr.free.nrw.commons.R import org.junit.Before import org.junit.Test +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.CoreMatchers.equalTo class LabelTest { private lateinit var label: Label @@ -21,7 +23,7 @@ class LabelTest { */ @Test fun testLabelIcon() { - assert(label.icon.equals(R.drawable.round_icon_church)) + assertThat(label.icon, equalTo(R.drawable.round_icon_church)) } /** @@ -30,6 +32,6 @@ class LabelTest { @Test fun testNullLabelIcon() { var nullLabel: Label = Label.fromText("a random text not exist in label texts") - assert(nullLabel.icon.equals(R.drawable.round_icon_unknown)) + assertThat(nullLabel.icon, equalTo(R.drawable.round_icon_unknown)) } }