From f75414eab7a574ae1158bc81584be9cc305dd852 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Tue, 26 Nov 2019 11:31:02 +0100 Subject: [PATCH] Cleanup tests --- .../kotlin/org/ostelco/at/jersey/Tests.kt | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/acceptance-tests/src/main/kotlin/org/ostelco/at/jersey/Tests.kt b/acceptance-tests/src/main/kotlin/org/ostelco/at/jersey/Tests.kt index 83c84a105..3a7df2991 100644 --- a/acceptance-tests/src/main/kotlin/org/ostelco/at/jersey/Tests.kt +++ b/acceptance-tests/src/main/kotlin/org/ostelco/at/jersey/Tests.kt @@ -48,6 +48,7 @@ import kotlin.test.assertFails import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue +import kotlin.test.fail class CustomerTest { @@ -292,23 +293,16 @@ class RegionsTest { customerId = createCustomer(name = "Test Single Region User", email = email).id enableRegion(email = email) - val dataMap = MultivaluedHashMap() - dataMap["regionCode"] = listOf("no") - dataMap["profileType"] = listOf("iPhone") - var regionDetailsList: Collection = get { path = "/regions" this.email = email } assertEquals(2, regionDetailsList.size, "Customer should have 2 regions") - var receivedRegion = regionDetailsList.find { - it.status == APPROVED - }!! - assertEquals(APPROVED, receivedRegion.status, "Region status do not match") + var receivedRegion = regionDetailsList.find { it.status == APPROVED } + ?: fail("Failed to find an approved region.") val regionCode = receivedRegion.region.id - - val simProfile = post { + val simProfile = post { path = "/support/simprofile/$customerId" this.email = email this.queryParams = mapOf("regionCode" to regionCode, "profileType" to "iphone", "alias" to "") @@ -319,9 +313,8 @@ class RegionsTest { this.email = email } // Find the same Region - receivedRegion = regionDetailsList.find { - it.region.id == regionCode - }!! + receivedRegion = regionDetailsList.find { it.region.id == regionCode } + ?: fail("Failed to find the region used to create sim profile.") assertEquals( 1,