Skip to content

Commit 2ef4726

Browse files
committed
Make sonar happier
JUnit 5 doesn't need public modifiers on the class or the test methods. Usage of `assertNotEquals` leads to better error messages than `assertFalse`, as it has more information about the compared values.
1 parent 44c9031 commit 2ef4726

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

src/core/src/test/java/org/apache/jmeter/testelement/property/PackageTest.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
package org.apache.jmeter.testelement.property;
1919

2020
import static org.junit.jupiter.api.Assertions.assertEquals;
21-
import static org.junit.jupiter.api.Assertions.assertFalse;
21+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
2222
import static org.junit.jupiter.api.Assertions.assertThrows;
2323

2424
import org.apache.jmeter.config.LoginConfig;
2525
import org.junit.jupiter.api.Test;
2626

2727
/** Class for testing the property package. */
28-
public class PackageTest {
28+
class PackageTest {
2929

3030
@Test
31-
public void testStringProperty() throws Exception {
31+
void testStringProperty() throws Exception {
3232
StringProperty prop = new StringProperty("name", "value");
3333
prop.setRunningVersion(true);
3434
prop.setObjectValue("new Value");
@@ -43,7 +43,7 @@ public void testStringProperty() throws Exception {
4343
}
4444

4545
@Test
46-
public void testElementProperty() throws Exception {
46+
void testElementProperty() throws Exception {
4747
LoginConfig config = new LoginConfig();
4848
config.setUsername("username");
4949
config.setPassword("password");
@@ -80,13 +80,13 @@ private void checkEquals(JMeterProperty jp1, JMeterProperty jp2) {
8080
private void checkNotEquals(JMeterProperty jp1, JMeterProperty jp2) {
8181
assertEquals(jp1, jp1);
8282
assertEquals(jp2, jp2);
83-
assertFalse(jp1.equals(jp2));
84-
assertFalse(jp2.equals(jp1));
83+
assertNotEquals(jp1, jp2);
84+
assertNotEquals(jp2, jp1);
8585
// do not check hashcodes; unequal objects may have equal hashcodes
8686
}
8787

8888
@Test
89-
public void testBooleanEquality() throws Exception {
89+
void testBooleanEquality() throws Exception {
9090
BooleanProperty jpn1 = new BooleanProperty();
9191
BooleanProperty jpn2 = new BooleanProperty();
9292
BooleanProperty jp1 = new BooleanProperty("name1", true);
@@ -103,12 +103,12 @@ public void testBooleanEquality() throws Exception {
103103
}
104104

105105
@Test
106-
public void testInvalidBooleanConstructors() {
106+
void testInvalidBooleanConstructors() {
107107
assertThrows(IllegalArgumentException.class, () -> new BooleanProperty(null, false));
108108
}
109109

110110
@Test
111-
public void testDoubleEquality() throws Exception {
111+
void testDoubleEquality() throws Exception {
112112
DoubleProperty jpn1 = new DoubleProperty();
113113
DoubleProperty jpn2 = new DoubleProperty();
114114
DoubleProperty jp1 = new DoubleProperty("name1", 123.4);
@@ -150,12 +150,12 @@ public void testDoubleEquality() throws Exception {
150150
}
151151

152152
@Test
153-
public void testInvalidDoubleConstructors() {
153+
void testInvalidDoubleConstructors() {
154154
assertThrows(IllegalArgumentException.class, () -> new DoubleProperty(null, 0));
155155
}
156156

157157
@Test
158-
public void testFloatEquality() throws Exception {
158+
void testFloatEquality() throws Exception {
159159
FloatProperty jp1 = new FloatProperty("name1", 123.4f);
160160
FloatProperty jp2 = new FloatProperty("name1", 123.4f);
161161
FloatProperty jp3 = new FloatProperty("name2", -123.4f);
@@ -192,12 +192,12 @@ public void testFloatEquality() throws Exception {
192192
}
193193

194194
@Test
195-
public void testInvalidFloatConstructors() {
195+
void testInvalidFloatConstructors() {
196196
assertThrows(IllegalArgumentException.class, () -> new FloatProperty(null, 0));
197197
}
198198

199199
@Test
200-
public void testIntegerEquality() throws Exception {
200+
void testIntegerEquality() throws Exception {
201201
IntegerProperty jp1 = new IntegerProperty("name1", 123);
202202
IntegerProperty jp2 = new IntegerProperty("name1", 123);
203203
IntegerProperty jp3 = new IntegerProperty("name2", -123);
@@ -222,13 +222,13 @@ public void testIntegerEquality() throws Exception {
222222
}
223223

224224
@Test
225-
public void testInvalidIntegerConstructors() {
225+
void testInvalidIntegerConstructors() {
226226
assertThrows(IllegalArgumentException.class, () -> new IntegerProperty(null));
227227
assertThrows(IllegalArgumentException.class, () -> new IntegerProperty(null, 0));
228228
}
229229

230230
@Test
231-
public void testLongEquality() throws Exception {
231+
void testLongEquality() throws Exception {
232232
LongProperty jp1 = new LongProperty("name1", 123);
233233
LongProperty jp2 = new LongProperty("name1", 123);
234234
LongProperty jp3 = new LongProperty("name2", -123);
@@ -253,17 +253,17 @@ public void testLongEquality() throws Exception {
253253
}
254254

255255
@Test
256-
public void testInvalidLongConstructors() {
256+
void testInvalidLongConstructors() {
257257
assertThrows(IllegalArgumentException.class, () -> new LongProperty(null, 0L));
258258
}
259259

260260
@Test
261-
public void testInvalidMapConstructors() throws Exception {
261+
void testInvalidMapConstructors() throws Exception {
262262
assertThrows(IllegalArgumentException.class, () -> new MapProperty(null, null));
263263
}
264264

265265
@Test
266-
public void testNullEquality() throws Exception {
266+
void testNullEquality() throws Exception {
267267
NullProperty jpn1 = new NullProperty();
268268
NullProperty jpn2 = new NullProperty();
269269
NullProperty jp1 = new NullProperty("name1");
@@ -279,12 +279,12 @@ public void testNullEquality() throws Exception {
279279
}
280280

281281
@Test
282-
public void testInvalidNullConstructors() {
282+
void testInvalidNullConstructors() {
283283
assertThrows(IllegalArgumentException.class, () -> new NullProperty(null));
284284
}
285285

286286
@Test
287-
public void testStringEquality() throws Exception {
287+
void testStringEquality() throws Exception {
288288
StringProperty jpn1 = new StringProperty();
289289
StringProperty jpn2 = new StringProperty();
290290
StringProperty jp1 = new StringProperty("name1", "value1");
@@ -306,13 +306,13 @@ public void testStringEquality() throws Exception {
306306
}
307307

308308
@Test
309-
public void testInvalidStringConstructors() {
309+
void testInvalidStringConstructors() {
310310
assertThrows(IllegalArgumentException.class, () -> new StringProperty(null, ""));
311311
assertThrows(IllegalArgumentException.class, () -> new StringProperty(null, null));
312312
}
313313

314314
@Test
315-
public void testAddingProperties() throws Exception {
315+
void testAddingProperties() throws Exception {
316316
CollectionProperty coll = new CollectionProperty();
317317
coll.addItem("joe");
318318
coll.addProperty(new FunctionProperty());

0 commit comments

Comments
 (0)