From 66d7496d7b92ebb221e592adc1cde11778378807 Mon Sep 17 00:00:00 2001 From: Thomas Traude Date: Sat, 26 Nov 2022 12:19:43 +0100 Subject: [PATCH] [knx] Remove obsolete public modifier in tests (#13776) Since JUnit Jupiter test classes and methods do not need to be `public`. It is recommended to omit the `public` modifier. See https://junit.org/junit5/docs/current/user-guide/#writing-tests-classes-and-methods "Class and method visibility Test classes, test methods, and lifecycle methods are not required to be `public`, but they must not be `private`. It is generally recommended to omit the `public` modifier for test classes, test methods, and lifecycle methods unless there is a technical reason for doing so (...)" Signed-off-by: Thomas Traude --- .../internal/channel/KNXChannelTypeTest.java | 16 ++++++------ .../internal/dpt/KNXCoreTypeMapperTest.java | 26 +++++++++---------- .../KNXBridgeBaseThingHandlerTest.java | 6 ++--- .../i18n/KNXTranslationProviderTest.java | 8 +++--- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/channel/KNXChannelTypeTest.java b/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/channel/KNXChannelTypeTest.java index c735844f2..51e2b91dd 100644 --- a/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/channel/KNXChannelTypeTest.java +++ b/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/channel/KNXChannelTypeTest.java @@ -27,18 +27,18 @@ import org.junit.jupiter.api.Test; * */ @NonNullByDefault -public class KNXChannelTypeTest { +class KNXChannelTypeTest { private KNXChannelType ct = new MyKNXChannelType(""); @BeforeEach - public void setup() { + void setup() { ct = new MyKNXChannelType(""); } @SuppressWarnings("null") @Test - public void testParseWithDptMultipleWithRead() { + void testParseWithDptMultipleWithRead() { ChannelConfiguration res = ct.parse("5.001:<1/3/22+0/3/22+<0/8/15"); assertEquals("5.001", res.getDPT()); @@ -50,7 +50,7 @@ public class KNXChannelTypeTest { @SuppressWarnings("null") @Test - public void testParseWithDptMultipleWithoutRead() { + void testParseWithDptMultipleWithoutRead() { ChannelConfiguration res = ct.parse("5.001:1/3/22+0/3/22+0/8/15"); assertEquals("5.001", res.getDPT()); @@ -62,7 +62,7 @@ public class KNXChannelTypeTest { @SuppressWarnings("null") @Test - public void testParseWithoutDptSingleWithoutRead() { + void testParseWithoutDptSingleWithoutRead() { ChannelConfiguration res = ct.parse("1/3/22"); assertNull(res.getDPT()); @@ -74,7 +74,7 @@ public class KNXChannelTypeTest { @SuppressWarnings("null") @Test - public void testParseWithoutDptSingleWitRead() { + void testParseWithoutDptSingleWitRead() { ChannelConfiguration res = ct.parse("<1/3/22"); assertNull(res.getDPT()); @@ -86,7 +86,7 @@ public class KNXChannelTypeTest { @SuppressWarnings("null") @Test - public void testParseTwoLevel() { + void testParseTwoLevel() { ChannelConfiguration res = ct.parse("5.001:<3/1024+<4/1025"); assertEquals("3/1024", res.getMainGA().getGA()); assertEquals(2, res.getListenGAs().size()); @@ -95,7 +95,7 @@ public class KNXChannelTypeTest { @SuppressWarnings("null") @Test - public void testParseFreeLevel() { + void testParseFreeLevel() { ChannelConfiguration res = ct.parse("5.001:<4610+<4611"); assertEquals("4610", res.getMainGA().getGA()); assertEquals(2, res.getListenGAs().size()); diff --git a/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapperTest.java b/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapperTest.java index 439998b34..42bb5a7ac 100644 --- a/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapperTest.java +++ b/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapperTest.java @@ -26,17 +26,17 @@ import org.openhab.core.library.types.QuantityType; * */ @NonNullByDefault -public class KNXCoreTypeMapperTest { +class KNXCoreTypeMapperTest { @Test - public void testToDPTValueTrailingZeroesStrippedOff() { + void testToDPTValueTrailingZeroesStrippedOff() { assertEquals("3", new KNXCoreTypeMapper().toDPTValue(new DecimalType("3"), "17.001")); assertEquals("3", new KNXCoreTypeMapper().toDPTValue(new DecimalType("3.0"), "17.001")); } @Test @SuppressWarnings("null") - public void testToDPT5ValueFromQuantityType() { + void testToDPT5ValueFromQuantityType() { assertEquals("80.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("80 %"), "5.001")); assertEquals("180.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("180 °"), "5.003")); @@ -46,7 +46,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT7ValueFromQuantityType() { + void testToDPT7ValueFromQuantityType() { assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "7.002")); assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "7.003")); assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "7.004")); @@ -63,7 +63,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT8ValueFromQuantityType() { + void testToDPT8ValueFromQuantityType() { assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "8.002")); assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "8.003")); assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "8.004")); @@ -77,7 +77,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT9ValueFromQuantityType() { + void testToDPT9ValueFromQuantityType() { assertEquals("23.1", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("23.1 °C"), "9.001")); assertEquals("5.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("41 °F"), "9.001")); assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("274.15 K"), "9.001")); @@ -121,7 +121,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT10ValueFromQuantityType() { + void testToDPT10ValueFromQuantityType() { // DateTimeTyype, not QuantityType assertEquals("Wed, 17:30:00", new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "10.001")); @@ -129,7 +129,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT11ValueFromQuantityType() { + void testToDPT11ValueFromQuantityType() { // DateTimeTyype, not QuantityType assertEquals("2019-06-12", new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "11.001")); @@ -137,7 +137,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT12ValueFromQuantityType() { + void testToDPT12ValueFromQuantityType() { // 12.001: dimensionless assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1 s"), "12.100")); @@ -151,7 +151,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT13ValueFromQuantityType() { + void testToDPT13ValueFromQuantityType() { // 13.001 dimensionless assertEquals("24.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("24 m³/h"), "13.002")); assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("24 m³/d"), "13.002")); @@ -173,7 +173,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT14ValueFromQuantityType() { + void testToDPT14ValueFromQuantityType() { assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1 m/s²"), "14.000")); assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1 rad/s²"), "14.001")); assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1 J/mol"), "14.002")); @@ -265,7 +265,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT19ValueFromQuantityType() { + void testToDPT19ValueFromQuantityType() { // DateTimeTyype, not QuantityType assertEquals("2019-06-12 17:30:00", new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "19.001")); @@ -273,7 +273,7 @@ public class KNXCoreTypeMapperTest { @Test @SuppressWarnings("null") - public void testToDPT29ValueFromQuantityType() { + void testToDPT29ValueFromQuantityType() { assertEquals("42.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("42 Wh"), "29.010")); assertEquals("42.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("42 VAh"), "29.011")); assertEquals("42.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("42 varh"), "29.012")); diff --git a/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/handler/KNXBridgeBaseThingHandlerTest.java b/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/handler/KNXBridgeBaseThingHandlerTest.java index f204d487d..076c1f0d7 100644 --- a/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/handler/KNXBridgeBaseThingHandlerTest.java +++ b/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/handler/KNXBridgeBaseThingHandlerTest.java @@ -28,10 +28,10 @@ import tuwien.auto.calimero.secure.KnxSecureException; * */ @NonNullByDefault -public class KNXBridgeBaseThingHandlerTest { +class KNXBridgeBaseThingHandlerTest { @Test - public void testSecurityHelpers() { + void testSecurityHelpers() { // now check router settings: String bbKeyHex = "D947B12DDECAD528B1D5A88FD347F284"; byte[] bbKeyParsedLower = KNXBridgeBaseThingHandler.secHelperParseBackboneKey(bbKeyHex.toLowerCase()); @@ -42,7 +42,7 @@ public class KNXBridgeBaseThingHandlerTest { @Test @SuppressWarnings("null") - public void testInitializeSecurity() { + void testInitializeSecurity() { Bridge bridge = mock(Bridge.class); NetworkAddressService nas = mock(NetworkAddressService.class); IPBridgeThingHandler handler = new IPBridgeThingHandler(bridge, nas); diff --git a/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/i18n/KNXTranslationProviderTest.java b/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/i18n/KNXTranslationProviderTest.java index 78a684ad6..97b7fa5fc 100644 --- a/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/i18n/KNXTranslationProviderTest.java +++ b/bundles/org.openhab.binding.knx/src/test/java/org/openhab/binding/knx/internal/i18n/KNXTranslationProviderTest.java @@ -26,7 +26,7 @@ import tuwien.auto.calimero.link.KNXLinkClosedException; * */ @NonNullByDefault -public class KNXTranslationProviderTest { +class KNXTranslationProviderTest { static final String UNKNOWN = "unknown text"; static final String UNKNOWN_PATTERN = "unknown text {0}"; static final String UNKNOWN_FIVE = "unknown text 5"; @@ -39,7 +39,7 @@ public class KNXTranslationProviderTest { static final String CONN_TYPE_NULL_VALUE = "Unknown IP connection type: null."; @Test - public void testGetBeforeInit() { + void testGetBeforeInit() { // initial state, should not crash and preferrably return original strings (w. pattern substitution) assertEquals(UNKNOWN, KNXTranslationProvider.I18N.get(UNKNOWN)); assertEquals(UNKNOWN, KNXTranslationProvider.I18N.get(UNKNOWN, 5)); @@ -53,7 +53,7 @@ public class KNXTranslationProviderTest { } @Test - public void testSetProvider() { + void testSetProvider() { // initial state, should not crash KNXTranslationProvider.I18N.setProvider(null, null); assertNotNull(KNXTranslationProvider.I18N.get(UNKNOWN)); @@ -89,7 +89,7 @@ public class KNXTranslationProviderTest { } @Test - public void testGetLocalizedException() { + void testGetLocalizedException() { // initial state, should not crash KNXTranslationProvider.I18N.setProvider(null, null);