|
| 1 | +package com.bigboxer23.switch_bot; |
| 2 | + |
| 3 | +import static org.junit.jupiter.api.Assertions.*; |
| 4 | + |
| 5 | +import com.bigboxer23.switch_bot.data.DeviceCommand; |
| 6 | +import org.junit.jupiter.api.Test; |
| 7 | + |
| 8 | +public class IDeviceCommandsTest { |
| 9 | + |
| 10 | + @Test |
| 11 | + public void testCommandConstants() { |
| 12 | + assertEquals("turnOff", IDeviceCommands.TURN_OFF); |
| 13 | + assertEquals("turnOn", IDeviceCommands.TURN_ON); |
| 14 | + } |
| 15 | + |
| 16 | + @Test |
| 17 | + public void testCurtainCloseCommand() { |
| 18 | + DeviceCommand curtainClose = IDeviceCommands.CURTAIN_CLOSE; |
| 19 | + assertNotNull(curtainClose); |
| 20 | + assertEquals("turnOff", curtainClose.getCommand()); |
| 21 | + assertEquals("default", curtainClose.getParameter()); |
| 22 | + } |
| 23 | + |
| 24 | + @Test |
| 25 | + public void testCurtainOpenCommand() { |
| 26 | + DeviceCommand curtainOpen = IDeviceCommands.CURTAIN_OPEN; |
| 27 | + assertNotNull(curtainOpen); |
| 28 | + assertEquals("turnOn", curtainOpen.getCommand()); |
| 29 | + assertEquals("default", curtainOpen.getParameter()); |
| 30 | + } |
| 31 | + |
| 32 | + @Test |
| 33 | + public void testPlugMiniOffCommand() { |
| 34 | + DeviceCommand plugMiniOff = IDeviceCommands.PLUG_MINI_OFF; |
| 35 | + assertNotNull(plugMiniOff); |
| 36 | + assertEquals("turnOff", plugMiniOff.getCommand()); |
| 37 | + assertEquals("default", plugMiniOff.getParameter()); |
| 38 | + } |
| 39 | + |
| 40 | + @Test |
| 41 | + public void testPlugMiniOnCommand() { |
| 42 | + DeviceCommand plugMiniOn = IDeviceCommands.PLUG_MINI_ON; |
| 43 | + assertNotNull(plugMiniOn); |
| 44 | + assertEquals("turnOn", plugMiniOn.getCommand()); |
| 45 | + assertEquals("default", plugMiniOn.getParameter()); |
| 46 | + } |
| 47 | + |
| 48 | + @Test |
| 49 | + public void testCommandConsistency() { |
| 50 | + assertEquals(IDeviceCommands.CURTAIN_CLOSE.getCommand(), IDeviceCommands.PLUG_MINI_OFF.getCommand()); |
| 51 | + assertEquals(IDeviceCommands.CURTAIN_OPEN.getCommand(), IDeviceCommands.PLUG_MINI_ON.getCommand()); |
| 52 | + |
| 53 | + assertEquals(IDeviceCommands.CURTAIN_CLOSE.getParameter(), IDeviceCommands.CURTAIN_OPEN.getParameter()); |
| 54 | + assertEquals(IDeviceCommands.PLUG_MINI_OFF.getParameter(), IDeviceCommands.PLUG_MINI_ON.getParameter()); |
| 55 | + } |
| 56 | + |
| 57 | + @Test |
| 58 | + public void testCommandObjectsAreNotNull() { |
| 59 | + assertNotNull(IDeviceCommands.CURTAIN_CLOSE); |
| 60 | + assertNotNull(IDeviceCommands.CURTAIN_OPEN); |
| 61 | + assertNotNull(IDeviceCommands.PLUG_MINI_OFF); |
| 62 | + assertNotNull(IDeviceCommands.PLUG_MINI_ON); |
| 63 | + } |
| 64 | +} |
0 commit comments