11// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22// SPDX-License-Identifier: Apache-2.0
33
4+ import com.example.location.listGeofences
45import com.example.location.scenario.calcDistance
56import com.example.location.scenario.createGeofenceCollection
67import com.example.location.scenario.createKey
@@ -22,17 +23,20 @@ import kotlinx.coroutines.runBlocking
2223import org.junit.jupiter.api.Assertions
2324import org.junit.jupiter.api.MethodOrderer
2425import org.junit.jupiter.api.Order
25- import org.junit.jupiter.api.Tag
2626import org.junit.jupiter.api.Test
2727import org.junit.jupiter.api.TestInstance
2828import org.junit.jupiter.api.TestMethodOrder
29+ import org.slf4j.Logger
30+ import org.slf4j.LoggerFactory
2931
3032@TestInstance(TestInstance .Lifecycle .PER_CLASS )
3133@TestMethodOrder(MethodOrderer .OrderAnnotation ::class )
3234class LocationTest {
35+ private val logger: Logger = LoggerFactory .getLogger(LocationTest ::class .java)
3336 private val mapName = " TestMap"
3437 private val keyName = " TestKey"
3538 private val collectionName = " TestCollection"
39+ private val existingCollectione = " Collection100"
3640 private val geoId = " TestGeo"
3741 private val trackerName = " TestTracker"
3842 private var mapArn = " "
@@ -41,7 +45,6 @@ class LocationTest {
4145 var deviceId = " iPhone-112359" // Use the iPhone's identifier from Swift
4246
4347 @Test
44- @Tag(" IntegrationTest" )
4548 @Order(1 )
4649 fun testScenario () = runBlocking {
4750 println (" ===== Starting Full Location Service Scenario Test =====" )
@@ -52,15 +55,15 @@ class LocationTest {
5255 .onFailure { it.printStackTrace() }
5356 .getOrThrow()
5457
55- println (" Created Map: $mapArn " )
58+ logger.info (" Created Map: $mapArn " )
5659
5760 // Step 2: Create Key
5861 keyArn = runCatching { createKey(keyName, mapArn) }
5962 .onSuccess { Assertions .assertNotNull(it, " Expected key ARN to be non-null" ) }
6063 .onFailure { it.printStackTrace() }
6164 .getOrThrow()
6265
63- println (" Created Key: $keyArn " )
66+ logger.info (" Created Key: $keyArn " )
6467
6568 // Step 3: Geofencing
6669 runCatching { createGeofenceCollection(collectionName) }
@@ -130,9 +133,20 @@ class LocationTest {
130133 val cleanupSuccess = cleanupResults.all { it.isSuccess }
131134 Assertions .assertTrue(cleanupSuccess, " Some resources failed to delete" )
132135
133- println (" ===== Cleanup Completed Successfully =====" )
136+ logger.info (" ===== Cleanup Completed Successfully =====" )
134137 }
135138
136- println (" 🎉 Test 1 Passed Successfully!" )
139+ logger.info(" 🎉 Test 1 Passed Successfully!" )
140+ }
141+
142+ @Test
143+ @Order(2 )
144+ fun testHello () = runBlocking {
145+ runCatching { listGeofences(existingCollectione) }
146+ .onSuccess { println (" Hello passed" ) }
147+ .onFailure { it.printStackTrace() }
148+ .getOrThrow()
149+
150+ logger.info(" 🎉 Test 2 Passed Successfully!" )
137151 }
138152}
0 commit comments