[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 <t-riggs@gmx.net>
This commit is contained in:
Thomas Traude 2022-11-26 12:19:43 +01:00 committed by GitHub
parent 4739f126a2
commit 66d7496d7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 28 deletions

View File

@ -27,18 +27,18 @@ import org.junit.jupiter.api.Test;
* *
*/ */
@NonNullByDefault @NonNullByDefault
public class KNXChannelTypeTest { class KNXChannelTypeTest {
private KNXChannelType ct = new MyKNXChannelType(""); private KNXChannelType ct = new MyKNXChannelType("");
@BeforeEach @BeforeEach
public void setup() { void setup() {
ct = new MyKNXChannelType(""); ct = new MyKNXChannelType("");
} }
@SuppressWarnings("null") @SuppressWarnings("null")
@Test @Test
public void testParseWithDptMultipleWithRead() { void testParseWithDptMultipleWithRead() {
ChannelConfiguration res = ct.parse("5.001:<1/3/22+0/3/22+<0/8/15"); ChannelConfiguration res = ct.parse("5.001:<1/3/22+0/3/22+<0/8/15");
assertEquals("5.001", res.getDPT()); assertEquals("5.001", res.getDPT());
@ -50,7 +50,7 @@ public class KNXChannelTypeTest {
@SuppressWarnings("null") @SuppressWarnings("null")
@Test @Test
public void testParseWithDptMultipleWithoutRead() { void testParseWithDptMultipleWithoutRead() {
ChannelConfiguration res = ct.parse("5.001:1/3/22+0/3/22+0/8/15"); ChannelConfiguration res = ct.parse("5.001:1/3/22+0/3/22+0/8/15");
assertEquals("5.001", res.getDPT()); assertEquals("5.001", res.getDPT());
@ -62,7 +62,7 @@ public class KNXChannelTypeTest {
@SuppressWarnings("null") @SuppressWarnings("null")
@Test @Test
public void testParseWithoutDptSingleWithoutRead() { void testParseWithoutDptSingleWithoutRead() {
ChannelConfiguration res = ct.parse("1/3/22"); ChannelConfiguration res = ct.parse("1/3/22");
assertNull(res.getDPT()); assertNull(res.getDPT());
@ -74,7 +74,7 @@ public class KNXChannelTypeTest {
@SuppressWarnings("null") @SuppressWarnings("null")
@Test @Test
public void testParseWithoutDptSingleWitRead() { void testParseWithoutDptSingleWitRead() {
ChannelConfiguration res = ct.parse("<1/3/22"); ChannelConfiguration res = ct.parse("<1/3/22");
assertNull(res.getDPT()); assertNull(res.getDPT());
@ -86,7 +86,7 @@ public class KNXChannelTypeTest {
@SuppressWarnings("null") @SuppressWarnings("null")
@Test @Test
public void testParseTwoLevel() { void testParseTwoLevel() {
ChannelConfiguration res = ct.parse("5.001:<3/1024+<4/1025"); ChannelConfiguration res = ct.parse("5.001:<3/1024+<4/1025");
assertEquals("3/1024", res.getMainGA().getGA()); assertEquals("3/1024", res.getMainGA().getGA());
assertEquals(2, res.getListenGAs().size()); assertEquals(2, res.getListenGAs().size());
@ -95,7 +95,7 @@ public class KNXChannelTypeTest {
@SuppressWarnings("null") @SuppressWarnings("null")
@Test @Test
public void testParseFreeLevel() { void testParseFreeLevel() {
ChannelConfiguration res = ct.parse("5.001:<4610+<4611"); ChannelConfiguration res = ct.parse("5.001:<4610+<4611");
assertEquals("4610", res.getMainGA().getGA()); assertEquals("4610", res.getMainGA().getGA());
assertEquals(2, res.getListenGAs().size()); assertEquals(2, res.getListenGAs().size());

View File

@ -26,17 +26,17 @@ import org.openhab.core.library.types.QuantityType;
* *
*/ */
@NonNullByDefault @NonNullByDefault
public class KNXCoreTypeMapperTest { class KNXCoreTypeMapperTest {
@Test @Test
public void testToDPTValueTrailingZeroesStrippedOff() { void testToDPTValueTrailingZeroesStrippedOff() {
assertEquals("3", new KNXCoreTypeMapper().toDPTValue(new DecimalType("3"), "17.001")); assertEquals("3", new KNXCoreTypeMapper().toDPTValue(new DecimalType("3"), "17.001"));
assertEquals("3", new KNXCoreTypeMapper().toDPTValue(new DecimalType("3.0"), "17.001")); assertEquals("3", new KNXCoreTypeMapper().toDPTValue(new DecimalType("3.0"), "17.001"));
} }
@Test @Test
@SuppressWarnings("null") @SuppressWarnings("null")
public void testToDPT5ValueFromQuantityType() { void testToDPT5ValueFromQuantityType() {
assertEquals("80.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("80 %"), "5.001")); assertEquals("80.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("80 %"), "5.001"));
assertEquals("180.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("180 °"), "5.003")); assertEquals("180.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("180 °"), "5.003"));
@ -46,7 +46,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @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.002"));
assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "7.003")); assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "7.003"));
assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "7.004")); assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "7.004"));
@ -63,7 +63,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @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.002"));
assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "8.003")); assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "8.003"));
assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "8.004")); assertEquals("1000.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1000 ms"), "8.004"));
@ -77,7 +77,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @SuppressWarnings("null")
public void testToDPT9ValueFromQuantityType() { void testToDPT9ValueFromQuantityType() {
assertEquals("23.1", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("23.1 °C"), "9.001")); 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("5.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("41 °F"), "9.001"));
assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("274.15 K"), "9.001")); assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("274.15 K"), "9.001"));
@ -121,7 +121,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @SuppressWarnings("null")
public void testToDPT10ValueFromQuantityType() { void testToDPT10ValueFromQuantityType() {
// DateTimeTyype, not QuantityType // DateTimeTyype, not QuantityType
assertEquals("Wed, 17:30:00", assertEquals("Wed, 17:30:00",
new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "10.001")); new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "10.001"));
@ -129,7 +129,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @SuppressWarnings("null")
public void testToDPT11ValueFromQuantityType() { void testToDPT11ValueFromQuantityType() {
// DateTimeTyype, not QuantityType // DateTimeTyype, not QuantityType
assertEquals("2019-06-12", assertEquals("2019-06-12",
new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "11.001")); new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "11.001"));
@ -137,7 +137,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @SuppressWarnings("null")
public void testToDPT12ValueFromQuantityType() { void testToDPT12ValueFromQuantityType() {
// 12.001: dimensionless // 12.001: dimensionless
assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1 s"), "12.100")); assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1 s"), "12.100"));
@ -151,7 +151,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @SuppressWarnings("null")
public void testToDPT13ValueFromQuantityType() { void testToDPT13ValueFromQuantityType() {
// 13.001 dimensionless // 13.001 dimensionless
assertEquals("24.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("24 m³/h"), "13.002")); 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")); assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("24 m³/d"), "13.002"));
@ -173,7 +173,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @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 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 rad/s²"), "14.001"));
assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1 J/mol"), "14.002")); assertEquals("1.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("1 J/mol"), "14.002"));
@ -265,7 +265,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @SuppressWarnings("null")
public void testToDPT19ValueFromQuantityType() { void testToDPT19ValueFromQuantityType() {
// DateTimeTyype, not QuantityType // DateTimeTyype, not QuantityType
assertEquals("2019-06-12 17:30:00", assertEquals("2019-06-12 17:30:00",
new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "19.001")); new KNXCoreTypeMapper().toDPTValue(new DateTimeType("2019-06-12T17:30:00Z"), "19.001"));
@ -273,7 +273,7 @@ public class KNXCoreTypeMapperTest {
@Test @Test
@SuppressWarnings("null") @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 Wh"), "29.010"));
assertEquals("42.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("42 VAh"), "29.011")); assertEquals("42.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("42 VAh"), "29.011"));
assertEquals("42.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("42 varh"), "29.012")); assertEquals("42.0", new KNXCoreTypeMapper().toDPTValue(new QuantityType<>("42 varh"), "29.012"));

View File

@ -28,10 +28,10 @@ import tuwien.auto.calimero.secure.KnxSecureException;
* *
*/ */
@NonNullByDefault @NonNullByDefault
public class KNXBridgeBaseThingHandlerTest { class KNXBridgeBaseThingHandlerTest {
@Test @Test
public void testSecurityHelpers() { void testSecurityHelpers() {
// now check router settings: // now check router settings:
String bbKeyHex = "D947B12DDECAD528B1D5A88FD347F284"; String bbKeyHex = "D947B12DDECAD528B1D5A88FD347F284";
byte[] bbKeyParsedLower = KNXBridgeBaseThingHandler.secHelperParseBackboneKey(bbKeyHex.toLowerCase()); byte[] bbKeyParsedLower = KNXBridgeBaseThingHandler.secHelperParseBackboneKey(bbKeyHex.toLowerCase());
@ -42,7 +42,7 @@ public class KNXBridgeBaseThingHandlerTest {
@Test @Test
@SuppressWarnings("null") @SuppressWarnings("null")
public void testInitializeSecurity() { void testInitializeSecurity() {
Bridge bridge = mock(Bridge.class); Bridge bridge = mock(Bridge.class);
NetworkAddressService nas = mock(NetworkAddressService.class); NetworkAddressService nas = mock(NetworkAddressService.class);
IPBridgeThingHandler handler = new IPBridgeThingHandler(bridge, nas); IPBridgeThingHandler handler = new IPBridgeThingHandler(bridge, nas);

View File

@ -26,7 +26,7 @@ import tuwien.auto.calimero.link.KNXLinkClosedException;
* *
*/ */
@NonNullByDefault @NonNullByDefault
public class KNXTranslationProviderTest { class KNXTranslationProviderTest {
static final String UNKNOWN = "unknown text"; static final String UNKNOWN = "unknown text";
static final String UNKNOWN_PATTERN = "unknown text {0}"; static final String UNKNOWN_PATTERN = "unknown text {0}";
static final String UNKNOWN_FIVE = "unknown text 5"; 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."; static final String CONN_TYPE_NULL_VALUE = "Unknown IP connection type: null.";
@Test @Test
public void testGetBeforeInit() { void testGetBeforeInit() {
// initial state, should not crash and preferrably return original strings (w. pattern substitution) // 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));
assertEquals(UNKNOWN, KNXTranslationProvider.I18N.get(UNKNOWN, 5)); assertEquals(UNKNOWN, KNXTranslationProvider.I18N.get(UNKNOWN, 5));
@ -53,7 +53,7 @@ public class KNXTranslationProviderTest {
} }
@Test @Test
public void testSetProvider() { void testSetProvider() {
// initial state, should not crash // initial state, should not crash
KNXTranslationProvider.I18N.setProvider(null, null); KNXTranslationProvider.I18N.setProvider(null, null);
assertNotNull(KNXTranslationProvider.I18N.get(UNKNOWN)); assertNotNull(KNXTranslationProvider.I18N.get(UNKNOWN));
@ -89,7 +89,7 @@ public class KNXTranslationProviderTest {
} }
@Test @Test
public void testGetLocalizedException() { void testGetLocalizedException() {
// initial state, should not crash // initial state, should not crash
KNXTranslationProvider.I18N.setProvider(null, null); KNXTranslationProvider.I18N.setProvider(null, null);