mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
* Updated instances of assert() in WelcomeActivityTest.kt to asserThat(). New imports: - org.hamcrest.CoreMatchers.equalTo - org.hamcrest.CoreMatchers.assertThat * Updated instances of assert() in LatLngTest.kt to asserThat(). New imports: - org.hamcrest.CoreMatchers.equalTo - import org.hamcrest.CoreMatchers.not - org.hamcrest.CoreMatchers.assertThat * Updated instances of assert() in LabelTest.kt to asserThat(). New imports: - org.hamcrest.CoreMatchers.equalTo - org.hamcrest.CoreMatchers.assertThat * Corrected sign error typo in LatLngTest.kt
This commit is contained in:
parent
ef3f6b7977
commit
0a7fe662d4
3 changed files with 25 additions and 18 deletions
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)"))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue