Skip to content

Commit ba85958

Browse files
authored
Changed import statements from junit.framework to org.junit (commons-app#4650)
* Changed import statements from junit.framework to org.junit * Replced deprecated assertequals for 2 doubles by adding a third parameter delta. Used hamcrest.MatcherAssert instead of junit.Assert
1 parent fa3c172 commit ba85958

File tree

8 files changed

+14
-13
lines changed

8 files changed

+14
-13
lines changed

app/src/test/kotlin/fr/free/nrw/commons/WelcomeActivityUnitTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package fr.free.nrw.commons
33
import android.content.Intent
44
import android.widget.TextView
55
import fr.free.nrw.commons.quiz.QuizActivity
6-
import junit.framework.Assert.assertEquals
7-
import junit.framework.Assert.assertNotNull
6+
import org.junit.Assert.assertEquals
7+
import org.junit.Assert.assertNotNull
88
import org.junit.Before
99
import org.junit.Test
1010
import org.junit.runner.RunWith

app/src/test/kotlin/fr/free/nrw/commons/bookmarks/locations/BookMarkLocationDaoTest.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import fr.free.nrw.commons.location.LatLng
1515
import fr.free.nrw.commons.nearby.Label
1616
import fr.free.nrw.commons.nearby.Place
1717
import fr.free.nrw.commons.nearby.Sitelinks
18-
import junit.framework.Assert.*
18+
import org.junit.Assert.*
1919
import org.junit.Before
2020
import org.junit.Test
2121
import org.junit.runner.RunWith
@@ -91,8 +91,8 @@ class BookMarkLocationDaoTest {
9191
assertEquals("placeName", it.name)
9292
assertEquals(Label.FOREST, it.label)
9393
assertEquals("placeDescription", it.longDescription)
94-
assertEquals(40.0, it.location.latitude)
95-
assertEquals(51.4, it.location.longitude)
94+
assertEquals(40.0, it.location.latitude, 0.001)
95+
assertEquals(51.4, it.location.longitude, 0.001)
9696
assertEquals("placeCategory", it.category)
9797
assertEquals(builder.build().wikipediaLink, it.siteLinks.wikipediaLink)
9898
assertEquals(builder.build().wikidataLink, it.siteLinks.wikidataLink)
@@ -157,8 +157,8 @@ class BookMarkLocationDaoTest {
157157
assertEquals(examplePlaceBookmark.longDescription, cv.getAsString(COLUMN_DESCRIPTION))
158158
assertEquals(examplePlaceBookmark.label.text, cv.getAsString(COLUMN_LABEL_TEXT))
159159
assertEquals(examplePlaceBookmark.category, cv.getAsString(COLUMN_CATEGORY))
160-
assertEquals(examplePlaceBookmark.location.latitude, cv.getAsDouble(COLUMN_LAT))
161-
assertEquals(examplePlaceBookmark.location.longitude, cv.getAsDouble(COLUMN_LONG))
160+
assertEquals(examplePlaceBookmark.location.latitude, cv.getAsDouble(COLUMN_LAT), 0.001)
161+
assertEquals(examplePlaceBookmark.location.longitude, cv.getAsDouble(COLUMN_LONG), 0.001)
162162
assertEquals(examplePlaceBookmark.siteLinks.wikipediaLink.toString(), cv.getAsString(COLUMN_WIKIPEDIA_LINK))
163163
assertEquals(examplePlaceBookmark.siteLinks.wikidataLink.toString(), cv.getAsString(COLUMN_WIKIDATA_LINK))
164164
assertEquals(examplePlaceBookmark.siteLinks.commonsLink.toString(), cv.getAsString(COLUMN_COMMONS_LINK))

app/src/test/kotlin/fr/free/nrw/commons/customselector/ui/selector/ImageLoaderTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import fr.free.nrw.commons.media.MediaClient
1515
import fr.free.nrw.commons.upload.FileProcessor
1616
import fr.free.nrw.commons.upload.FileUtilsWrapper
1717
import io.reactivex.Single
18-
import junit.framework.Assert
18+
import org.junit.Assert
1919
import kotlinx.coroutines.Dispatchers
2020
import kotlinx.coroutines.ExperimentalCoroutinesApi
2121
import kotlinx.coroutines.test.*

app/src/test/kotlin/fr/free/nrw/commons/explore/PagingDataSourceFactoryTest.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import fr.free.nrw.commons.explore.paging.PagingDataSource
99
import fr.free.nrw.commons.explore.paging.PagingDataSourceFactory
1010
import io.reactivex.processors.PublishProcessor
1111
import org.hamcrest.CoreMatchers.instanceOf
12+
import org.hamcrest.MatcherAssert
1213
import org.junit.Assert
1314
import org.junit.Before
1415
import org.junit.Ignore
@@ -38,7 +39,7 @@ class PagingDataSourceFactoryTest {
3839

3940
@Test
4041
fun `create returns a dataSource`() {
41-
Assert.assertThat(
42+
MatcherAssert.assertThat(
4243
factory.create(),
4344
instanceOf(PagingDataSource::class.java)
4445
)

app/src/test/kotlin/fr/free/nrw/commons/explore/media/MediaConverterTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.nhaarman.mockitokotlin2.any
44
import com.nhaarman.mockitokotlin2.eq
55
import com.nhaarman.mockitokotlin2.notNull
66
import fr.free.nrw.commons.Media
7-
import junit.framework.Assert.assertEquals
7+
import org.junit.Assert.assertEquals
88
import org.junit.Before
99
import org.junit.Test
1010
import org.mockito.ArgumentMatchers

app/src/test/kotlin/fr/free/nrw/commons/filepicker/FilePickerTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import androidx.preference.PreferenceManager
1010
import com.nhaarman.mockitokotlin2.verify
1111
import fr.free.nrw.commons.TestCommonsApplication
1212
import fr.free.nrw.commons.filepicker.Constants.RequestCodes
13-
import junit.framework.Assert.assertEquals
13+
import org.junit.Assert.assertEquals
1414
import org.junit.Before
1515
import org.junit.Test
1616
import org.junit.runner.RunWith

app/src/test/kotlin/fr/free/nrw/commons/review/ReviewHelperTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import fr.free.nrw.commons.Media
55
import fr.free.nrw.commons.media.MediaClient
66
import io.reactivex.Observable
77
import io.reactivex.Single
8-
import junit.framework.Assert.assertNull
8+
import org.junit.Assert.assertNull
99
import org.junit.Assert.assertTrue
1010
import org.junit.Before
1111
import org.junit.Test

app/src/test/kotlin/fr/free/nrw/commons/upload/FileMetadataUtilsTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package fr.free.nrw.commons.upload
22

33
import androidx.exifinterface.media.ExifInterface.*
4-
import junit.framework.Assert.assertTrue
4+
import org.junit.Assert.assertTrue
55
import org.junit.Test
66
import java.util.*
77

0 commit comments

Comments
 (0)