diff --git a/application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmCommandHandler.kt b/application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmsCommandHandler.kt similarity index 96% rename from application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmCommandHandler.kt rename to application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmsCommandHandler.kt index 38ebc5b..6b43854 100644 --- a/application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmCommandHandler.kt +++ b/application/src/main/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmsCommandHandler.kt @@ -15,9 +15,9 @@ import org.gxf.crestdevicesimulator.simulator.response.exception.InvalidCommandE * * On success: a downlink containing the alarm thresholds will be returned in the next message sent * * On failure: "INFO:DLER" URC will be returned in the next message sent */ -class InfoAlarmCommandHandler : CommandHandler { +class InfoAlarmsCommandHandler : CommandHandler { private val logger = KotlinLogging.logger {} - private val commandRegex: Regex = "INFO:AL([2-7]|ARM)".toRegex() + private val commandRegex: Regex = "INFO:AL([2-7]|ARMS)".toRegex() override fun canHandleCommand(command: String) = commandRegex.matches(command) diff --git a/application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmCommandHandlerTest.kt b/application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmsCommandHandlerTest.kt similarity index 89% rename from application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmCommandHandlerTest.kt rename to application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmsCommandHandlerTest.kt index da57612..d0c9d0d 100644 --- a/application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmCommandHandlerTest.kt +++ b/application/src/test/kotlin/org/gxf/crestdevicesimulator/simulator/response/handlers/InfoAlarmsCommandHandlerTest.kt @@ -13,8 +13,8 @@ import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ValueSource -class InfoAlarmCommandHandlerTest { - private val commandHandler = InfoAlarmCommandHandler() +class InfoAlarmsCommandHandlerTest { + private val commandHandler = InfoAlarmsCommandHandler() private lateinit var simulatorState: SimulatorState @@ -24,7 +24,7 @@ class InfoAlarmCommandHandlerTest { } @ParameterizedTest - @ValueSource(strings = ["INFO:ALARM", "INFO:AL7"]) + @ValueSource(strings = ["INFO:ALARMS", "INFO:AL7"]) fun `canHandleCommand should return true when called with valid command`(command: String) { val actualResult = commandHandler.canHandleCommand(command) assertThat(actualResult).isTrue @@ -38,8 +38,8 @@ class InfoAlarmCommandHandlerTest { } @Test - fun `handleCommand should handle info alarm command`() { - val command = "INFO:ALARM" + fun `handleCommand should handle info alarms command`() { + val command = "INFO:ALARMS" val alarmThresholdValues = AlarmThresholdValues(6, 0, 500, 1000, 1500, 10) simulatorState.addAlarmThresholds(alarmThresholdValues) @@ -47,7 +47,7 @@ class InfoAlarmCommandHandlerTest { val expectedDownlink = """ - "INFO:ALARM",{"AL0":[0,0,0,0,0],"AL1":[0,0,0,0,0],"AL2":[0,0,0,0,0],"AL3":[0,0,0,0,0], + "INFO:ALARMS",{"AL0":[0,0,0,0,0],"AL1":[0,0,0,0,0],"AL2":[0,0,0,0,0],"AL3":[0,0,0,0,0], "AL4":[0,0,0,0,0],"AL5":[0,0,0,0,0],"AL6":[0,500,1000,1500,10],"AL7":[0,0,0,0,0]} """ .trimIndent()