[android] Remove deprecated junit.framework.Assert (#683)

This commit is contained in:
Bart Louwers
2023-01-11 13:27:35 +00:00
committed by GitHub
parent 41eff5e198
commit aed7c501f2
36 changed files with 204 additions and 206 deletions

View File

@@ -16,11 +16,11 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertSame;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;

View File

@@ -1,7 +1,7 @@
package com.mapbox.mapboxsdk.annotations
import android.graphics.Bitmap
import junit.framework.Assert
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.Mock

View File

@@ -1,6 +1,6 @@
package com.mapbox.mapboxsdk.attribution
import junit.framework.Assert
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@@ -16,8 +16,7 @@ class AttributionParseTest {
.build()
val attributionList = attributionParser.attributions
Assert.assertEquals("Size of list should match", 3, attributionList.size)
var counter = 0
for (attribution in attributionList) {
for ((counter, attribution) in attributionList.withIndex()) {
when (counter) {
0 -> {
Assert.assertEquals(
@@ -52,7 +51,6 @@ class AttributionParseTest {
)
}
}
counter++
}
}
@@ -64,8 +62,7 @@ class AttributionParseTest {
.build()
val attributionList = attributionParser.attributions
Assert.assertEquals("Size of list should match", 2, attributionList.size)
var counter = 0
for (attribution in attributionList) {
for ((counter, attribution) in attributionList.withIndex()) {
when (counter) {
0 -> {
Assert.assertEquals(
@@ -88,7 +85,6 @@ class AttributionParseTest {
)
}
}
counter++
}
}
@@ -101,8 +97,7 @@ class AttributionParseTest {
.build()
val attributionList = attributionParser.attributions
Assert.assertEquals("Size of list should match", 1, attributionList.size)
var counter = 0
for (attribution in attributionList) {
for ((counter, attribution) in attributionList.withIndex()) {
when (counter) {
0 -> {
Assert.assertEquals(
@@ -117,7 +112,6 @@ class AttributionParseTest {
)
}
}
counter++
}
}
@@ -129,8 +123,7 @@ class AttributionParseTest {
.build()
val attributionList = attributionParser.attributions
Assert.assertEquals("Size of list should match", 3, attributionList.size)
var counter = 0
for (attribution in attributionList) {
for ((counter, attribution) in attributionList.withIndex()) {
when (counter) {
0 -> {
Assert.assertEquals(
@@ -165,7 +158,6 @@ class AttributionParseTest {
)
}
}
counter++
}
}
@@ -178,8 +170,7 @@ class AttributionParseTest {
.build()
val attributionList = attributionParser.attributions
Assert.assertEquals("Size of list should match", 3, attributionList.size)
var counter = 0
for (attribution in attributionList) {
for ((counter, attribution) in attributionList.withIndex()) {
when (counter) {
0 -> {
Assert.assertEquals(
@@ -214,7 +205,6 @@ class AttributionParseTest {
)
}
}
counter++
}
}
@@ -227,8 +217,7 @@ class AttributionParseTest {
.build()
val attributionList = attributionParser.attributions
Assert.assertEquals("Size of list should match", 3, attributionList.size)
var counter = 0
for (attribution in attributionList) {
for ((counter, attribution) in attributionList.withIndex()) {
when (counter) {
0 -> {
Assert.assertEquals(
@@ -263,7 +252,6 @@ class AttributionParseTest {
)
}
}
counter++
}
}

View File

@@ -5,7 +5,7 @@ import com.mapbox.mapboxsdk.exceptions.InvalidLatLngBoundsException
import com.mapbox.mapboxsdk.geometry.LatLngBounds.Companion.from
import com.mapbox.mapboxsdk.geometry.LatLngBounds.Companion.world
import com.mapbox.mapboxsdk.utils.MockParcel
import junit.framework.Assert
import org.junit.Assert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -41,7 +41,7 @@ class LatLngBoundsTest {
@Test
fun latitiudeSpan() {
org.junit.Assert.assertEquals(
Assert.assertEquals(
"Span should be the same",
2.0,
latLngBounds!!.latitudeSpan,
@@ -51,7 +51,7 @@ class LatLngBoundsTest {
@Test
fun longitudeSpan() {
org.junit.Assert.assertEquals(
Assert.assertEquals(
"Span should be the same",
2.0,
latLngBounds!!.longitudeSpan,
@@ -62,7 +62,7 @@ class LatLngBoundsTest {
@Test
fun coordinateSpan() {
val latLngSpan = latLngBounds!!.span
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be the same",
LatLngSpan(2.0, 2.0),
latLngSpan
@@ -76,7 +76,7 @@ class LatLngBoundsTest {
.include(LatLng(-10.0, 170.0))
.build()
val latLngSpan = latLngBounds!!.span
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be the same",
LatLngSpan(20.0, 340.0),
latLngSpan
@@ -90,7 +90,7 @@ class LatLngBoundsTest {
.include(LatLng(10.0, 170.0))
.build()
val latLngSpan = latLngBounds!!.span
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be the same",
LatLngSpan(20.0, 340.0),
latLngSpan
@@ -101,7 +101,7 @@ class LatLngBoundsTest {
fun dateLineSpanFrom1() {
latLngBounds = from(10.0, -170.0, -10.0, -190.0)
val latLngSpan = latLngBounds!!.span
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be the same",
LatLngSpan(20.0, 20.0),
latLngSpan
@@ -112,7 +112,7 @@ class LatLngBoundsTest {
fun dateLineSpanFrom2() {
latLngBounds = from(10.0, 170.0, -10.0, -170.0)
val latLngSpan = latLngBounds!!.span
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be the same",
LatLngSpan(20.0, 340.0),
latLngSpan
@@ -123,7 +123,7 @@ class LatLngBoundsTest {
fun zeroLongitudeSpan() {
latLngBounds = from(10.0, 10.0, -10.0, 10.0)
val latLngSpan = latLngBounds!!.span
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be shortest distance",
LatLngSpan(20.0, 0.0),
latLngSpan
@@ -134,55 +134,55 @@ class LatLngBoundsTest {
fun nearDateLineCenter1() {
latLngBounds = from(10.0, -175.0, -10.0, -195.0)
val center = latLngBounds!!.center
org.junit.Assert.assertEquals("Center should match", LatLng(0.0, -185.0), center)
Assert.assertEquals("Center should match", LatLng(0.0, -185.0), center)
}
@Test
fun nearDateLineCenter2() {
latLngBounds = from(10.0, 195.0, -10.0, 175.0)
val center = latLngBounds!!.center
org.junit.Assert.assertEquals("Center should match", LatLng(0.0, 185.0), center)
Assert.assertEquals("Center should match", LatLng(0.0, 185.0), center)
}
@Test
fun nearDateLineCenter3() {
latLngBounds = from(10.0, -170.0, -10.0, -190.0)
val center = latLngBounds!!.center
org.junit.Assert.assertEquals("Center should match", LatLng(0.0, -180.0), center)
Assert.assertEquals("Center should match", LatLng(0.0, -180.0), center)
}
@Test
fun nearDateLineCenter4() {
latLngBounds = from(10.0, 180.0, -10.0, 0.0)
val center = latLngBounds!!.center
org.junit.Assert.assertEquals("Center should match", LatLng(0.0, 90.0), center)
Assert.assertEquals("Center should match", LatLng(0.0, 90.0), center)
}
@Test
fun nearDateLineCenter5() {
latLngBounds = from(10.0, 180.0, -10.0, 0.0)
val center = latLngBounds!!.center
org.junit.Assert.assertEquals("Center should match", LatLng(0.0, 90.0), center)
Assert.assertEquals("Center should match", LatLng(0.0, 90.0), center)
}
@Test
fun centerForBoundsWithSameLongitude() {
latLngBounds = from(10.0, 10.0, -10.0, 10.0)
val center = latLngBounds!!.center
org.junit.Assert.assertEquals("Center should match", LatLng(0.0, 10.0), center)
Assert.assertEquals("Center should match", LatLng(0.0, 10.0), center)
}
@Test
fun centerForBoundsWithSameLatitude() {
latLngBounds = from(10.0, 10.0, 10.0, -10.0)
val center = latLngBounds!!.center
org.junit.Assert.assertEquals("Center should match", LatLng(10.0, 0.0), center)
Assert.assertEquals("Center should match", LatLng(10.0, 0.0), center)
}
@Test
fun center() {
val center = latLngBounds!!.center
org.junit.Assert.assertEquals("Center should match", LatLng(1.0, 1.0), center)
Assert.assertEquals("Center should match", LatLng(1.0, 1.0), center)
}
@Test
@@ -191,7 +191,7 @@ class LatLngBoundsTest {
.include(LAT_LNG_NOT_NULL_ISLAND)
.include(LAT_LNG_NULL_ISLAND)
.build()
org.junit.Assert.assertFalse("Should not be empty", latLngBounds!!.isEmptySpan)
Assert.assertFalse("Should not be empty", latLngBounds!!.isEmptySpan)
}
@Test
@@ -202,8 +202,8 @@ class LatLngBoundsTest {
.include(LAT_LNG_NULL_ISLAND)
.include(LAT_LNG_NULL_ISLAND)
.build()
org.junit.Assert.assertEquals(latLngBounds!!.northEast, LAT_LNG_NOT_NULL_ISLAND)
org.junit.Assert.assertEquals(latLngBounds!!.southWest, LAT_LNG_NULL_ISLAND)
Assert.assertEquals(latLngBounds!!.northEast, LAT_LNG_NOT_NULL_ISLAND)
Assert.assertEquals(latLngBounds!!.southWest, LAT_LNG_NULL_ISLAND)
}
@Test
@@ -212,7 +212,7 @@ class LatLngBoundsTest {
.include(LAT_LNG_NOT_NULL_ISLAND)
.include(LAT_LNG_NULL_ISLAND)
.build()
org.junit.Assert.assertArrayEquals(
Assert.assertArrayEquals(
"LatLngs should match",
arrayOf(LAT_LNG_NOT_NULL_ISLAND, LAT_LNG_NULL_ISLAND),
latLngBounds!!.toLatLngs()
@@ -221,7 +221,7 @@ class LatLngBoundsTest {
@Test
fun include() {
org.junit.Assert.assertTrue(
Assert.assertTrue(
"LatLng should be included",
latLngBounds!!.contains(LatLng(1.0, 1.0))
)
@@ -239,7 +239,7 @@ class LatLngBoundsTest {
.include(LAT_LNG_NULL_ISLAND)
.include(LAT_LNG_NOT_NULL_ISLAND)
.build()
org.junit.Assert.assertEquals("LatLngBounds should match", latLngBounds1, latLngBounds2)
Assert.assertEquals("LatLngBounds should match", latLngBounds1, latLngBounds2)
}
@Test
@@ -258,7 +258,7 @@ class LatLngBoundsTest {
.include(LatLng(60.0, 20.0)) // northEast
.include(LatLng(50.0, 20.0))
.build()
org.junit.Assert.assertEquals(sameLatitudeFirst, sameLongitudeFirst)
Assert.assertEquals(sameLatitudeFirst, sameLongitudeFirst)
}
@Test
@@ -269,7 +269,7 @@ class LatLngBoundsTest {
.include(LatLng(0.0, -190.0))
.build()
val latLngSpan = latLngBounds.span
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be the same",
LatLngSpan(20.0, 20.0),
latLngSpan
@@ -283,7 +283,7 @@ class LatLngBoundsTest {
.include(LatLng(-10.0, 175.0))
.include(LatLng(0.0, 190.0))
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be the same",
LatLngSpan(20.0, 20.0),
latLngBounds.span
@@ -298,7 +298,7 @@ class LatLngBoundsTest {
.include(LatLng(0.0, -180.0))
.include(LatLng(5.0, -180.0))
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngSpan should be the same",
LatLngSpan(20.0, 20.0),
latLngBounds.span
@@ -307,7 +307,7 @@ class LatLngBoundsTest {
@Test
fun containsNot() {
org.junit.Assert.assertFalse(
Assert.assertFalse(
"LatLng should not be included",
latLngBounds!!.contains(LatLng(3.0, 1.0))
)
@@ -315,7 +315,7 @@ class LatLngBoundsTest {
@Test
fun containsBoundsInWorld() {
org.junit.Assert.assertTrue(
Assert.assertTrue(
"LatLngBounds should be contained in the world",
world().contains(latLngBounds!!)
)
@@ -323,13 +323,13 @@ class LatLngBoundsTest {
@Test
fun worldSpan() {
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngBounds world span should be 180, 360",
GeometryConstants.LATITUDE_SPAN,
world().latitudeSpan,
DELTA
)
org.junit.Assert.assertEquals(
Assert.assertEquals(
"LatLngBounds world span should be 180, 360",
GeometryConstants.LONGITUDE_SPAN,
world().longitudeSpan,
@@ -345,7 +345,7 @@ class LatLngBoundsTest {
GeometryConstants.MIN_LATITUDE,
GeometryConstants.MAX_LONGITUDE
)
org.junit.Assert.assertTrue("LatLngBounds empty span", latLngBounds.isEmptySpan)
Assert.assertTrue("LatLngBounds empty span", latLngBounds.isEmptySpan)
}
@Test
@@ -358,13 +358,13 @@ class LatLngBoundsTest {
.include(LatLng(-10.0, -10.0))
.include(LatLng(10.0, 10.0))
.build()
org.junit.Assert.assertTrue(outer.contains(inner))
org.junit.Assert.assertFalse(inner.contains(outer))
Assert.assertTrue(outer.contains(inner))
Assert.assertFalse(inner.contains(outer))
}
@Test
fun testHashCode() {
org.junit.Assert.assertEquals(2147483647f, latLngBounds.hashCode().toFloat(), -1946419200f)
Assert.assertEquals(2147483647f, latLngBounds.hashCode().toFloat(), -1946419200f)
}
@Test
@@ -373,8 +373,8 @@ class LatLngBoundsTest {
.include(LAT_LNG_NULL_ISLAND)
.include(LAT_LNG_NOT_NULL_ISLAND)
.build()
org.junit.Assert.assertEquals("equality should match", this.latLngBounds, latLngBounds)
org.junit.Assert.assertEquals(
Assert.assertEquals("equality should match", this.latLngBounds, latLngBounds)
Assert.assertEquals(
"not equal to a different object type",
this.latLngBounds!!.equals(LAT_LNG_NOT_NULL_ISLAND),
false
@@ -383,7 +383,7 @@ class LatLngBoundsTest {
@Test
fun testToString() {
org.junit.Assert.assertEquals(latLngBounds.toString(), "N:2.0; E:2.0; S:0.0; W:0.0")
Assert.assertEquals(latLngBounds.toString(), "N:2.0; E:2.0; S:0.0; W:0.0")
}
@Test
@@ -392,7 +392,7 @@ class LatLngBoundsTest {
.include(LatLng(1.0, 1.0))
.include(LAT_LNG_NULL_ISLAND)
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"intersect should match",
latLngBounds,
latLngBounds.intersect(
@@ -410,7 +410,7 @@ class LatLngBoundsTest {
.include(LatLng(10.0, 10.0))
.include(LatLng(9.0, 8.0))
.build()
org.junit.Assert.assertNull(latLngBounds.intersect(this.latLngBounds!!))
Assert.assertNull(latLngBounds.intersect(this.latLngBounds!!))
}
@Test
@@ -449,8 +449,8 @@ class LatLngBoundsTest {
val latLngBounds1 = from(10.0, 210.0, 0.0, 0.0)
val latLngBounds2 = from(90.0, 200.0, 0.0, 0.0)
val intersectLatLngBounds = from(10.0, 200.0, 0.0, 0.0)
org.junit.Assert.assertEquals(latLngBounds1.intersect(latLngBounds2), intersectLatLngBounds)
org.junit.Assert.assertEquals(latLngBounds2.intersect(latLngBounds1), intersectLatLngBounds)
Assert.assertEquals(latLngBounds1.intersect(latLngBounds2), intersectLatLngBounds)
Assert.assertEquals(latLngBounds2.intersect(latLngBounds1), intersectLatLngBounds)
}
@Test
@@ -458,8 +458,8 @@ class LatLngBoundsTest {
val latLngBounds1 = from(0.0, 0.0, -10.0, -210.0)
val latLngBounds2 = from(0.0, 0.0, -90.0, -200.0)
val intersectLatLngBounds = from(0.0, 0.0, -10.0, -200.0)
org.junit.Assert.assertEquals(latLngBounds1.intersect(latLngBounds2), intersectLatLngBounds)
org.junit.Assert.assertEquals(latLngBounds2.intersect(latLngBounds1), intersectLatLngBounds)
Assert.assertEquals(latLngBounds1.intersect(latLngBounds2), intersectLatLngBounds)
Assert.assertEquals(latLngBounds2.intersect(latLngBounds1), intersectLatLngBounds)
}
@Test
@@ -468,7 +468,7 @@ class LatLngBoundsTest {
.include(LatLng(1.0, 1.0))
.include(LAT_LNG_NULL_ISLAND)
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"union should match",
latLngBounds,
latLngBounds.intersect(
@@ -483,7 +483,7 @@ class LatLngBoundsTest {
.include(LatLng(10.0, 10.0))
.include(LatLng(9.0, 8.0))
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"outer union should match",
latLngBounds.union(this.latLngBounds!!),
LatLngBounds.Builder()
@@ -505,14 +505,14 @@ class LatLngBoundsTest {
.build()
val union1 = latLngBounds1.union(latLngBounds2)
val union2 = latLngBounds2.union(latLngBounds1)
org.junit.Assert.assertEquals(
Assert.assertEquals(
union1,
LatLngBounds.Builder()
.include(LatLng(10.0, 160.0))
.include(LatLng(-10.0, 200.0))
.build()
)
org.junit.Assert.assertEquals(union1, union2)
Assert.assertEquals(union1, union2)
}
@Test
@@ -527,14 +527,14 @@ class LatLngBoundsTest {
.build()
val union1 = latLngBounds1.union(latLngBounds2)
val union2 = latLngBounds2.union(latLngBounds1)
org.junit.Assert.assertEquals(
Assert.assertEquals(
union1,
LatLngBounds.Builder()
.include(LatLng(10.0, 160.0))
.include(LatLng(-10.0, 200.0))
.build()
)
org.junit.Assert.assertEquals(union1, union2)
Assert.assertEquals(union1, union2)
}
@Test
@@ -549,14 +549,14 @@ class LatLngBoundsTest {
.build()
val union1 = latLngBounds1.union(latLngBounds2)
val union2 = latLngBounds2.union(latLngBounds1)
org.junit.Assert.assertEquals(
Assert.assertEquals(
union1,
LatLngBounds.Builder()
.include(LatLng(10.0, 160.0))
.include(LatLng(-10.0, 200.0))
.build()
)
org.junit.Assert.assertEquals(union1, union2)
Assert.assertEquals(union1, union2)
}
@Test
@@ -571,14 +571,14 @@ class LatLngBoundsTest {
.build()
val union1 = latLngBounds1.union(latLngBounds2)
val union2 = latLngBounds2.union(latLngBounds1)
org.junit.Assert.assertEquals(
Assert.assertEquals(
union1,
LatLngBounds.Builder()
.include(LatLng(10.0, -200.0))
.include(LatLng(-10.0, -160.0))
.build()
)
org.junit.Assert.assertEquals(union1, union2)
Assert.assertEquals(union1, union2)
}
@Test
@@ -593,14 +593,14 @@ class LatLngBoundsTest {
.build()
val union1 = latLngBounds1.union(latLngBounds2)
val union2 = latLngBounds2.union(latLngBounds1)
org.junit.Assert.assertEquals(
Assert.assertEquals(
union1,
LatLngBounds.Builder()
.include(LatLng(10.0, 160.0))
.include(LatLng(-10.0, 200.0))
.build()
)
org.junit.Assert.assertEquals(union1, union2)
Assert.assertEquals(union1, union2)
}
@Test
@@ -609,8 +609,8 @@ class LatLngBoundsTest {
val latLngBounds2 = from(10.0, 10.0, -10.0, -200.0)
val union1 = latLngBounds1.union(latLngBounds2)
val union2 = latLngBounds2.union(latLngBounds1)
org.junit.Assert.assertEquals(union1, union2)
org.junit.Assert.assertEquals(union1, from(10.0, 200.0, -10.0, -200.0))
Assert.assertEquals(union1, union2)
Assert.assertEquals(union1, from(10.0, 200.0, -10.0, -200.0))
}
@Test
@@ -642,8 +642,8 @@ class LatLngBoundsTest {
val latLngBounds1 = from(10.0, 10.0, 0.0, 0.0)
val latLngBounds2 = from(90.0, 200.0, 0.0, 0.0)
val unionLatLngBounds = from(90.0, 200.0, 0.0, 0.0)
org.junit.Assert.assertEquals(latLngBounds1.union(latLngBounds2), unionLatLngBounds)
org.junit.Assert.assertEquals(latLngBounds2.union(latLngBounds1), unionLatLngBounds)
Assert.assertEquals(latLngBounds1.union(latLngBounds2), unionLatLngBounds)
Assert.assertEquals(latLngBounds2.union(latLngBounds1), unionLatLngBounds)
}
@Test
@@ -651,8 +651,8 @@ class LatLngBoundsTest {
val latLngBounds1 = from(0.0, 0.0, -10.0, -10.0)
val latLngBounds2 = from(0.0, 0.0, -90.0, -200.0)
val unionLatLngBounds = from(0.0, 0.0, -90.0, -200.0)
org.junit.Assert.assertEquals(latLngBounds1.union(latLngBounds2), unionLatLngBounds)
org.junit.Assert.assertEquals(latLngBounds2.union(latLngBounds1), unionLatLngBounds)
Assert.assertEquals(latLngBounds1.union(latLngBounds2), unionLatLngBounds)
Assert.assertEquals(latLngBounds2.union(latLngBounds1), unionLatLngBounds)
}
@Test
@@ -665,7 +665,7 @@ class LatLngBoundsTest {
.include(LatLng(minLat, minLon))
.include(LatLng(maxLat, maxLon))
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"NorthWest should match",
latLngBounds.northWest,
LatLng(maxLat, minLon)
@@ -682,7 +682,7 @@ class LatLngBoundsTest {
.include(LatLng(minLat, minLon))
.include(LatLng(maxLat, maxLon))
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"SouthWest should match",
latLngBounds.southWest,
LatLng(minLat, minLon)
@@ -699,7 +699,7 @@ class LatLngBoundsTest {
.include(LatLng(minLat, minLon))
.include(LatLng(maxLat, maxLon))
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"NorthEast should match",
latLngBounds.northEast,
LatLng(maxLat, maxLon)
@@ -716,7 +716,7 @@ class LatLngBoundsTest {
.include(LatLng(minLat, minLon))
.include(LatLng(maxLat, maxLon))
.build()
org.junit.Assert.assertEquals(
Assert.assertEquals(
"SouthEast should match",
latLngBounds.southEast,
LatLng(minLat, maxLon)
@@ -730,37 +730,37 @@ class LatLngBoundsTest {
.include(LatLng(9.0, 8.0))
.build()
val parcel = MockParcel.obtain(latLngBounds)
org.junit.Assert.assertEquals("Parcel should match original object", parcel, latLngBounds)
Assert.assertEquals("Parcel should match original object", parcel, latLngBounds)
}
@Test
fun fromTileID() {
var bounds = from(0, 0, 0)
org.junit.Assert.assertEquals(
Assert.assertEquals(
GeometryConstants.MIN_WRAP_LONGITUDE,
bounds.getLonWest(),
DELTA
)
org.junit.Assert.assertEquals(
Assert.assertEquals(
GeometryConstants.MIN_MERCATOR_LATITUDE,
bounds.getLatSouth(),
DELTA
)
org.junit.Assert.assertEquals(
Assert.assertEquals(
GeometryConstants.MAX_WRAP_LONGITUDE,
bounds.getLonEast(),
DELTA
)
org.junit.Assert.assertEquals(
Assert.assertEquals(
GeometryConstants.MAX_MERCATOR_LATITUDE,
bounds.getLatNorth(),
DELTA
)
bounds = from(10, 288, 385)
org.junit.Assert.assertEquals(-78.75, bounds.getLonWest(), DELTA)
org.junit.Assert.assertEquals(40.446947059600497, bounds.getLatSouth(), DELTA)
org.junit.Assert.assertEquals(-78.3984375, bounds.getLonEast(), DELTA)
org.junit.Assert.assertEquals(40.713955826286039, bounds.getLatNorth(), DELTA)
Assert.assertEquals(-78.75, bounds.getLonWest(), DELTA)
Assert.assertEquals(40.446947059600497, bounds.getLatSouth(), DELTA)
Assert.assertEquals(-78.3984375, bounds.getLonEast(), DELTA)
Assert.assertEquals(40.713955826286039, bounds.getLatNorth(), DELTA)
}
@Rule @JvmField

View File

@@ -4,7 +4,7 @@ import android.hardware.Sensor
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.view.WindowManager
import junit.framework.Assert
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

View File

@@ -14,12 +14,13 @@ import com.mapbox.mapboxsdk.location.modes.RenderMode
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Projection
import io.mockk.*
import junit.framework.Assert.*
import org.junit.Assert.*
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito
import org.robolectric.RobolectricTestRunner
import org.maplibre.testUtils.Assert as MapLibreAssert
@RunWith(RobolectricTestRunner::class)
class LocationAnimatorCoordinatorTest {
@@ -114,18 +115,18 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(location, cameraPosition, false)
val cameraLatLngTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_CAMERA_LATLNG]?.target as LatLng
assertEquals(location.latitude, cameraLatLngTarget.latitude)
assertEquals(location.longitude, cameraLatLngTarget.longitude)
MapLibreAssert.assertEquals(location.latitude, cameraLatLngTarget.latitude)
MapLibreAssert.assertEquals(location.longitude, cameraLatLngTarget.longitude)
val layerLatLngTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_LATLNG]?.target as LatLng
assertEquals(location.latitude, layerLatLngTarget.latitude)
assertEquals(location.longitude, layerLatLngTarget.longitude)
MapLibreAssert.assertEquals(location.latitude, layerLatLngTarget.latitude)
MapLibreAssert.assertEquals(location.longitude, layerLatLngTarget.longitude)
val cameraBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_CAMERA_GPS_BEARING]?.target as Float
assertEquals(location.bearing, cameraBearingTarget)
MapLibreAssert.assertEquals(location.bearing, cameraBearingTarget)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(location.bearing, layerBearingTarget)
MapLibreAssert.assertEquals(location.bearing, layerBearingTarget)
}
@Test
@@ -146,18 +147,18 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(arrayOf(locationInter, location), cameraPosition, false, false)
val cameraLatLngTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_CAMERA_LATLNG]?.target as LatLng
assertEquals(location.latitude, cameraLatLngTarget.latitude)
assertEquals(location.longitude, cameraLatLngTarget.longitude)
MapLibreAssert.assertEquals(location.latitude, cameraLatLngTarget.latitude)
MapLibreAssert.assertEquals(location.longitude, cameraLatLngTarget.longitude)
val layerLatLngTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_LATLNG]?.target as LatLng
assertEquals(location.latitude, layerLatLngTarget.latitude)
assertEquals(location.longitude, layerLatLngTarget.longitude)
MapLibreAssert.assertEquals(location.latitude, layerLatLngTarget.latitude)
MapLibreAssert.assertEquals(location.longitude, layerLatLngTarget.longitude)
val cameraBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_CAMERA_GPS_BEARING]?.target as Float
assertEquals(location.bearing, cameraBearingTarget)
MapLibreAssert.assertEquals(location.bearing, cameraBearingTarget)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(location.bearing, layerBearingTarget)
MapLibreAssert.assertEquals(location.bearing, layerBearingTarget)
verify {
animatorProvider.latLngAnimator(
@@ -285,7 +286,7 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(location, cameraPosition, false)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(360f, layerBearingTarget)
MapLibreAssert.assertEquals(360f, layerBearingTarget)
}
@Test
@@ -302,7 +303,7 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(location, cameraPosition, false)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(450f, layerBearingTarget)
MapLibreAssert.assertEquals(450f, layerBearingTarget)
}
@Test
@@ -319,7 +320,7 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(location, cameraPosition, false)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(-60f, layerBearingTarget)
MapLibreAssert.assertEquals(-60f, layerBearingTarget)
}
@Test
@@ -336,7 +337,7 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(location, cameraPosition, false)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(-10f, layerBearingTarget)
MapLibreAssert.assertEquals(-10f, layerBearingTarget)
}
@Test
@@ -353,7 +354,7 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(location, cameraPosition, false)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(90f, layerBearingTarget)
MapLibreAssert.assertEquals(90f, layerBearingTarget)
}
@Test
@@ -370,7 +371,7 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(location, cameraPosition, false)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(-90f, layerBearingTarget)
MapLibreAssert.assertEquals(-90f, layerBearingTarget)
}
@Test
@@ -396,16 +397,16 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewLocation(location, cameraPosition, true)
val cameraLatLngTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_CAMERA_LATLNG]?.target as LatLng
assertEquals(cameraLatLngTarget.latitude, cameraLatLngTarget.latitude)
MapLibreAssert.assertEquals(cameraLatLngTarget.latitude, cameraLatLngTarget.latitude)
val layerLatLngTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_LATLNG]?.target as LatLng
assertEquals(layerLatLngTarget.latitude, layerLatLngTarget.latitude)
MapLibreAssert.assertEquals(layerLatLngTarget.latitude, layerLatLngTarget.latitude)
val cameraBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_CAMERA_GPS_BEARING]?.target as Float
assertEquals(0f, cameraBearingTarget)
MapLibreAssert.assertEquals(0f, cameraBearingTarget)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_GPS_BEARING]?.target as Float
assertEquals(location.bearing, layerBearingTarget)
MapLibreAssert.assertEquals(location.bearing, layerBearingTarget)
}
@Test
@@ -422,10 +423,10 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewCompassBearing(bearing, cameraPosition)
val cameraBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_CAMERA_COMPASS_BEARING]?.target as Float
assertEquals(bearing, cameraBearingTarget)
MapLibreAssert.assertEquals(bearing, cameraBearingTarget)
val layerBearingTarget = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_COMPASS_BEARING]?.target as Float
assertEquals(bearing, layerBearingTarget)
MapLibreAssert.assertEquals(bearing, layerBearingTarget)
}
@Test
@@ -441,7 +442,7 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewAccuracyRadius(accuracy, false)
val layerAccuracy = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_ACCURACY]?.target as Float
assertEquals(layerAccuracy, accuracy)
MapLibreAssert.assertEquals(layerAccuracy, accuracy)
}
@Test
@@ -457,7 +458,7 @@ class LocationAnimatorCoordinatorTest {
locationAnimatorCoordinator.feedNewAccuracyRadius(accuracy, true)
val layerAccuracy = locationAnimatorCoordinator.animatorArray[ANIMATOR_LAYER_ACCURACY]?.target as Float
assertEquals(layerAccuracy, accuracy)
MapLibreAssert.assertEquals(layerAccuracy, accuracy)
}
@Test
@@ -483,7 +484,7 @@ class LocationAnimatorCoordinatorTest {
)
val animator = locationAnimatorCoordinator.animatorArray[ANIMATOR_ZOOM]
assertEquals(zoom, animator.target)
MapLibreAssert.assertEquals(zoom, animator.target as Float)
verify { animatorSetProvider.startAnimation(eq(listOf(animator)), any<LinearInterpolator>(), DEFAULT_TRACKING_ZOOM_ANIM_DURATION) }
}
@@ -510,7 +511,7 @@ class LocationAnimatorCoordinatorTest {
)
val animator = locationAnimatorCoordinator.animatorArray[ANIMATOR_TILT]
assertEquals(tilt, animator.target)
MapLibreAssert.assertEquals(tilt, animator.target as Float)
verify { animatorSetProvider.startAnimation(eq(listOf(animator)), any<LinearInterpolator>(), DEFAULT_TRACKING_TILT_ANIM_DURATION) }
}

View File

@@ -17,7 +17,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveListener
import com.mapbox.mapboxsdk.maps.Projection
import com.mapbox.mapboxsdk.maps.Transform
import com.mapbox.mapboxsdk.maps.UiSettings
import junit.framework.Assert
import org.junit.Assert
import org.junit.Test
import org.mockito.ArgumentCaptor
import org.mockito.ArgumentMatchers

View File

@@ -4,8 +4,8 @@ import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.style.layers.Layer
import io.mockk.mockk
import io.mockk.verify
import junit.framework.Assert.assertFalse
import junit.framework.Assert.assertTrue
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

View File

@@ -10,7 +10,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.style.layers.Layer
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource
import junit.framework.Assert
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.ArgumentMatchers

View File

@@ -1,6 +1,6 @@
package com.mapbox.mapboxsdk.location
import junit.framework.Assert
import org.junit.Assert
import org.junit.Test
class UtilsTest {

View File

@@ -18,8 +18,8 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
import static java.util.concurrent.TimeUnit.SECONDS;
import static junit.framework.TestCase.assertTrue;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;

View File

@@ -6,7 +6,7 @@ import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions
import com.mapbox.mapboxsdk.annotations.Marker
import com.mapbox.mapboxsdk.annotations.MarkerOptions
import com.mapbox.mapboxsdk.geometry.LatLng
import junit.framework.Assert
import org.junit.Assert
import org.junit.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mockito

View File

@@ -4,7 +4,7 @@ import com.google.common.util.concurrent.ExecutionError
import com.mapbox.mapboxsdk.log.Logger
import com.mapbox.mapboxsdk.log.LoggerDefinition
import com.mapbox.mapboxsdk.maps.MapView.*
import junit.framework.Assert
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.ArgumentMatchers

View File

@@ -21,24 +21,24 @@ class MapboxMapOptionsTest {
@Test
fun testDebugEnabled() {
junit.framework.Assert.assertFalse(MapboxMapOptions().debugActive)
Assert.assertFalse(MapboxMapOptions().debugActive)
Assert.assertTrue(MapboxMapOptions().debugActive(true).debugActive)
junit.framework.Assert.assertFalse(MapboxMapOptions().debugActive(false).debugActive)
Assert.assertFalse(MapboxMapOptions().debugActive(false).debugActive)
}
@Test
fun testCompassEnabled() {
Assert.assertTrue(MapboxMapOptions().compassEnabled(true).compassEnabled)
junit.framework.Assert.assertFalse(MapboxMapOptions().compassEnabled(false).compassEnabled)
Assert.assertFalse(MapboxMapOptions().compassEnabled(false).compassEnabled)
}
@Test
fun testCompassGravity() {
junit.framework.Assert.assertEquals(
Assert.assertEquals(
Gravity.TOP or Gravity.END,
MapboxMapOptions().compassGravity
)
junit.framework.Assert.assertEquals(
Assert.assertEquals(
Gravity.BOTTOM,
MapboxMapOptions().compassGravity(Gravity.BOTTOM).compassGravity
)
@@ -56,7 +56,7 @@ class MapboxMapOptionsTest {
MapboxMapOptions().compassMargins(intArrayOf(0, 1, 2, 3)).compassMargins
)
)
junit.framework.Assert.assertFalse(
Assert.assertFalse(
Arrays.equals(
intArrayOf(0, 1, 2, 3),
MapboxMapOptions().compassMargins(intArrayOf(0, 0, 0, 0)).compassMargins
@@ -67,16 +67,16 @@ class MapboxMapOptionsTest {
@Test
fun testLogoEnabled() {
Assert.assertTrue(MapboxMapOptions().logoEnabled(true).logoEnabled)
junit.framework.Assert.assertFalse(MapboxMapOptions().logoEnabled(false).logoEnabled)
Assert.assertFalse(MapboxMapOptions().logoEnabled(false).logoEnabled)
}
@Test
fun testLogoGravity() {
junit.framework.Assert.assertEquals(
Assert.assertEquals(
Gravity.BOTTOM or Gravity.START,
MapboxMapOptions().logoGravity
)
junit.framework.Assert.assertEquals(
Assert.assertEquals(
Gravity.BOTTOM,
MapboxMapOptions().logoGravity(Gravity.BOTTOM).logoGravity
)
@@ -94,7 +94,7 @@ class MapboxMapOptionsTest {
MapboxMapOptions().logoMargins(intArrayOf(0, 1, 2, 3)).logoMargins
)
)
junit.framework.Assert.assertFalse(
Assert.assertFalse(
Arrays.equals(
intArrayOf(0, 1, 2, 3),
MapboxMapOptions().logoMargins(intArrayOf(0, 0, 0, 0)).logoMargins
@@ -104,8 +104,8 @@ class MapboxMapOptionsTest {
@Test
fun testAttributionTintColor() {
junit.framework.Assert.assertEquals(-1, MapboxMapOptions().attributionTintColor)
junit.framework.Assert.assertEquals(
Assert.assertEquals(-1, MapboxMapOptions().attributionTintColor)
Assert.assertEquals(
Color.RED,
MapboxMapOptions().attributionTintColor(Color.RED).attributionTintColor
)
@@ -114,16 +114,16 @@ class MapboxMapOptionsTest {
@Test
fun testAttributionEnabled() {
Assert.assertTrue(MapboxMapOptions().attributionEnabled(true).attributionEnabled)
junit.framework.Assert.assertFalse(MapboxMapOptions().attributionEnabled(false).attributionEnabled)
Assert.assertFalse(MapboxMapOptions().attributionEnabled(false).attributionEnabled)
}
@Test
fun testAttributionGravity() {
junit.framework.Assert.assertEquals(
Assert.assertEquals(
Gravity.BOTTOM or Gravity.START,
MapboxMapOptions().attributionGravity
)
junit.framework.Assert.assertEquals(
Assert.assertEquals(
Gravity.BOTTOM,
MapboxMapOptions().attributionGravity(Gravity.BOTTOM).attributionGravity
)
@@ -141,7 +141,7 @@ class MapboxMapOptionsTest {
MapboxMapOptions().attributionMargins(intArrayOf(0, 1, 2, 3)).attributionMargins
)
)
junit.framework.Assert.assertFalse(
Assert.assertFalse(
Arrays.equals(
intArrayOf(0, 1, 2, 3),
MapboxMapOptions().attributionMargins(intArrayOf(0, 0, 0, 0)).attributionMargins
@@ -151,12 +151,12 @@ class MapboxMapOptionsTest {
@Test
fun testMinZoom() {
junit.framework.Assert.assertEquals(
Assert.assertEquals(
MapboxConstants.MINIMUM_ZOOM.toDouble(),
MapboxMapOptions().minZoomPreference,
DELTA
)
junit.framework.Assert.assertEquals(
Assert.assertEquals(
5.0,
MapboxMapOptions().minZoomPreference(5.0).minZoomPreference,
DELTA
@@ -170,12 +170,12 @@ class MapboxMapOptionsTest {
@Test
fun testMaxZoom() {
junit.framework.Assert.assertEquals(
Assert.assertEquals(
MapboxConstants.MAXIMUM_ZOOM.toDouble(),
MapboxMapOptions().maxZoomPreference,
DELTA
)
junit.framework.Assert.assertEquals(
Assert.assertEquals(
5.0,
MapboxMapOptions().maxZoomPreference(5.0).maxZoomPreference,
DELTA
@@ -189,12 +189,12 @@ class MapboxMapOptionsTest {
@Test
fun testMinPitch() {
junit.framework.Assert.assertEquals(
Assert.assertEquals(
MapboxConstants.MINIMUM_PITCH.toDouble(),
MapboxMapOptions().minPitchPreference,
DELTA
)
junit.framework.Assert.assertEquals(
Assert.assertEquals(
5.0,
MapboxMapOptions().minPitchPreference(5.0).minPitchPreference,
DELTA
@@ -208,12 +208,12 @@ class MapboxMapOptionsTest {
@Test
fun testMaxPitch() {
junit.framework.Assert.assertEquals(
Assert.assertEquals(
MapboxConstants.MAXIMUM_PITCH.toDouble(),
MapboxMapOptions().maxPitchPreference,
DELTA
)
junit.framework.Assert.assertEquals(
Assert.assertEquals(
5.0,
MapboxMapOptions().maxPitchPreference(5.0).maxPitchPreference,
DELTA
@@ -229,41 +229,41 @@ class MapboxMapOptionsTest {
fun testTiltGesturesEnabled() {
Assert.assertTrue(MapboxMapOptions().tiltGesturesEnabled)
Assert.assertTrue(MapboxMapOptions().tiltGesturesEnabled(true).tiltGesturesEnabled)
junit.framework.Assert.assertFalse(MapboxMapOptions().tiltGesturesEnabled(false).tiltGesturesEnabled)
Assert.assertFalse(MapboxMapOptions().tiltGesturesEnabled(false).tiltGesturesEnabled)
}
@Test
fun testScrollGesturesEnabled() {
Assert.assertTrue(MapboxMapOptions().scrollGesturesEnabled)
Assert.assertTrue(MapboxMapOptions().scrollGesturesEnabled(true).scrollGesturesEnabled)
junit.framework.Assert.assertFalse(MapboxMapOptions().scrollGesturesEnabled(false).scrollGesturesEnabled)
Assert.assertFalse(MapboxMapOptions().scrollGesturesEnabled(false).scrollGesturesEnabled)
}
@Test
fun testHorizontalScrollGesturesEnabled() {
Assert.assertTrue(MapboxMapOptions().horizontalScrollGesturesEnabled)
Assert.assertTrue(MapboxMapOptions().horizontalScrollGesturesEnabled(true).horizontalScrollGesturesEnabled)
junit.framework.Assert.assertFalse(MapboxMapOptions().horizontalScrollGesturesEnabled(false).horizontalScrollGesturesEnabled)
Assert.assertFalse(MapboxMapOptions().horizontalScrollGesturesEnabled(false).horizontalScrollGesturesEnabled)
}
@Test
fun testZoomGesturesEnabled() {
Assert.assertTrue(MapboxMapOptions().zoomGesturesEnabled)
Assert.assertTrue(MapboxMapOptions().zoomGesturesEnabled(true).zoomGesturesEnabled)
junit.framework.Assert.assertFalse(MapboxMapOptions().zoomGesturesEnabled(false).zoomGesturesEnabled)
Assert.assertFalse(MapboxMapOptions().zoomGesturesEnabled(false).zoomGesturesEnabled)
}
@Test
fun testRotateGesturesEnabled() {
Assert.assertTrue(MapboxMapOptions().rotateGesturesEnabled)
Assert.assertTrue(MapboxMapOptions().rotateGesturesEnabled(true).rotateGesturesEnabled)
junit.framework.Assert.assertFalse(MapboxMapOptions().rotateGesturesEnabled(false).rotateGesturesEnabled)
Assert.assertFalse(MapboxMapOptions().rotateGesturesEnabled(false).rotateGesturesEnabled)
}
@Test
fun testCamera() {
val position = CameraPosition.Builder().build()
junit.framework.Assert.assertEquals(
Assert.assertEquals(
CameraPosition.Builder(position).build(),
MapboxMapOptions().camera(position).camera
)
@@ -271,7 +271,7 @@ class MapboxMapOptionsTest {
CameraPosition.Builder().target(LatLng(1.0, 1.0)),
MapboxMapOptions().camera(position)
)
junit.framework.Assert.assertNull(MapboxMapOptions().camera)
Assert.assertNull(MapboxMapOptions().camera)
}
@Test
@@ -281,16 +281,16 @@ class MapboxMapOptionsTest {
// Check mutations
Assert.assertTrue(MapboxMapOptions().setPrefetchesTiles(true).prefetchesTiles)
junit.framework.Assert.assertFalse(MapboxMapOptions().setPrefetchesTiles(false).prefetchesTiles)
Assert.assertFalse(MapboxMapOptions().setPrefetchesTiles(false).prefetchesTiles)
}
@Test
fun testPrefetchZoomDelta() {
// Default value
junit.framework.Assert.assertEquals(4, MapboxMapOptions().prefetchZoomDelta)
Assert.assertEquals(4, MapboxMapOptions().prefetchZoomDelta)
// Check mutations
junit.framework.Assert.assertEquals(
Assert.assertEquals(
5,
MapboxMapOptions().setPrefetchZoomDelta(5).prefetchZoomDelta
)
@@ -303,13 +303,13 @@ class MapboxMapOptionsTest {
// check mutations
Assert.assertTrue(MapboxMapOptions().crossSourceCollisions(true).crossSourceCollisions)
junit.framework.Assert.assertFalse(MapboxMapOptions().crossSourceCollisions(false).crossSourceCollisions)
Assert.assertFalse(MapboxMapOptions().crossSourceCollisions(false).crossSourceCollisions)
}
@Test
fun testLocalIdeographFontFamily_enabledByDefault() {
val options = MapboxMapOptions.createFromAttributes(RuntimeEnvironment.application, null)
junit.framework.Assert.assertEquals(
Assert.assertEquals(
MapboxConstants.DEFAULT_FONT,
options.localIdeographFontFamily
)

View File

@@ -10,7 +10,7 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds
import com.mapbox.mapboxsdk.style.layers.TransitionOptions
import com.mapbox.mapboxsdk.utils.ConfigUtils
import io.mockk.*
import junit.framework.Assert.assertEquals
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

View File

@@ -4,8 +4,8 @@ import com.mapbox.mapboxsdk.MapboxInjector
import com.mapbox.mapboxsdk.http.HttpRequestUrl
import com.mapbox.mapboxsdk.utils.ConfigUtils
import io.mockk.mockk
import junit.framework.Assert.assertEquals
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

View File

@@ -3,8 +3,8 @@ package com.mapbox.mapboxsdk.module.http
import com.mapbox.mapboxsdk.MapboxInjector
import com.mapbox.mapboxsdk.utils.ConfigUtils
import io.mockk.mockk
import junit.framework.Assert.assertEquals
import okhttp3.OkHttpClient
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner

View File

@@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.style.expressions.Expression.FormatOption
import com.mapbox.mapboxsdk.style.layers.PropertyFactory
import com.mapbox.mapboxsdk.style.layers.PropertyValue
import com.mapbox.mapboxsdk.utils.ColorUtils
import junit.framework.Assert
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner

View File

@@ -1,7 +1,7 @@
package com.mapbox.mapboxsdk.utils
import android.graphics.Color
import junit.framework.Assert
import org.junit.Assert
import org.junit.Test
class ColorUtilsTest {

View File

@@ -14,8 +14,8 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyByte;
import static org.mockito.ArgumentMatchers.anyDouble;

View File

@@ -0,0 +1,14 @@
package org.maplibre.testUtils
const val DELTA_FLOAT: Float = 1e-15f
const val DELTA_DOUBLE: Double = 1e-15
object Assert {
fun assertEquals(expected: Double, actual: Double) {
org.junit.Assert.assertEquals(expected, actual, DELTA_DOUBLE)
}
fun assertEquals(expected: Float, actual: Float) {
org.junit.Assert.assertEquals(expected, actual, DELTA_FLOAT)
}
}

View File

@@ -14,10 +14,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertSame;
import static junit.framework.Assert.assertTrue;
@RunWith(AndroidJUnit4ClassRunner.class)
public class MapboxTest extends AppCenter {

View File

@@ -15,9 +15,9 @@ import com.mapbox.mapboxsdk.geometry.ProjectedMeters
import com.mapbox.mapboxsdk.maps.renderer.MapRenderer
import com.mapbox.mapboxsdk.style.layers.TransitionOptions
import com.mapbox.mapboxsdk.testapp.utils.TestConstants
import junit.framework.Assert.*
import org.junit.After
import org.junit.Assert
import org.junit.Assert.*
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

View File

@@ -8,8 +8,8 @@ import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.style.layers.BackgroundLayer
import com.mapbox.mapboxsdk.style.layers.PropertyFactory
import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
import junit.framework.Assert.assertNotNull
import org.junit.Assert
import org.junit.Assert.assertNotNull
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

View File

@@ -10,7 +10,8 @@ import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
import com.mapbox.mapboxsdk.testapp.activity.BaseTest;
import com.mapbox.mapboxsdk.testapp.activity.<%- subPackage %>.<%- activity %>;
import junit.framework.Assert;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -1,5 +1,10 @@
package com.mapbox.mapboxsdk.testapp.annotations;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import android.app.Activity;
import androidx.core.content.res.ResourcesCompat;
@@ -20,11 +25,6 @@ import org.junit.Test;
import java.util.Map;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
/**
* Tests integration between Icons and Markers
*/

View File

@@ -1,5 +1,7 @@
package com.mapbox.mapboxsdk.testapp.geometry;
import static org.junit.Assert.assertEquals;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
@@ -10,8 +12,6 @@ import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
/**
* Instrumentation test to validate integration of LatLngBounds
*/

View File

@@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.maps.MapView
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.testapp.R
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity
import junit.framework.Assert.assertEquals
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Rule
import org.junit.Test

View File

@@ -10,8 +10,8 @@ import com.mapbox.mapboxsdk.maps.MapView
import com.mapbox.mapboxsdk.maps.MapboxMapOptions
import com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.MapboxGLSurfaceView
import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
import junit.framework.Assert.assertNotNull
import junit.framework.Assert.assertTrue
import org.junit.Assert.assertNotNull
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

View File

@@ -12,8 +12,8 @@ import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import static com.mapbox.mapboxsdk.testapp.activity.offline.OfflineActivity.JSON_CHARSET;
import static junit.framework.Assert.assertEquals;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@RunWith(AndroidJUnit4ClassRunner.class)
public class OfflineUtilsTest extends AppCenter {

View File

@@ -6,7 +6,6 @@ import androidx.test.rule.ActivityTestRule
import com.mapbox.mapboxsdk.AppCenter
import com.mapbox.mapboxsdk.storage.FileSource
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity
import junit.framework.Assert
import org.junit.After
import org.junit.Before
import org.junit.Rule

View File

@@ -4,7 +4,7 @@ import android.app.Activity
import androidx.annotation.WorkerThread
import com.mapbox.mapboxsdk.AppCenter
import com.mapbox.mapboxsdk.storage.FileSource
import junit.framework.Assert
import org.junit.Assert
import java.io.File
import java.util.concurrent.CountDownLatch

View File

@@ -1,5 +1,7 @@
package com.mapbox.mapboxsdk.testapp.string;
import static org.junit.Assert.assertEquals;
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
@@ -7,8 +9,6 @@ import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import static junit.framework.Assert.assertEquals;
/**
* Test verifying if String#toUpperCase and String#toLowerCase produces desired results
* <p>

View File

@@ -32,8 +32,8 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionCol
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpacity;
import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@RunWith(AndroidJUnit4ClassRunner.class)
public class LightTest extends BaseTest {

View File

@@ -23,9 +23,8 @@ import com.mapbox.mapboxsdk.style.sources.VectorSource;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
import junit.framework.Assert;
import org.hamcrest.Matcher;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -35,8 +35,8 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHei
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpacity;
import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@RunWith(AndroidJUnit4ClassRunner.class)
public class LightTest extends BaseTest {