mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Updated instances of assert() in LatLngTest.kt to asserThat().
New imports: - org.hamcrest.CoreMatchers.equalTo - import org.hamcrest.CoreMatchers.not - org.hamcrest.CoreMatchers.assertThat
This commit is contained in:
		
							parent
							
								
									e19dcd9af2
								
							
						
					
					
						commit
						336ee946c2
					
				
					 1 changed files with 11 additions and 8 deletions
				
			
		|  | @ -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)")) | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 u7683345
						u7683345