From 529ed07740f035368fe190138ddab0826b249a0e Mon Sep 17 00:00:00 2001 From: Marcus Goplen Date: Fri, 20 Sep 2024 10:08:37 +0200 Subject: [PATCH] ETU-51767: Added better data in all test requests --- .../shared/mobility/to/ref/data/Asset.kt | 3 +- .../shared/mobility/to/ref/data/AssetType.kt | 12 +-- .../ref/controller/BookingsControllerTest.kt | 99 ++++++++++--------- .../to/ref/controller/LegsControllerTest.kt | 87 ++++++++-------- .../ref/controller/OperatorControllerTest.kt | 68 ++++++------- .../ref/controller/PaymentControllerTest.kt | 21 ++-- .../ref/controller/PlanningControllerTest.kt | 16 +-- .../ref/controller/SupportControllerTest.kt | 19 ++-- 8 files changed, 164 insertions(+), 161 deletions(-) diff --git a/src/main/kotlin/no/entur/shared/mobility/to/ref/data/Asset.kt b/src/main/kotlin/no/entur/shared/mobility/to/ref/data/Asset.kt index fac91ce..ab9d2ce 100644 --- a/src/main/kotlin/no/entur/shared/mobility/to/ref/data/Asset.kt +++ b/src/main/kotlin/no/entur/shared/mobility/to/ref/data/Asset.kt @@ -2,12 +2,11 @@ package no.entur.shared.mobility.to.ref.data import no.entur.shared.mobility.to.ref.dto.Asset import no.entur.shared.mobility.to.ref.dto.AssetProperties -import java.util.UUID val asset get() = Asset( - id = UUID.randomUUID().toString(), + id = "Asset:549", stateOfCharge = 100, maxRange = 100, licensePlate = "EK1234", diff --git a/src/main/kotlin/no/entur/shared/mobility/to/ref/data/AssetType.kt b/src/main/kotlin/no/entur/shared/mobility/to/ref/data/AssetType.kt index 61392a5..e3a038d 100644 --- a/src/main/kotlin/no/entur/shared/mobility/to/ref/data/AssetType.kt +++ b/src/main/kotlin/no/entur/shared/mobility/to/ref/data/AssetType.kt @@ -10,7 +10,7 @@ import java.util.UUID val assetType get() = AssetType( - id = UUID.randomUUID().toString(), + id = "AssetType:587", assets = listOf(asset), assetClass = AssetClass.MOPED, conditions = conditions, @@ -21,7 +21,7 @@ val conditions listOf( ConditionDeposit( conditionType = "ConditionDeposit", - id = UUID.randomUUID().toString(), + id = "ConditionDeposit:958", amount = 12.50F, amountExVat = 10.00F, currencyCode = "NOK", @@ -30,7 +30,7 @@ val conditions ), ConditionRequireOffboardingSteps( conditionType = "ConditionRequireOffboardingSteps", - id = "deposit50eu", + id = "ConditionDeposit:386", steps = listOf( OffBoardingStep( @@ -49,7 +49,7 @@ val conditionsNoDeposit listOf( ConditionRequireOffboardingSteps( conditionType = "ConditionRequireOffboardingSteps", - id = "deposit50eu", + id = "ConditionDeposit:745", steps = listOf( OffBoardingStep( @@ -68,7 +68,7 @@ val conditionsWithHighDepositAmount listOf( ConditionDeposit( conditionType = "ConditionDeposit", - id = "deposit50eu", + id = "ConditionDeposit:183", amount = 125.00F, amountExVat = 100.00F, currencyCode = "NOK", @@ -77,7 +77,7 @@ val conditionsWithHighDepositAmount ), ConditionRequireOffboardingSteps( conditionType = "ConditionRequireOffboardingSteps", - id = "deposit50eu", + id = "ConditionDeposit:046", steps = listOf( OffBoardingStep( diff --git a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/BookingsControllerTest.kt b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/BookingsControllerTest.kt index 4f6e867..b0d97ea 100644 --- a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/BookingsControllerTest.kt +++ b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/BookingsControllerTest.kt @@ -11,6 +11,7 @@ import org.junit.jupiter.api.assertThrows import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import java.time.OffsetDateTime +import java.util.UUID @SpringBootTest(classes = [Application::class], webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class BookingsControllerTest { @@ -20,28 +21,28 @@ class BookingsControllerTest { @Test fun bookingsGet() { bookingsController.bookingsGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, state = null, minTime = OffsetDateTime.now(), maxTime = OffsetDateTime.now(), minPrice = null, maxPrice = null, - containsAssetType = "", + containsAssetType = "AssetType:487", ) } @Test fun bookingsIdEventsPost() { bookingsController.bookingsIdEventsPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + id = UUID.randomUUID().toString(), + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, bookingOperation = null, ) @@ -50,12 +51,12 @@ class BookingsControllerTest { @Test fun bookingsIdGet() { bookingsController.bookingsIdGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, + id = UUID.randomUUID().toString(), ) } @@ -63,12 +64,12 @@ class BookingsControllerTest { fun bookingsIdNotificationsGet() { assertThrows { bookingsController.bookingsIdNotificationsGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, + id = UUID.randomUUID().toString(), ) } } @@ -76,12 +77,12 @@ class BookingsControllerTest { @Test fun bookingsIdNotificationsPost() { bookingsController.bookingsIdNotificationsPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, + id = UUID.randomUUID().toString(), notification = null, ) } @@ -89,47 +90,47 @@ class BookingsControllerTest { @Test fun bookingsIdPut() { bookingsController.bookingsIdPut( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", - booking = Booking(), + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, + id = UUID.randomUUID().toString(), + booking = Booking(), ) } @Test fun bookingsIdSubscriptionDelete() { bookingsController.bookingsIdSubscriptionDelete( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, + id = UUID.randomUUID().toString(), ) } @Test fun bookingsIdSubscriptionPost() { bookingsController.bookingsIdSubscriptionPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, - id = "", + id = UUID.randomUUID().toString(), ) } @Test fun bookingsOneStopPost() { bookingsController.bookingsOneStopPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, oneStopBookingRequest = OneStopBookingRequest(from = place), ) @@ -138,10 +139,10 @@ class BookingsControllerTest { @Test fun bookingsPost() { bookingsController.bookingsPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, bookingRequest = BookingRequest(), ) diff --git a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/LegsControllerTest.kt b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/LegsControllerTest.kt index b40d444..a1858fb 100644 --- a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/LegsControllerTest.kt +++ b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/LegsControllerTest.kt @@ -12,6 +12,7 @@ import org.junit.jupiter.api.assertThrows import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import java.time.OffsetDateTime +import java.util.UUID @SpringBootTest(classes = [Application::class], webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class LegsControllerTest { @@ -22,10 +23,10 @@ class LegsControllerTest { fun legsIdAncillariesCategoryNumberDelete() { assertThrows { legsController.legsIdAncillariesCategoryNumberDelete( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", id = "", category = "", number = "", @@ -38,11 +39,11 @@ class LegsControllerTest { fun legsIdAncillariesCategoryNumberPost() { assertThrows { legsController.legsIdAncillariesCategoryNumberPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), category = "", number = "", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, @@ -54,11 +55,11 @@ class LegsControllerTest { fun legsIdAvailableAssetsGet() { assertThrows { legsController.legsIdAvailableAssetsGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, limit = 1, offset = 1, @@ -69,10 +70,10 @@ class LegsControllerTest { @Test fun legsIdConfirmationPost() { legsController.legsIdConfirmationPost( - acceptLanguage = "", - api = "", - apiVersion = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + id = UUID.randomUUID().toString(), confirmationRequest = null, ) } @@ -80,11 +81,11 @@ class LegsControllerTest { @Test fun legsIdEventsPost() { legsController.legsIdEventsPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, legEvent = LegEvent(event = LegEvent.Event.SET_IN_USE, time = OffsetDateTime.now()), ) @@ -93,11 +94,11 @@ class LegsControllerTest { @Test fun legsIdGet() { legsController.legsIdGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, ) } @@ -106,11 +107,11 @@ class LegsControllerTest { fun legsIdProgressGet() { assertThrows { legsController.legsIdProgressGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, locationOnly = true, ) @@ -120,11 +121,11 @@ class LegsControllerTest { @Test fun legsIdProgressPost() { legsController.legsIdProgressPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, legProgress = null, ) @@ -133,11 +134,11 @@ class LegsControllerTest { @Test fun legsIdPut() { legsController.legsIdPut( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, leg = Leg(from = Place(Coordinates(0F, 0F, 0F)), assetType = AssetType(id = "")), ) diff --git a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/OperatorControllerTest.kt b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/OperatorControllerTest.kt index 1cfa7e5..6446996 100644 --- a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/OperatorControllerTest.kt +++ b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/OperatorControllerTest.kt @@ -16,10 +16,10 @@ class OperatorControllerTest { fun operatorAlertsGet() { assertThrows { operatorController.operatorAlertsGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, regionId = "", stationId = "", @@ -32,10 +32,10 @@ class OperatorControllerTest { @Test fun operatorAvailableAssetsGet() { operatorController.operatorAvailableAssetsGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, regionId = "", stationId = "", @@ -47,10 +47,10 @@ class OperatorControllerTest { @Test fun operatorInformationGet() { operatorController.operatorInformationGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, ) } @@ -58,8 +58,8 @@ class OperatorControllerTest { @Test fun operatorMetaGet() { operatorController.operatorMetaGet( - acceptLanguage = "", - maasId = "", + acceptLanguage = "NOB", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, ) } @@ -68,10 +68,10 @@ class OperatorControllerTest { fun operatorOperatingCalendarGet() { assertThrows { operatorController.operatorOperatingCalendarGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, regionId = "", stationId = "", @@ -83,10 +83,10 @@ class OperatorControllerTest { fun operatorOperatingHoursGet() { assertThrows { operatorController.operatorOperatingHoursGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, regionId = "", stationId = "", @@ -105,10 +105,10 @@ class OperatorControllerTest { fun operatorPricingPlansGet() { assertThrows { operatorController.operatorPricingPlansGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, regionId = "", stationId = "", @@ -120,10 +120,10 @@ class OperatorControllerTest { fun operatorRegionsGet() { assertThrows { operatorController.operatorRegionsGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, offset = 0, limit = 0, @@ -135,10 +135,10 @@ class OperatorControllerTest { fun operatorStationsGet() { assertThrows { operatorController.operatorStationsGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, offset = 0, limit = 0, diff --git a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/PaymentControllerTest.kt b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/PaymentControllerTest.kt index cbc2dc9..e087c75 100644 --- a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/PaymentControllerTest.kt +++ b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/PaymentControllerTest.kt @@ -7,6 +7,7 @@ import org.junit.jupiter.api.assertThrows import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import java.time.OffsetDateTime +import java.util.UUID @SpringBootTest(classes = [Application::class], webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class PaymentControllerTest { @@ -17,11 +18,11 @@ class PaymentControllerTest { fun paymentIdClaimExtraCostsPost() { assertThrows { paymentController.paymentIdClaimExtraCostsPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, extraCosts = null, ) @@ -32,11 +33,11 @@ class PaymentControllerTest { fun paymentJournalEntryGet() { assertThrows { paymentController.paymentJournalEntryGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", - id = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", + id = UUID.randomUUID().toString(), limit = 0, offset = 0, from = OffsetDateTime.now(), diff --git a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/PlanningControllerTest.kt b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/PlanningControllerTest.kt index a18bd95..f0a9c75 100644 --- a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/PlanningControllerTest.kt +++ b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/PlanningControllerTest.kt @@ -14,10 +14,10 @@ class PlanningControllerTest { @Test fun planningInquiriesPost() { planningController.planningInquiriesPost( - "", - "", - "", - "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", TransportOperator.ALL_IMPLEMENTING_OPERATOR, null, ) @@ -26,10 +26,10 @@ class PlanningControllerTest { @Test fun planningOffersPost() { planningController.planningOffersPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, planningRequest = null, ) diff --git a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/SupportControllerTest.kt b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/SupportControllerTest.kt index 6d49035..e69b590 100644 --- a/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/SupportControllerTest.kt +++ b/src/test/kotlin/no/entur/shared/mobility/to/ref/controller/SupportControllerTest.kt @@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest +import java.util.UUID @SpringBootTest(classes = [Application::class], webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class SupportControllerTest { @@ -16,12 +17,12 @@ class SupportControllerTest { fun supportIdStatusGet() { assertThrows { supportController.supportIdStatusGet( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, - id = "", + id = UUID.randomUUID().toString(), ) } } @@ -30,10 +31,10 @@ class SupportControllerTest { fun supportPost() { assertThrows { supportController.supportPost( - acceptLanguage = "", - api = "", - apiVersion = "", - maasId = "", + acceptLanguage = "NOB", + api = "TOMP", + apiVersion = "1.5.0", + maasId = "entur:maas:shared-mobility", addressedTo = TransportOperator.ALL_IMPLEMENTING_OPERATOR, supportRequest = null, )