Skip to content

Commit 25e467b

Browse files
Refactor Nearby Location Tests to Improve Assertion Logic (commons-app#6103)
-Refactored testSearchCloseToCurrentLocationWhenFar: Simplified assertion by using assertFalse(!isClose) for better readability and logical clarity. -Added testSearchCloseToCurrentLocationWhenClose: Created a new test case to validate behavior when the search is close to the current ___location, ensuring assertTrue(isClose) for correctness. -Improved Coverage: These changes enhance the test coverage and reliability of the searchCloseToCurrentLocation function.
1 parent 038ae9a commit 25e467b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/test/kotlin/fr/free/nrw/commons/nearby/NearbyParentFragmentPresenterTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class NearbyParentFragmentPresenterTest {
306306
// 111.19 km real distance, return false if 148306.444306 > currentLocationSearchRadius
307307
NearbyController.currentLocationSearchRadius = 148306.0
308308
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
309-
assertFalse(isClose!!.equals(false))
309+
assertFalse(!isClose)
310310
}
311311

312312
/**
@@ -318,7 +318,7 @@ class NearbyParentFragmentPresenterTest {
318318
// 111.19 km real distance, return false if 148253.333 > currentLocationSearchRadius
319319
NearbyController.currentLocationSearchRadius = 148307.0
320320
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
321-
assertTrue(isClose!!)
321+
assertTrue(isClose)
322322
}
323323

324324
fun expectMapAndListUpdate() {

0 commit comments

Comments
 (0)