]> git.basschouten.com Git - openhab-addons.git/commitdiff
[boschshc] Code enhancements and Sonar issue fixes (#15160)
authorDavid Pace <dev@davidpace.de>
Tue, 4 Jul 2023 21:25:13 +0000 (23:25 +0200)
committerGitHub <noreply@github.com>
Tue, 4 Jul 2023 21:25:13 +0000 (23:25 +0200)
* replace call to deprecated HSBType::getRGB() with
ColorUtil::hsbTosRgb()
* make constructors of abstract classes protected
* use instanceof with pattern matching (JEP 305)
* enhance switches with combined cases using comma-separated case
expressions
* remove unnecessary public modifiers in unit tests

Signed-off-by: David Pace <dev@davidpace.de>
34 files changed:
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/AbstractBatteryPoweredDeviceHandler.java
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/AbstractPowerSwitchHandler.java
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/AbstractSmokeDetectorHandler.java
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/camera/CameraHandler.java
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/shuttercontrol/ShutterControlHandler.java
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/smartbulb/SmartBulbHandler.java
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/services/batterylevel/BatteryLevel.java
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/services/silentmode/SilentModeState.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/BoschSHCHandlerFactoryTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/bridge/BridgeConfigurationTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/bridge/JsonRpcRequestTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/bridge/LongPollingTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/bridge/dto/DeviceServiceDataTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/bridge/dto/DeviceTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/bridge/dto/LongPollResultTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/camera/CameraHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/climatecontrol/ClimateControlHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/intrusion/IntrusionDetectionHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/motiondetector/MotionDetectorHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/shuttercontrol/ShutterControlHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/smartbulb/SmartBulbHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/twinguard/TwinguardHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/wallthermostat/WallThermostatHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/windowcontact/WindowContactHandlerTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/discovery/BridgeDiscoveryParticipantTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/discovery/ThingDiscoveryServiceTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/exceptions/LongPollingFailedExceptionTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/exceptions/PairingFailedExceptionTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/services/binaryswitch/dto/BinarySwitchServiceStateTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/services/dto/BoschSHCServiceStateTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/services/dto/JsonRestExceptionResponseTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/services/hsbcoloractuator/dto/HSBColorActuatorServiceStateTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/services/multilevelswitch/dto/MultiLevelSwitchServiceStateTest.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/services/smokedetectorcheck/SmokeDetectorCheckStateTest.java

index 316cb2c145e53e33a1b91cfe36e079c2de495b2e..be5fb8a42c75bc394103d8061f4501e2ccabcae2 100644 (file)
@@ -37,7 +37,7 @@ public abstract class AbstractBatteryPoweredDeviceHandler extends BoschSHCDevice
      */
     private final BatteryLevelService batteryLevelService;
 
-    public AbstractBatteryPoweredDeviceHandler(Thing thing) {
+    protected AbstractBatteryPoweredDeviceHandler(Thing thing) {
         super(thing);
         this.batteryLevelService = new BatteryLevelService();
     }
index 0d3bcbdd0ecfe4ac7cff9bf9bad4f3a358d05f6e..77de3a4ce29f5257e8ea2d129d9bfb7dff7bfc3a 100644 (file)
@@ -74,8 +74,8 @@ public abstract class AbstractPowerSwitchHandler extends BoschSHCDeviceHandler {
 
         switch (channelUID.getId()) {
             case CHANNEL_POWER_SWITCH:
-                if (command instanceof OnOffType) {
-                    updatePowerSwitchState((OnOffType) command);
+                if (command instanceof OnOffType onOffCommand) {
+                    updatePowerSwitchState(onOffCommand);
                 }
                 break;
         }
index 3db982c14c1d5f068c6c0af52461b4eca0a3dce2..6363d1b713bc8e69baa6b6e3f60d9addf928c370 100644 (file)
@@ -36,7 +36,7 @@ public abstract class AbstractSmokeDetectorHandler extends AbstractBatteryPowere
 
     private SmokeDetectorCheckService smokeDetectorCheckService;
 
-    public AbstractSmokeDetectorHandler(Thing thing) {
+    protected AbstractSmokeDetectorHandler(Thing thing) {
         super(thing);
         this.smokeDetectorCheckService = new SmokeDetectorCheckService();
     }
index 6e4259e70d81217d5b5850f37e0fc9cace6c1fe6..14ab1003dc2f4e223de09e75427945ef7126c15c 100644 (file)
@@ -12,8 +12,7 @@
  */
 package org.openhab.binding.boschshc.internal.devices.camera;
 
-import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_CAMERA_NOTIFICATION;
-import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_PRIVACY_MODE;
+import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.*;
 
 import java.util.List;
 
@@ -35,18 +34,18 @@ import org.openhab.core.types.Command;
  * Handler for security cameras.
  * <p>
  * This implementation handles services and commands that are common to all cameras, which are currently:
- * 
+ *
  * <ul>
  * <li><code>PrivacyMode</code> - Controls whether the camera records images</li>
  * <li><code>CameraNotification</code> - Enables or disables notifications for the camera</li>
  * </ul>
- * 
+ *
  * <p>
  * The Eyes outdoor camera advertises a <code>CameraLight</code> service, which unfortunately does not work properly.
  * Valid states are <code>ON</code> and <code>OFF</code>.
  * One of my two cameras returns <code>HTTP 204 (No Content)</code> when requesting the state.
  * Once Bosch supports this service properly, a new subclass may be introduced for the Eyes outdoor camera.
- * 
+ *
  * @author David Pace - Initial contribution
  *
  */
@@ -77,14 +76,14 @@ public class CameraHandler extends BoschSHCDeviceHandler {
 
         switch (channelUID.getId()) {
             case CHANNEL_PRIVACY_MODE:
-                if (command instanceof OnOffType) {
-                    updatePrivacyModeState((OnOffType) command);
+                if (command instanceof OnOffType onOffCommand) {
+                    updatePrivacyModeState(onOffCommand);
                 }
                 break;
 
             case CHANNEL_CAMERA_NOTIFICATION:
-                if (command instanceof OnOffType) {
-                    updateCameraNotificationState((OnOffType) command);
+                if (command instanceof OnOffType onOffCommand) {
+                    updateCameraNotificationState(onOffCommand);
                 }
                 break;
         }
index a1875aecc6a7991892558149a5644ab6e6cb9343..078431ac3aab929cb03d988ff66dbc89cb5b6f76 100644 (file)
@@ -71,31 +71,28 @@ public class ShutterControlHandler extends BoschSHCDeviceHandler {
     public void handleCommand(ChannelUID channelUID, Command command) {
         super.handleCommand(channelUID, command);
 
-        if (command instanceof UpDownType) {
+        if (command instanceof UpDownType upDownCommand) {
             // Set full close/open as target state
-            UpDownType upDownType = (UpDownType) command;
             ShutterControlServiceState state = new ShutterControlServiceState();
-            if (upDownType == UpDownType.UP) {
+            if (upDownCommand == UpDownType.UP) {
                 state.level = 1.0;
-            } else if (upDownType == UpDownType.DOWN) {
+            } else if (upDownCommand == UpDownType.DOWN) {
                 state.level = 0.0;
             } else {
-                logger.warn("Received unknown UpDownType command: {}", upDownType);
+                logger.warn("Received unknown UpDownType command: {}", upDownCommand);
                 return;
             }
             this.updateServiceState(this.shutterControlService, state);
-        } else if (command instanceof StopMoveType) {
-            StopMoveType stopMoveType = (StopMoveType) command;
-            if (stopMoveType == StopMoveType.STOP) {
+        } else if (command instanceof StopMoveType stopMoveCommand) {
+            if (stopMoveCommand == StopMoveType.STOP) {
                 // Set STOPPED operation state
                 ShutterControlServiceState state = new ShutterControlServiceState();
                 state.operationState = OperationState.STOPPED;
                 this.updateServiceState(this.shutterControlService, state);
             }
-        } else if (command instanceof PercentType) {
+        } else if (command instanceof PercentType percentCommand) {
             // Set specific level
-            PercentType percentType = (PercentType) command;
-            double level = DataConversion.openPercentageToLevel(percentType.doubleValue());
+            double level = DataConversion.openPercentageToLevel(percentCommand.doubleValue());
             this.updateServiceState(this.shutterControlService, new ShutterControlServiceState(level));
         }
     }
index 9dd8a44c60101686a27ebea983afd5f26ec6610d..3a8994563097d1c1c6e3ef86d84b77111d308907 100644 (file)
@@ -31,6 +31,7 @@ import org.openhab.core.library.types.PercentType;
 import org.openhab.core.thing.ChannelUID;
 import org.openhab.core.thing.Thing;
 import org.openhab.core.types.Command;
+import org.openhab.core.util.ColorUtil;
 
 /**
  * Handler for smart light bulbs connected via Zigbee, e.g. Ledvance Smart+ bulbs
@@ -68,38 +69,38 @@ public class SmartBulbHandler extends BoschSHCDeviceHandler {
 
         switch (channelUID.getId()) {
             case CHANNEL_POWER_SWITCH:
-                if (command instanceof OnOffType) {
-                    updateBinarySwitchState((OnOffType) command);
+                if (command instanceof OnOffType onOffCommand) {
+                    updateBinarySwitchState(onOffCommand);
                 }
                 break;
             case CHANNEL_BRIGHTNESS:
-                if (command instanceof PercentType) {
-                    updateMultiLevelSwitchState((PercentType) command);
+                if (command instanceof PercentType percentCommand) {
+                    updateMultiLevelSwitchState(percentCommand);
                 }
                 break;
             case CHANNEL_COLOR:
-                if (command instanceof HSBType) {
-                    updateColorState((HSBType) command);
+                if (command instanceof HSBType hsbCommand) {
+                    updateColorState(hsbCommand);
                 }
                 break;
         }
     }
 
-    private void updateBinarySwitchState(OnOffType command) {
+    private void updateBinarySwitchState(OnOffType onOffCommand) {
         BinarySwitchServiceState serviceState = new BinarySwitchServiceState();
-        serviceState.on = command == OnOffType.ON;
+        serviceState.on = onOffCommand == OnOffType.ON;
         this.updateServiceState(binarySwitchService, serviceState);
     }
 
-    private void updateMultiLevelSwitchState(PercentType command) {
+    private void updateMultiLevelSwitchState(PercentType percentCommand) {
         MultiLevelSwitchServiceState serviceState = new MultiLevelSwitchServiceState();
-        serviceState.level = command.intValue();
+        serviceState.level = percentCommand.intValue();
         this.updateServiceState(multiLevelSwitchService, serviceState);
     }
 
-    private void updateColorState(HSBType command) {
+    private void updateColorState(HSBType hsbCommand) {
         HSBColorActuatorServiceState serviceState = new HSBColorActuatorServiceState();
-        serviceState.rgb = command.getRGB();
+        serviceState.rgb = ColorUtil.hsbTosRgb(hsbCommand);
         this.updateServiceState(hsbColorActuatorService, serviceState);
     }
 
index a90dd4a0e7c2b7d26caee46a5a1228548d069641..461791abbcbf3488953d01bb733b3a3f270165b6 100644 (file)
@@ -88,8 +88,7 @@ public enum BatteryLevel {
         switch (this) {
             case LOW_BATTERY:
                 return new DecimalType(10);
-            case CRITICAL_LOW:
-            case CRITICALLY_LOW_BATTERY:
+            case CRITICAL_LOW, CRITICALLY_LOW_BATTERY:
                 return new DecimalType(1);
             case NOT_AVAILABLE:
                 return UnDefType.UNDEF;
@@ -108,9 +107,7 @@ public enum BatteryLevel {
      */
     public OnOffType toLowBatteryState() {
         switch (this) {
-            case LOW_BATTERY:
-            case CRITICAL_LOW:
-            case CRITICALLY_LOW_BATTERY:
+            case LOW_BATTERY, CRITICAL_LOW, CRITICALLY_LOW_BATTERY:
                 return OnOffType.ON;
             default:
                 return OnOffType.OFF;
index 6a931efff440d4180a902a907798b3d19caae70d..4b2637a984b3f62594826e972e6c42c0d247b27c 100644 (file)
@@ -26,7 +26,7 @@ public enum SilentModeState {
     MODE_NORMAL,
     MODE_SILENT;
 
-    public static SilentModeState fromOnOffType(OnOffType onOffType) {
-        return onOffType == OnOffType.ON ? SilentModeState.MODE_SILENT : SilentModeState.MODE_NORMAL;
+    public static SilentModeState fromOnOffType(OnOffType onOffCommand) {
+        return onOffCommand == OnOffType.ON ? SilentModeState.MODE_SILENT : SilentModeState.MODE_NORMAL;
     }
 }
index 91c097c1ec06304a59954dca853c66cb5c779331..1f679ce254806130a900ffbc6326fce6389f7ced 100644 (file)
@@ -29,7 +29,7 @@ import org.openhab.core.thing.ThingTypeUID;
  *
  */
 @NonNullByDefault
-public class BoschSHCHandlerFactoryTest {
+class BoschSHCHandlerFactoryTest {
 
     private @NonNullByDefault({}) BoschSHCHandlerFactory fixture;
 
@@ -39,7 +39,7 @@ public class BoschSHCHandlerFactoryTest {
     }
 
     @Test
-    public void testSupportsThingType() {
+    void testSupportsThingType() {
         assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_SHC));
         assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_INWALL_SWITCH));
         assertTrue(fixture.supportsThingType(BoschSHCBindingConstants.THING_TYPE_TWINGUARD));
@@ -60,7 +60,7 @@ public class BoschSHCHandlerFactoryTest {
     }
 
     @Test
-    public void testCreateHandler() {
+    void testCreateHandler() {
         Thing thing = mock(Thing.class);
         when(thing.getThingTypeUID()).thenReturn(BoschSHCBindingConstants.THING_TYPE_SMART_PLUG_COMPACT);
         assertTrue(fixture.createHandler(thing) instanceof PlugHandler);
index 7d3b43b39b7b4198ad5208ebcc49e205dcea34a4..57e66cf42216c2f9900166b870d94f90b753b59d 100644 (file)
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
  *
  */
 @NonNullByDefault
-public class JsonRpcRequestTest {
+class JsonRpcRequestTest {
 
     private @NonNullByDefault({}) JsonRpcRequest fixture;
 
@@ -35,14 +35,14 @@ public class JsonRpcRequestTest {
     }
 
     @Test
-    public void testConstructor() {
+    void testConstructor() {
         assertEquals("2.0", fixture.getJsonrpc());
         assertEquals("RE/longPoll", fixture.getMethod());
         assertArrayEquals(new String[] { "subscriptionId", "20" }, fixture.getParams());
     }
 
     @Test
-    public void testNoArgConstructor() {
+    void testNoArgConstructor() {
         fixture = new JsonRpcRequest();
         assertEquals("", fixture.getJsonrpc());
         assertEquals("", fixture.getMethod());
@@ -50,19 +50,19 @@ public class JsonRpcRequestTest {
     }
 
     @Test
-    public void testSetJsonrpc() {
+    void testSetJsonrpc() {
         fixture.setJsonrpc("test");
         assertEquals("test", fixture.getJsonrpc());
     }
 
     @Test
-    public void testSetMethod() {
+    void testSetMethod() {
         fixture.setMethod("RE/subscribe");
         assertEquals("RE/subscribe", fixture.getMethod());
     }
 
     @Test
-    public void testSetParams() {
+    void testSetParams() {
         fixture.setParams(new String[] { "com/bosch/sh/remote/*", null });
         assertArrayEquals(new String[] { "com/bosch/sh/remote/*", null }, fixture.getParams());
     }
index 524d23fc111b8c9da1d419fa96e22b5bced85fd4..b6c2dc837a3a7e36f4029a563ad77bdda63a95ff 100644 (file)
@@ -62,7 +62,7 @@ import com.google.gson.JsonObject;
  */
 @NonNullByDefault
 @ExtendWith(MockitoExtension.class)
-public class LongPollingTest {
+class LongPollingTest {
 
     /**
      * A dummy implementation of {@link ScheduledFuture}.
index cfe653674fe493a87b531dd9b4f48c8d463ccc95..02180cee81a18207482a0b2d415081186aafc247 100644 (file)
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
  * @author David Pace - Initial contribution
  *
  */
-public class DeviceServiceDataTest {
+class DeviceServiceDataTest {
 
     private DeviceServiceData fixture;
 
@@ -34,7 +34,7 @@ public class DeviceServiceDataTest {
     }
 
     @Test
-    public void testToString() {
+    void testToString() {
         assertEquals("64-da-a0-02-14-9b state: DeviceServiceData", fixture.toString());
     }
 }
index 9ee3ac9edf7aabf794dd927c867682833a96dc2e..125158a749b209d51330f0daca1241b5b48c7cf1 100644 (file)
@@ -60,7 +60,7 @@ public class DeviceTest {
     }
 
     @Test
-    public void testToString() {
+    void testToString() {
         assertEquals(
                 "Type device; RootDeviceId: 64-da-a0-02-14-9b; Id: hdm:HomeMaticIP:3014F711A00004953859F31B; Device Service Ids: PowerMeter, PowerSwitch, PowerSwitchProgram, Routing; Manufacturer: BOSCH; Room Id: hz_3; Device Model: PSM; Serial: 3014F711A00004953859F31B; Profile: GENERIC; Name: Coffee Machine; Status: AVAILABLE; Child Device Ids: null ",
                 fixture.toString());
index 71bc6e3a23d649d924b9376ad41a75e261b0452e..cb71abfc6f5f14c042afde0404fa27987ed1332d 100644 (file)
@@ -24,7 +24,7 @@ import org.openhab.binding.boschshc.internal.serialization.GsonUtils;
  * @author Christian Oeing - Initial contribution
  */
 @NonNullByDefault
-public class LongPollResultTest {
+class LongPollResultTest {
 
     @Test
     void noResultsForErrorResult() {
index b2b79190920a64aa1b93c8ac1a5b58ecdf4c68f2..3a9510c60ecbf6f56f2e148a88e64120468e1860 100644 (file)
@@ -44,7 +44,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class CameraHandlerTest extends AbstractBoschSHCDeviceHandlerTest<CameraHandler> {
+class CameraHandlerTest extends AbstractBoschSHCDeviceHandlerTest<CameraHandler> {
 
     private @Captor @NonNullByDefault({}) ArgumentCaptor<PrivacyModeServiceState> privacyModeServiceStateCaptor;
 
@@ -66,7 +66,7 @@ public class CameraHandlerTest extends AbstractBoschSHCDeviceHandlerTest<CameraH
     }
 
     @Test
-    public void testHandleCommandPrivacyMode()
+    void testHandleCommandPrivacyMode()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_PRIVACY_MODE),
                 OnOffType.ON);
@@ -84,7 +84,7 @@ public class CameraHandlerTest extends AbstractBoschSHCDeviceHandlerTest<CameraH
     }
 
     @Test
-    public void testHandleCommandCameraNotification()
+    void testHandleCommandCameraNotification()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         getFixture().handleCommand(
                 new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_CAMERA_NOTIFICATION),
@@ -104,7 +104,7 @@ public class CameraHandlerTest extends AbstractBoschSHCDeviceHandlerTest<CameraH
     }
 
     @Test
-    public void testUpdateChannelsPrivacyModeState() {
+    void testUpdateChannelsPrivacyModeState() {
         JsonElement jsonObject = JsonParser.parseString("{\"@type\":\"privacyModeState\",\"value\":\"ENABLED\"}");
         getFixture().processUpdate("PrivacyMode", jsonObject);
         verify(getCallback()).stateUpdated(
@@ -117,7 +117,7 @@ public class CameraHandlerTest extends AbstractBoschSHCDeviceHandlerTest<CameraH
     }
 
     @Test
-    public void testUpdateChannelsCameraNotificationState() {
+    void testUpdateChannelsCameraNotificationState() {
         JsonElement jsonObject = JsonParser
                 .parseString("{\"@type\":\"cameraNotificationState\",\"value\":\"ENABLED\"}");
         getFixture().processUpdate("CameraNotification", jsonObject);
index 86dc3120bf0a13977969c692ea442357423d45b1..c8ced460d79aec55baba04aa267a8e2eea310282 100644 (file)
@@ -44,7 +44,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class ClimateControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest<ClimateControlHandler> {
+class ClimateControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest<ClimateControlHandler> {
 
     private @Captor @NonNullByDefault({}) ArgumentCaptor<RoomClimateControlServiceState> roomClimateControlServiceStateCaptor;
 
@@ -64,7 +64,7 @@ public class ClimateControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest
     }
 
     @Test
-    public void testHandleCommandRoomClimateControlService()
+    void testHandleCommandRoomClimateControlService()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         QuantityType<Temperature> temperature = new QuantityType<>(21.5, SIUnits.CELSIUS);
         getFixture().handleCommand(
@@ -77,7 +77,7 @@ public class ClimateControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest
     }
 
     @Test
-    public void testUpdateChannelsTemperatureLevelService() {
+    void testUpdateChannelsTemperatureLevelService() {
         JsonElement jsonObject = JsonParser.parseString(
                 "{\n" + "   \"@type\": \"temperatureLevelState\",\n" + "   \"temperature\": 21.5\n" + " }");
         getFixture().processUpdate("TemperatureLevel", jsonObject);
@@ -87,7 +87,7 @@ public class ClimateControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest
     }
 
     @Test
-    public void testUpdateChannelsRoomClimateControlService() {
+    void testUpdateChannelsRoomClimateControlService() {
         JsonElement jsonObject = JsonParser.parseString(
                 "{\n" + "   \"@type\": \"climateControlState\",\n" + "   \"setpointTemperature\": 21.5\n" + " }");
         getFixture().processUpdate("RoomClimateControl", jsonObject);
index caf80c43264a6c5cb6f9311de89a4df4fd7f93f1..3b97c5ac1364ab16263aec612f8d4485c135dec9 100644 (file)
@@ -41,7 +41,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class IntrusionDetectionHandlerTest extends AbstractBoschSHCHandlerTest<IntrusionDetectionHandler> {
+class IntrusionDetectionHandlerTest extends AbstractBoschSHCHandlerTest<IntrusionDetectionHandler> {
 
     private @Captor @NonNullByDefault({}) ArgumentCaptor<ArmActionRequest> armActionRequestCaptor;
 
@@ -56,7 +56,7 @@ public class IntrusionDetectionHandlerTest extends AbstractBoschSHCHandlerTest<I
     }
 
     @Test
-    public void testHandleCommandArmAction() throws InterruptedException, TimeoutException, ExecutionException {
+    void testHandleCommandArmAction() throws InterruptedException, TimeoutException, ExecutionException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_ARM_ACTION),
                 new StringType("0"));
         verify(getBridgeHandler()).postAction(eq("intrusion/actions/arm"), armActionRequestCaptor.capture());
@@ -65,21 +65,21 @@ public class IntrusionDetectionHandlerTest extends AbstractBoschSHCHandlerTest<I
     }
 
     @Test
-    public void testHandleCommandDisarmAction() throws InterruptedException, TimeoutException, ExecutionException {
+    void testHandleCommandDisarmAction() throws InterruptedException, TimeoutException, ExecutionException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_DISARM_ACTION),
                 OnOffType.ON);
         verify(getBridgeHandler()).postAction("intrusion/actions/disarm");
     }
 
     @Test
-    public void testHandleCommandMuteAction() throws InterruptedException, TimeoutException, ExecutionException {
+    void testHandleCommandMuteAction() throws InterruptedException, TimeoutException, ExecutionException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_MUTE_ACTION),
                 OnOffType.ON);
         verify(getBridgeHandler()).postAction("intrusion/actions/mute");
     }
 
     @Test
-    public void testUpdateChannelsIntrusionDetectionSystemState() {
+    void testUpdateChannelsIntrusionDetectionSystemState() {
         JsonElement jsonObject = JsonParser.parseString("{\n" + "     \"@type\": \"systemState\",\n"
                 + "     \"systemAvailability\": {\n" + "         \"@type\": \"systemAvailabilityState\",\n"
                 + "         \"available\": true,\n" + "         \"deleted\": false\n" + "     },\n"
@@ -108,7 +108,7 @@ public class IntrusionDetectionHandlerTest extends AbstractBoschSHCHandlerTest<I
     }
 
     @Test
-    public void testUpdateChannelsIntrusionDetectionControlState() {
+    void testUpdateChannelsIntrusionDetectionControlState() {
         JsonElement jsonObject = JsonParser.parseString("{\n" + "   \"@type\": \"intrusionDetectionControlState\",\n"
                 + "   \"activeProfile\": \"0\",\n" + "   \"alarmActivationDelayTime\": 30,\n" + "   \"actuators\": [\n"
                 + "     {\n" + "       \"readonly\": false,\n" + "       \"active\": true,\n"
@@ -125,7 +125,7 @@ public class IntrusionDetectionHandlerTest extends AbstractBoschSHCHandlerTest<I
     }
 
     @Test
-    public void testUpdateChannelsSurveillanceAlarmState() {
+    void testUpdateChannelsSurveillanceAlarmState() {
         JsonElement jsonObject = JsonParser.parseString("{\n" + "   \"@type\": \"surveillanceAlarmState\",\n"
                 + "   \"incidents\": [\n" + "     {\n" + "       \"triggerName\": \"Motion Detector\",\n"
                 + "       \"locationId\": \"hz_5\",\n" + "       \"location\": \"Living Room\",\n"
index 418218426bf7fa4c2ebe5dc798600d231776c682..0e89f266fb188d459eadfe7027c0074f7f65889d 100644 (file)
@@ -32,7 +32,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class MotionDetectorHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<MotionDetectorHandler> {
+class MotionDetectorHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<MotionDetectorHandler> {
 
     @Override
     protected MotionDetectorHandler createFixture() {
@@ -50,7 +50,7 @@ public class MotionDetectorHandlerTest extends AbstractBatteryPoweredDeviceHandl
     }
 
     @Test
-    public void testUpdateChannelsLatestMotionService() {
+    void testUpdateChannelsLatestMotionService() {
         JsonElement jsonObject = JsonParser.parseString("{\n" + "   \"@type\": \"latestMotionState\",\n"
                 + "   \"latestMotionDetected\": \"2020-04-03T19:02:19.054Z\"\n" + " }");
         getFixture().processUpdate("LatestMotion", jsonObject);
index e3a9a5a07503055fa314d3e44627a7e1350ccbbc..614f2524936dc80e5feee927d916650a757be2c1 100644 (file)
@@ -44,7 +44,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class ShutterControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest<ShutterControlHandler> {
+class ShutterControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest<ShutterControlHandler> {
 
     private @Captor @NonNullByDefault({}) ArgumentCaptor<ShutterControlServiceState> shutterControlServiceStateCaptor;
 
@@ -64,7 +64,7 @@ public class ShutterControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest
     }
 
     @Test
-    public void testHandleCommandUpDownType()
+    void testHandleCommandUpDownType()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_LEVEL),
                 UpDownType.UP);
@@ -82,7 +82,7 @@ public class ShutterControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest
     }
 
     @Test
-    public void testHandleCommandStopMoveType()
+    void testHandleCommandStopMoveType()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_LEVEL),
                 StopMoveType.STOP);
@@ -93,7 +93,7 @@ public class ShutterControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest
     }
 
     @Test
-    public void testHandleCommandPercentType()
+    void testHandleCommandPercentType()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_LEVEL),
                 new PercentType(42));
@@ -104,7 +104,7 @@ public class ShutterControlHandlerTest extends AbstractBoschSHCDeviceHandlerTest
     }
 
     @Test
-    public void testUpdateChannelsShutterControlService() {
+    void testUpdateChannelsShutterControlService() {
         JsonElement jsonObject = JsonParser
                 .parseString("{\n" + "   \"@type\": \"shutterControlState\",\n" + "   \"level\": 0.58\n" + " }");
         getFixture().processUpdate("ShutterControl", jsonObject);
index 9f3fd50580001c9a4ee7c8f44f4f965e51325b39..45dde9f0fe38cda9f044adcdbe394e14d79c4043 100644 (file)
@@ -46,7 +46,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class SmartBulbHandlerTest extends AbstractBoschSHCDeviceHandlerTest<SmartBulbHandler> {
+class SmartBulbHandlerTest extends AbstractBoschSHCDeviceHandlerTest<SmartBulbHandler> {
 
     private @Captor @NonNullByDefault({}) ArgumentCaptor<BinarySwitchServiceState> binarySwitchServiceStateCaptor;
 
@@ -70,7 +70,7 @@ public class SmartBulbHandlerTest extends AbstractBoschSHCDeviceHandlerTest<Smar
     }
 
     @Test
-    public void testHandleCommandBinarySwitch()
+    void testHandleCommandBinarySwitch()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_POWER_SWITCH),
                 OnOffType.ON);
@@ -88,7 +88,7 @@ public class SmartBulbHandlerTest extends AbstractBoschSHCDeviceHandlerTest<Smar
     }
 
     @Test
-    public void testHandleCommandMultiLevelSwitch()
+    void testHandleCommandMultiLevelSwitch()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_BRIGHTNESS),
                 new PercentType(42));
@@ -99,7 +99,7 @@ public class SmartBulbHandlerTest extends AbstractBoschSHCDeviceHandlerTest<Smar
     }
 
     @Test
-    public void testHandleCommandHSBColorActuator()
+    void testHandleCommandHSBColorActuator()
             throws InterruptedException, TimeoutException, ExecutionException, BoschSHCException {
         getFixture().handleCommand(new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_COLOR),
                 HSBType.BLUE);
@@ -110,7 +110,7 @@ public class SmartBulbHandlerTest extends AbstractBoschSHCDeviceHandlerTest<Smar
     }
 
     @Test
-    public void testUpdateChannelBinarySwitchState() {
+    void testUpdateChannelBinarySwitchState() {
         JsonElement jsonObject = JsonParser.parseString("{\"@type\":\"binarySwitchState\",\"on\":true}");
         getFixture().processUpdate("BinarySwitch", jsonObject);
         verify(getCallback()).stateUpdated(
@@ -123,7 +123,7 @@ public class SmartBulbHandlerTest extends AbstractBoschSHCDeviceHandlerTest<Smar
     }
 
     @Test
-    public void testUpdateChannelMultiLevelSwitchState() {
+    void testUpdateChannelMultiLevelSwitchState() {
         JsonElement jsonObject = JsonParser.parseString("{\"@type\":\"multiLevelSwitchState\",\"level\":16}");
         getFixture().processUpdate("MultiLevelSwitch", jsonObject);
         verify(getCallback()).stateUpdated(
@@ -131,7 +131,7 @@ public class SmartBulbHandlerTest extends AbstractBoschSHCDeviceHandlerTest<Smar
     }
 
     @Test
-    public void testUpdateChannelHSBColorActuatorState() {
+    void testUpdateChannelHSBColorActuatorState() {
         JsonElement jsonObject = JsonParser.parseString("{\"colorTemperatureRange\": {\n" + "        \"minCt\": 153,\n"
                 + "        \"maxCt\": 526\n" + "    },\n" + "    \"@type\": \"colorState\",\n"
                 + "    \"gamut\": \"LEDVANCE_GAMUT_A\",\n" + "    \"rgb\": -12427}");
index 2ef534dc6d56454f01f374e42bca005a861466df..5af5e511584d59ee60c68e6d86a93a9668bb945e 100644 (file)
@@ -38,7 +38,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class TwinguardHandlerTest extends AbstractSmokeDetectorHandlerTest<TwinguardHandler> {
+class TwinguardHandlerTest extends AbstractSmokeDetectorHandlerTest<TwinguardHandler> {
 
     @Override
     protected TwinguardHandler createFixture() {
@@ -56,7 +56,7 @@ public class TwinguardHandlerTest extends AbstractSmokeDetectorHandlerTest<Twing
     }
 
     @Test
-    public void testUpdateChannelsAirQualityLevelService() {
+    void testUpdateChannelsAirQualityLevelService() {
         JsonElement jsonObject = JsonParser.parseString(
                 "{\"temperatureRating\":\"GOOD\",\"humidityRating\":\"MEDIUM\",\"purity\":620,\"@type\":\"airQualityLevelState\",\n"
                         + "     \"purityRating\":\"GOOD\",\"temperature\":23.77,\"description\":\"LITTLE_DRY\",\"humidity\":32.69,\"combinedRating\":\"MEDIUM\"}");
index 9f755f696e13c5e4e62e0c903fcbc6d4582fc256..e09860bb166d7e62df90e5d47ef96474b781e005 100644 (file)
@@ -37,7 +37,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class WallThermostatHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<WallThermostatHandler> {
+class WallThermostatHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<WallThermostatHandler> {
 
     @Override
     protected WallThermostatHandler createFixture() {
@@ -55,7 +55,7 @@ public class WallThermostatHandlerTest extends AbstractBatteryPoweredDeviceHandl
     }
 
     @Test
-    public void testUpdateChannelsTemperatureLevelService() {
+    void testUpdateChannelsTemperatureLevelService() {
         JsonElement jsonObject = JsonParser.parseString(
                 "{\n" + "   \"@type\": \"temperatureLevelState\",\n" + "   \"temperature\": 21.5\n" + " }");
         getFixture().processUpdate("TemperatureLevel", jsonObject);
@@ -65,7 +65,7 @@ public class WallThermostatHandlerTest extends AbstractBatteryPoweredDeviceHandl
     }
 
     @Test
-    public void testUpdateChannelsHumidityLevelService() {
+    void testUpdateChannelsHumidityLevelService() {
         JsonElement jsonObject = JsonParser
                 .parseString("{\n" + "   \"@type\": \"humidityLevelState\",\n" + "   \"humidity\": 42.5\n" + " }");
         getFixture().processUpdate("HumidityLevel", jsonObject);
index 9c1b3920a1068070ebf841d6f0519cad5cda8a19..8ac2960ad4f2415e04855d6e33b4a0822cb22591 100644 (file)
@@ -32,7 +32,7 @@ import com.google.gson.JsonParser;
  *
  */
 @NonNullByDefault
-public class WindowContactHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<WindowContactHandler> {
+class WindowContactHandlerTest extends AbstractBatteryPoweredDeviceHandlerTest<WindowContactHandler> {
 
     @Override
     protected WindowContactHandler createFixture() {
@@ -50,7 +50,7 @@ public class WindowContactHandlerTest extends AbstractBatteryPoweredDeviceHandle
     }
 
     @Test
-    public void testUpdateChannelsShutterContactService() {
+    void testUpdateChannelsShutterContactService() {
         JsonElement jsonObject = JsonParser
                 .parseString("{\n" + "   \"@type\": \"shutterContactState\",\n" + "   \"value\": \"OPEN\"\n" + " }");
         getFixture().processUpdate("ShutterContact", jsonObject);
index faf441ac51800a07e14c317a080f1b5dad1ad093..cc087d02a73bcb9079624f0eab41d52d8a7b7645 100644 (file)
  */
 package org.openhab.binding.boschshc.internal.discovery;
 
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.*;
 
 import javax.jmdns.ServiceInfo;
@@ -45,7 +46,7 @@ import org.openhab.core.thing.ThingUID;
 @ExtendWith(MockitoExtension.class)
 @MockitoSettings(strictness = Strictness.LENIENT)
 @NonNullByDefault
-public class BridgeDiscoveryParticipantTest {
+class BridgeDiscoveryParticipantTest {
 
     @Nullable
     private BridgeDiscoveryParticipant fixture;
@@ -76,30 +77,30 @@ public class BridgeDiscoveryParticipantTest {
     }
 
     /**
-     * 
+     *
      * Method: getSupportedThingTypeUIDs()
-     * 
+     *
      */
 
     @Test
-    public void testGetSupportedThingTypeUIDs() {
+    void testGetSupportedThingTypeUIDs() {
         assert fixture != null;
         assertTrue(fixture.getSupportedThingTypeUIDs().contains(BoschSHCBindingConstants.THING_TYPE_SHC));
     }
 
     /**
-     * 
+     *
      * Method: getServiceType()
-     * 
+     *
      */
     @Test
-    public void testGetServiceType() throws Exception {
+    void testGetServiceType() throws Exception {
         assert fixture != null;
         assertThat(fixture.getServiceType(), is("_http._tcp.local."));
     }
 
     @Test
-    public void testCreateResult() throws Exception {
+    void testCreateResult() throws Exception {
         assert fixture != null;
         DiscoveryResult result = fixture.createResult(shcBridge);
         assertNotNull(result);
@@ -110,14 +111,14 @@ public class BridgeDiscoveryParticipantTest {
     }
 
     @Test
-    public void testCreateResultOtherDevice() throws Exception {
+    void testCreateResultOtherDevice() throws Exception {
         assert fixture != null;
         DiscoveryResult result = fixture.createResult(otherDevice);
         assertNull(result);
     }
 
     @Test
-    public void testGetThingUID() throws Exception {
+    void testGetThingUID() throws Exception {
         assert fixture != null;
         ThingUID thingUID = fixture.getThingUID(shcBridge);
         assertNotNull(thingUID);
@@ -126,32 +127,32 @@ public class BridgeDiscoveryParticipantTest {
     }
 
     @Test
-    public void testGetThingUIDOtherDevice() throws Exception {
+    void testGetThingUIDOtherDevice() throws Exception {
         assert fixture != null;
         assertNull(fixture.getThingUID(otherDevice));
     }
 
     @Test
-    public void testGetBridgeAddress() throws Exception {
+    void testGetBridgeAddress() throws Exception {
         assert fixture != null;
         assertThat(fixture.discoverBridge(shcBridge).shcIpAddress, is("192.168.0.123"));
     }
 
     @Test
-    public void testGetBridgeAddressOtherDevice() throws Exception {
+    void testGetBridgeAddressOtherDevice() throws Exception {
         assert fixture != null;
         assertThat(fixture.discoverBridge(otherDevice).shcIpAddress, is(""));
     }
 
     @Test
-    public void testGetPublicInformationFromPossibleBridgeAddress() throws Exception {
+    void testGetPublicInformationFromPossibleBridgeAddress() throws Exception {
         assert fixture != null;
         assertThat(fixture.getPublicInformationFromPossibleBridgeAddress("192.168.0.123").shcIpAddress,
                 is("192.168.0.123"));
     }
 
     @Test
-    public void testGetPublicInformationFromPossibleBridgeAddressInvalidContent() throws Exception {
+    void testGetPublicInformationFromPossibleBridgeAddressInvalidContent() throws Exception {
         assert fixture != null;
 
         ContentResponse contentResponse = mock(ContentResponse.class);
@@ -170,7 +171,7 @@ public class BridgeDiscoveryParticipantTest {
     }
 
     @Test
-    public void testGetPublicInformationFromPossibleBridgeAddressInvalidStatus() throws Exception {
+    void testGetPublicInformationFromPossibleBridgeAddressInvalidStatus() throws Exception {
         assert fixture != null;
 
         ContentResponse contentResponse = mock(ContentResponse.class);
index 9439144768a03a778593f82f328a765963d7c29e..204dbd89ec6b4489927b0598dfc885926ac4b7bc 100644 (file)
  */
 package org.openhab.binding.boschshc.internal.discovery;
 
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.*;
 
 import java.util.ArrayList;
@@ -44,7 +45,7 @@ import org.openhab.core.thing.ThingUID;
  */
 @ExtendWith(MockitoExtension.class)
 @NonNullByDefault
-public class ThingDiscoveryServiceTest {
+class ThingDiscoveryServiceTest {
 
     private @NonNullByDefault({}) ThingDiscoveryService fixture;
 
@@ -69,7 +70,7 @@ public class ThingDiscoveryServiceTest {
     }
 
     @Test
-    public void testStartScan() throws InterruptedException {
+    void testStartScan() throws InterruptedException {
         mockBridgeCalls();
 
         fixture.activate();
@@ -83,7 +84,7 @@ public class ThingDiscoveryServiceTest {
     }
 
     @Test
-    public void testStartScanWithoutBridgeHandler() {
+    void testStartScanWithoutBridgeHandler() {
         mockBridgeCalls();
 
         // No fixture.setThingHandler(bridgeHandler);
@@ -96,13 +97,13 @@ public class ThingDiscoveryServiceTest {
     }
 
     @Test
-    public void testSetGetThingHandler() {
+    void testSetGetThingHandler() {
         fixture.setThingHandler(bridgeHandler);
         assertThat(fixture.getThingHandler(), is(bridgeHandler));
     }
 
     @Test
-    public void testAddDevices() {
+    void testAddDevices() {
         mockBridgeCalls();
 
         ArrayList<Device> devices = new ArrayList<>();
@@ -128,7 +129,7 @@ public class ThingDiscoveryServiceTest {
     }
 
     @Test
-    public void testAddDevicesWithNoDevices() {
+    void testAddDevicesWithNoDevices() {
         ArrayList<Device> emptyDevices = new ArrayList<>();
         ArrayList<Room> emptyRooms = new ArrayList<>();
 
@@ -141,7 +142,7 @@ public class ThingDiscoveryServiceTest {
     }
 
     @Test
-    public void testAddDevice() {
+    void testAddDevice() {
         mockBridgeCalls();
 
         Device device = new Device();
@@ -159,26 +160,26 @@ public class ThingDiscoveryServiceTest {
         assertThat(result.getThingUID().getId(), is("testDevice_ID"));
         assertThat(result.getBridgeUID().getId(), is("testSHC"));
         assertThat(result.getLabel(), is("Test Name"));
-        assertThat(result.getProperties().get("Location").toString(), is("TestRoom"));
+        assertThat(String.valueOf(result.getProperties().get("Location")), is("TestRoom"));
     }
 
     @Test
-    public void testAddDeviceWithNiceNameAndAppendedRoomName() {
+    void testAddDeviceWithNiceNameAndAppendedRoomName() {
         assertDeviceNiceName("-RoomClimateControl-", "TestRoom", "Room Climate Control TestRoom");
     }
 
     @Test
-    public void testAddDeviceWithNiceNameWithEmtpyRoomName() {
+    void testAddDeviceWithNiceNameWithEmtpyRoomName() {
         assertDeviceNiceName("-RoomClimateControl-", "", "Room Climate Control");
     }
 
     @Test
-    public void testAddDeviceWithNiceNameWithoutAppendingRoomName() {
+    void testAddDeviceWithNiceNameWithoutAppendingRoomName() {
         assertDeviceNiceName("-SmokeDetectionSystem-", "TestRoom", "Smoke Detection System");
     }
 
     @Test
-    public void testAddDeviceWithNiceNameWithoutUsualName() {
+    void testAddDeviceWithNiceNameWithoutUsualName() {
         assertDeviceNiceName("My other device", "TestRoom", "My other device");
     }
 
@@ -197,7 +198,7 @@ public class ThingDiscoveryServiceTest {
     }
 
     @Test
-    public void testGetRoomForDevice() {
+    void testGetRoomForDevice() {
         Device device = new Device();
 
         ArrayList<Room> rooms = new ArrayList<>();
@@ -221,7 +222,7 @@ public class ThingDiscoveryServiceTest {
     }
 
     @Test
-    public void testGetThingTypeUID() {
+    void testGetThingTypeUID() {
         Device device = new Device();
 
         device.deviceModel = "invalid";
index 7eb58b799e6334467224a2ec69f2cbca7226624a..fb252f54e9e28abf610381e68ebc56a39d97280b 100644 (file)
@@ -24,10 +24,10 @@ import org.junit.jupiter.api.Test;
  *
  */
 @NonNullByDefault
-public class LongPollingFailedExceptionTest {
+class LongPollingFailedExceptionTest {
 
     @Test
-    public void testConstructor() {
+    void testConstructor() {
         RuntimeException testException = new RuntimeException("test exception");
         LongPollingFailedException longPollingFailedException = new LongPollingFailedException("message",
                 testException);
index b9bdfae9ec57d8844b6eaeb497b7366619d887cb..3d9b39a7e2d1a38e9ab634c22f674a4a91dbd61b 100644 (file)
@@ -24,10 +24,10 @@ import org.junit.jupiter.api.Test;
  *
  */
 @NonNullByDefault
-public class PairingFailedExceptionTest {
+class PairingFailedExceptionTest {
 
     @Test
-    public void testConstructor() {
+    void testConstructor() {
         PairingFailedException fixture = new PairingFailedException();
         assertNotNull(fixture);
         assertNull(fixture.getMessage());
@@ -35,7 +35,7 @@ public class PairingFailedExceptionTest {
     }
 
     @Test
-    public void testConstructorWithMessage() {
+    void testConstructorWithMessage() {
         PairingFailedException fixture = new PairingFailedException("message");
         assertNotNull(fixture);
         assertEquals("message", fixture.getMessage());
@@ -43,7 +43,7 @@ public class PairingFailedExceptionTest {
     }
 
     @Test
-    public void testConstructorWithMessageAndCause() {
+    void testConstructorWithMessageAndCause() {
         RuntimeException testException = new RuntimeException("test exception");
         PairingFailedException fixture = new PairingFailedException("message", testException);
         assertNotNull(fixture);
index f0f1a29a5fb22db81f6d95a54eb2dbcfac9e995c..36b5361830d903ee5434bc7aa134178637e21900 100644 (file)
@@ -48,10 +48,10 @@ class TestState2 extends BoschSHCServiceState {
  * @author Christian Oeing - Initial contribution
  */
 @NonNullByDefault
-public class BoschSHCServiceStateTest {
+class BoschSHCServiceStateTest {
 
     @Test
-    public void fromJsonNullStateForDifferentType() {
+    void fromJsonNullStateForDifferentType() {
         var state = BoschSHCServiceState.fromJson(
                 GsonUtils.DEFAULT_GSON_INSTANCE.fromJson("{\"@type\":\"differentState\"}", JsonObject.class),
                 TestState.class);
@@ -59,7 +59,7 @@ public class BoschSHCServiceStateTest {
     }
 
     @Test
-    public void fromJsonStateObjectForValidJson() {
+    void fromJsonStateObjectForValidJson() {
         var state = BoschSHCServiceState.fromJson(
                 GsonUtils.DEFAULT_GSON_INSTANCE.fromJson("{\"@type\":\"testState\"}", JsonObject.class),
                 TestState.class);
@@ -70,7 +70,7 @@ public class BoschSHCServiceStateTest {
      * This checks for a bug we had where the expected type stayed the same for different state classes
      */
     @Test
-    public void fromJsonStateObjectForValidJsonAfterOtherState() {
+    void fromJsonStateObjectForValidJsonAfterOtherState() {
         BoschSHCServiceState.fromJson(
                 GsonUtils.DEFAULT_GSON_INSTANCE.fromJson("{\"@type\":\"testState\"}", JsonObject.class),
                 TestState.class);
index 86e485acbdef7e0c55780387cefc9df61019bcb8..adcccb06ef6136dba3257692aaba2727515690bf 100644 (file)
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
  *
  */
 @NonNullByDefault
-public class JsonRestExceptionResponseTest {
+class JsonRestExceptionResponseTest {
 
     private @NonNullByDefault({}) JsonRestExceptionResponse fixture;
 
@@ -35,7 +35,7 @@ public class JsonRestExceptionResponseTest {
     }
 
     @Test
-    public void testIsValid() {
+    void testIsValid() {
         assertFalse(JsonRestExceptionResponse.isValid(null));
         assertTrue(JsonRestExceptionResponse.isValid(fixture));
         fixture.errorCode = null;
index 0d36219099f43ff7cf5cc7b10ddf8b59d5e8d514..2e28456aa8a8735b993729dff86dac4a0a629ab8 100644 (file)
@@ -19,12 +19,12 @@ import org.junit.jupiter.api.Test;
 
 /**
  * Unit tests for {@link SmokeDetectorCheckState}.
- * 
+ *
  * @author David Pace - Initial contribution
  *
  */
 @NonNullByDefault
-public class SmokeDetectorCheckStateTest {
+class SmokeDetectorCheckStateTest {
 
     @Test
     void testFrom() {