Changed import statements from junit.framework to org.junit (#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
This commit is contained in:
BashCache 2021-10-15 01:48:29 +05:30 committed by GitHub
parent fa3c17280d
commit ba85958eda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 13 deletions

View file

@ -3,8 +3,8 @@ package fr.free.nrw.commons
import android.content.Intent import android.content.Intent
import android.widget.TextView import android.widget.TextView
import fr.free.nrw.commons.quiz.QuizActivity import fr.free.nrw.commons.quiz.QuizActivity
import junit.framework.Assert.assertEquals import org.junit.Assert.assertEquals
import junit.framework.Assert.assertNotNull import org.junit.Assert.assertNotNull
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -15,7 +15,7 @@ import fr.free.nrw.commons.location.LatLng
import fr.free.nrw.commons.nearby.Label import fr.free.nrw.commons.nearby.Label
import fr.free.nrw.commons.nearby.Place import fr.free.nrw.commons.nearby.Place
import fr.free.nrw.commons.nearby.Sitelinks import fr.free.nrw.commons.nearby.Sitelinks
import junit.framework.Assert.* import org.junit.Assert.*
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
@ -91,8 +91,8 @@ class BookMarkLocationDaoTest {
assertEquals("placeName", it.name) assertEquals("placeName", it.name)
assertEquals(Label.FOREST, it.label) assertEquals(Label.FOREST, it.label)
assertEquals("placeDescription", it.longDescription) assertEquals("placeDescription", it.longDescription)
assertEquals(40.0, it.location.latitude) assertEquals(40.0, it.location.latitude, 0.001)
assertEquals(51.4, it.location.longitude) assertEquals(51.4, it.location.longitude, 0.001)
assertEquals("placeCategory", it.category) assertEquals("placeCategory", it.category)
assertEquals(builder.build().wikipediaLink, it.siteLinks.wikipediaLink) assertEquals(builder.build().wikipediaLink, it.siteLinks.wikipediaLink)
assertEquals(builder.build().wikidataLink, it.siteLinks.wikidataLink) assertEquals(builder.build().wikidataLink, it.siteLinks.wikidataLink)
@ -157,8 +157,8 @@ class BookMarkLocationDaoTest {
assertEquals(examplePlaceBookmark.longDescription, cv.getAsString(COLUMN_DESCRIPTION)) assertEquals(examplePlaceBookmark.longDescription, cv.getAsString(COLUMN_DESCRIPTION))
assertEquals(examplePlaceBookmark.label.text, cv.getAsString(COLUMN_LABEL_TEXT)) assertEquals(examplePlaceBookmark.label.text, cv.getAsString(COLUMN_LABEL_TEXT))
assertEquals(examplePlaceBookmark.category, cv.getAsString(COLUMN_CATEGORY)) assertEquals(examplePlaceBookmark.category, cv.getAsString(COLUMN_CATEGORY))
assertEquals(examplePlaceBookmark.location.latitude, cv.getAsDouble(COLUMN_LAT)) assertEquals(examplePlaceBookmark.location.latitude, cv.getAsDouble(COLUMN_LAT), 0.001)
assertEquals(examplePlaceBookmark.location.longitude, cv.getAsDouble(COLUMN_LONG)) assertEquals(examplePlaceBookmark.location.longitude, cv.getAsDouble(COLUMN_LONG), 0.001)
assertEquals(examplePlaceBookmark.siteLinks.wikipediaLink.toString(), cv.getAsString(COLUMN_WIKIPEDIA_LINK)) assertEquals(examplePlaceBookmark.siteLinks.wikipediaLink.toString(), cv.getAsString(COLUMN_WIKIPEDIA_LINK))
assertEquals(examplePlaceBookmark.siteLinks.wikidataLink.toString(), cv.getAsString(COLUMN_WIKIDATA_LINK)) assertEquals(examplePlaceBookmark.siteLinks.wikidataLink.toString(), cv.getAsString(COLUMN_WIKIDATA_LINK))
assertEquals(examplePlaceBookmark.siteLinks.commonsLink.toString(), cv.getAsString(COLUMN_COMMONS_LINK)) assertEquals(examplePlaceBookmark.siteLinks.commonsLink.toString(), cv.getAsString(COLUMN_COMMONS_LINK))

View file

@ -15,7 +15,7 @@ import fr.free.nrw.commons.media.MediaClient
import fr.free.nrw.commons.upload.FileProcessor import fr.free.nrw.commons.upload.FileProcessor
import fr.free.nrw.commons.upload.FileUtilsWrapper import fr.free.nrw.commons.upload.FileUtilsWrapper
import io.reactivex.Single import io.reactivex.Single
import junit.framework.Assert import org.junit.Assert
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.* import kotlinx.coroutines.test.*

View file

@ -9,6 +9,7 @@ import fr.free.nrw.commons.explore.paging.PagingDataSource
import fr.free.nrw.commons.explore.paging.PagingDataSourceFactory import fr.free.nrw.commons.explore.paging.PagingDataSourceFactory
import io.reactivex.processors.PublishProcessor import io.reactivex.processors.PublishProcessor
import org.hamcrest.CoreMatchers.instanceOf import org.hamcrest.CoreMatchers.instanceOf
import org.hamcrest.MatcherAssert
import org.junit.Assert import org.junit.Assert
import org.junit.Before import org.junit.Before
import org.junit.Ignore import org.junit.Ignore
@ -38,7 +39,7 @@ class PagingDataSourceFactoryTest {
@Test @Test
fun `create returns a dataSource`() { fun `create returns a dataSource`() {
Assert.assertThat( MatcherAssert.assertThat(
factory.create(), factory.create(),
instanceOf(PagingDataSource::class.java) instanceOf(PagingDataSource::class.java)
) )

View file

@ -4,7 +4,7 @@ import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.eq import com.nhaarman.mockitokotlin2.eq
import com.nhaarman.mockitokotlin2.notNull import com.nhaarman.mockitokotlin2.notNull
import fr.free.nrw.commons.Media import fr.free.nrw.commons.Media
import junit.framework.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers

View file

@ -10,7 +10,7 @@ import androidx.preference.PreferenceManager
import com.nhaarman.mockitokotlin2.verify import com.nhaarman.mockitokotlin2.verify
import fr.free.nrw.commons.TestCommonsApplication import fr.free.nrw.commons.TestCommonsApplication
import fr.free.nrw.commons.filepicker.Constants.RequestCodes import fr.free.nrw.commons.filepicker.Constants.RequestCodes
import junit.framework.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith

View file

@ -5,7 +5,7 @@ import fr.free.nrw.commons.Media
import fr.free.nrw.commons.media.MediaClient import fr.free.nrw.commons.media.MediaClient
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.Single import io.reactivex.Single
import junit.framework.Assert.assertNull import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test

View file

@ -1,7 +1,7 @@
package fr.free.nrw.commons.upload package fr.free.nrw.commons.upload
import androidx.exifinterface.media.ExifInterface.* import androidx.exifinterface.media.ExifInterface.*
import junit.framework.Assert.assertTrue import org.junit.Assert.assertTrue
import org.junit.Test import org.junit.Test
import java.util.* import java.util.*