Skip to content

Commit c04ec8b

Browse files
authored
Merge pull request #2440 from ControlSystemStudio/CSSTUDIO-1779
Migration to JUnit5
2 parents 0d5da74 + 699094c commit c04ec8b

File tree

267 files changed

+2352
-2492
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+2352
-2492
lines changed

app/3d-viewer/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<version>4.7.1-SNAPSHOT</version>
1919
</dependency>
2020
<dependency>
21-
<groupId>junit</groupId>
22-
<artifactId>junit</artifactId>
21+
<groupId>org.junit.jupiter</groupId>
22+
<artifactId>junit-jupiter</artifactId>
2323
<version>${junit.version}</version>
2424
<scope>test</scope>
2525
</dependency>

app/3d-viewer/src/test/java/org/phoebus/app/viewer3d/Viewer3dParserDemo.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77
*******************************************************************************/
88
package org.phoebus.app.viewer3d;
99

10-
import static org.junit.Assert.assertEquals;
11-
import static org.junit.Assert.assertTrue;
12-
13-
import java.io.ByteArrayInputStream;
14-
15-
import org.junit.Test;
16-
import org.phoebus.applications.viewer3d.Viewer3d;
17-
import org.phoebus.applications.viewer3d.Xform;
18-
1910
import javafx.application.Platform;
2011
import javafx.scene.paint.Color;
2112
import javafx.scene.paint.PhongMaterial;
2213
import javafx.scene.shape.Sphere;
14+
import org.junit.jupiter.api.Test;
15+
import org.phoebus.applications.viewer3d.Viewer3d;
16+
import org.phoebus.applications.viewer3d.Xform;
17+
18+
import java.io.ByteArrayInputStream;
19+
20+
import static org.junit.jupiter.api.Assertions.assertEquals;
21+
import static org.junit.jupiter.api.Assertions.assertTrue;
2322

2423
/** Demo of 3D parser.
2524
*

app/alarm/datasource/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<artifactId>app-alarm-datasouce</artifactId>
99
<dependencies>
1010
<dependency>
11-
<groupId>junit</groupId>
12-
<artifactId>junit</artifactId>
11+
<groupId>org.junit.jupiter</groupId>
12+
<artifactId>junit-jupiter</artifactId>
1313
<version>${junit.version}</version>
1414
<scope>test</scope>
1515
</dependency>
Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.phoebus.pv.alarm;
22

3-
import org.junit.Test;
3+
import org.junit.jupiter.api.Test;
44

5-
import static org.junit.Assert.assertEquals;
5+
import static org.junit.jupiter.api.Assertions.assertEquals;
66

77
public class AlarmContextTest {
88

@@ -17,9 +17,18 @@ public void testURLEncoding()
1717
String encodedPathWithColon = "OPR/TEST/SR%3Atest%3Apv";
1818
String encodedPathWithDelimiterAndColon = "OPR/TEST/sim%3A%2F%2FSR%3Atest%3Apv";
1919

20-
assertEquals("Failed to encode pv name the delimiter", encodedPathWithDelimiter, AlarmContext.encodedURLPath(pathWithDelimiter));
21-
assertEquals("Failed to encode pv name with colon", encodedPathWithColon, AlarmContext.encodedURLPath(pathWithColon));
22-
assertEquals("Failed to encode pv name with delimiter and colon", encodedPathWithDelimiterAndColon, AlarmContext.encodedURLPath(pathWithDelimiterAndColon));
20+
assertEquals(
21+
encodedPathWithDelimiter,
22+
AlarmContext.encodedURLPath(pathWithDelimiter),
23+
"Failed to encode pv name the delimiter");
24+
assertEquals(
25+
encodedPathWithColon,
26+
AlarmContext.encodedURLPath(pathWithColon),
27+
"Failed to encode pv name with colon");
28+
assertEquals(
29+
encodedPathWithDelimiterAndColon,
30+
AlarmContext.encodedURLPath(pathWithDelimiterAndColon),
31+
"Failed to encode pv name with delimiter and colon");
2332
}
2433

2534
@Test
@@ -33,27 +42,20 @@ public void testURLDecoding()
3342
String encodedPathWithColon = "OPR/TEST/SR%3Atest%3Apv";
3443
String encodedPathWithDelimiterAndColon = "OPR/TEST/sim%3A%2F%2FSR%3Atest%3Apv";
3544

36-
assertEquals("Failed to decode pv name the delimiter", pathWithDelimiter, AlarmContext.decodedURLPath(encodedPathWithDelimiter));
37-
assertEquals("Failed to decode pv name with colon", pathWithColon, AlarmContext.decodedURLPath(encodedPathWithColon));
38-
assertEquals("Failed to decode pv name with delimiter and colon", pathWithDelimiterAndColon, AlarmContext.decodedURLPath(encodedPathWithDelimiterAndColon));
45+
assertEquals(
46+
pathWithDelimiter,
47+
AlarmContext.decodedURLPath(encodedPathWithDelimiter),
48+
"Failed to decode pv name the delimiter");
49+
assertEquals(
50+
pathWithColon,
51+
AlarmContext.decodedURLPath(encodedPathWithColon),
52+
"Failed to decode pv name with colon");
53+
assertEquals(
54+
pathWithDelimiterAndColon,
55+
AlarmContext.decodedURLPath(encodedPathWithDelimiterAndColon),
56+
"Failed to decode pv name with delimiter and colon");
3957
}
4058

41-
// @Test
42-
// public void testKafkaPathEncoding()
43-
// {
44-
// String pathWithDelimiter = "OPR/TEST/sim://test";
45-
// String pathWithColon = "OPR/TEST/SR:test:pv";
46-
// String pathWithDelimiterAndColon = "OPR/TEST/sim://SR:test:pv";
47-
//
48-
// String kafkaPathWithDelimiter = "OPR/TEST/sim:\\/\\/test";
49-
// String kafkaPathWithColon = "OPR/TEST/SR:test:pv";
50-
// String kafkaPathWithDelimiterAndColon = "OPR/TEST/sim:\\/\\/SR:test:pv";
51-
//
52-
// assertEquals("Failed to encode pv kafka path with delimiter", kafkaPathWithDelimiter, AlarmContext.encodedKafkaPath(pathWithDelimiter));
53-
// assertEquals("Failed to encode pv kafka path with colon", kafkaPathWithColon, AlarmContext.encodedKafkaPath(pathWithColon));
54-
// assertEquals("Failed to encode pv kafka path with delimiter and colon", kafkaPathWithDelimiterAndColon, AlarmContext.encodedKafkaPath(pathWithDelimiterAndColon));
55-
// }
56-
5759
@Test
5860
public void testKafkaPathDecoding()
5961
{
@@ -65,8 +67,17 @@ public void testKafkaPathDecoding()
6567
String encodedPathWithColon = "OPR/TEST/SR:test:pv";
6668
String encodedPathWithDelimiterAndColon = "OPR/TEST/sim:\\/\\/SR:test:pv";
6769

68-
assertEquals("Failed to decode pv kafka path the delimiter", pathWithDelimiter, AlarmContext.decodedKafaPath(encodedPathWithDelimiter));
69-
assertEquals("Failed to decode pv kafka path with colon", pathWithColon, AlarmContext.decodedKafaPath(encodedPathWithColon));
70-
assertEquals("Failed to decode pv kafka path with delimiter and colon", pathWithDelimiterAndColon, AlarmContext.decodedKafaPath(encodedPathWithDelimiterAndColon));
70+
assertEquals(
71+
pathWithDelimiter,
72+
AlarmContext.decodedKafaPath(encodedPathWithDelimiter),
73+
"Failed to decode pv kafka path the delimiter");
74+
assertEquals(
75+
pathWithColon,
76+
AlarmContext.decodedKafaPath(encodedPathWithColon),
77+
"Failed to decode pv kafka path with colon");
78+
assertEquals(
79+
pathWithDelimiterAndColon,
80+
AlarmContext.decodedKafaPath(encodedPathWithDelimiterAndColon),
81+
"Failed to decode pv kafka path with delimiter and colon");
7182
}
7283
}
Lines changed: 86 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package org.phoebus.pv.alarm;
22

3-
import org.junit.Test;
3+
import org.junit.jupiter.api.Test;
44

55
import java.util.Optional;
66

7-
import static org.junit.Assert.*;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
88

99
public class AlarmPVInfoTest {
1010

@@ -17,28 +17,36 @@ public class AlarmPVInfoTest {
1717
public void parsePath()
1818
{
1919
AlarmPVInfo alarmPVInfo = AlarmPVInfo.of(onlyRoot);
20-
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
21-
alarmPVInfo.getRoot(), "root");
22-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
23-
alarmPVInfo.getPath(), Optional.empty());
20+
assertEquals(
21+
alarmPVInfo.getRoot(), "root",
22+
"Failed to parse the root info for pv: " + onlyRoot);
23+
assertEquals(
24+
alarmPVInfo.getPath(), Optional.empty(),
25+
"Failed to parse the path info for pv: " + onlyRoot);
2426

2527
alarmPVInfo = AlarmPVInfo.of(oneNode);
26-
assertEquals("Failed to parse the root info for pv: " + oneNode,
27-
alarmPVInfo.getRoot(), "root");
28-
assertEquals("Failed to parse the path info for pv: " + oneNode,
29-
alarmPVInfo.getPath(), Optional.of("/firstNode"));
28+
assertEquals(
29+
alarmPVInfo.getRoot(), "root",
30+
"Failed to parse the root info for pv: " + oneNode);
31+
assertEquals(
32+
alarmPVInfo.getPath(), Optional.of("/firstNode"),
33+
"Failed to parse the path info for pv: " + oneNode);
3034

3135
alarmPVInfo = AlarmPVInfo.of(twoNode);
32-
assertEquals("Failed to parse the root info for pv: " + twoNode,
33-
alarmPVInfo.getRoot(), "root");
34-
assertEquals("Failed to parse the path info for pv: " + twoNode,
35-
alarmPVInfo.getPath(), Optional.of("/firstNode/secondNode"));
36+
assertEquals(
37+
alarmPVInfo.getRoot(), "root",
38+
"Failed to parse the root info for pv: " + twoNode);
39+
assertEquals(
40+
alarmPVInfo.getPath(), Optional.of("/firstNode/secondNode"),
41+
"Failed to parse the path info for pv: " + twoNode);
3642

3743
alarmPVInfo = AlarmPVInfo.of(leaf);
38-
assertEquals("Failed to parse the root info for pv: " + leaf,
39-
alarmPVInfo.getRoot(), "root");
40-
assertEquals("Failed to parse the path info for pv: " + leaf,
41-
alarmPVInfo.getPath(), Optional.of("/firstNode/secondNode/alarmPV"));
44+
assertEquals(
45+
alarmPVInfo.getRoot(), "root",
46+
"Failed to parse the root info for pv: " + leaf);
47+
assertEquals(
48+
alarmPVInfo.getPath(), Optional.of("/firstNode/secondNode/alarmPV"),
49+
"Failed to parse the path info for pv: " + leaf);
4250

4351
}
4452

@@ -50,24 +58,28 @@ public void parsePath()
5058
public void parseCompletePath()
5159
{
5260
AlarmPVInfo alarmPVInfo = AlarmPVInfo.of(onlyRoot);
53-
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
61+
assertEquals(
5462
"/root",
55-
alarmPVInfo.getCompletePath());
63+
alarmPVInfo.getCompletePath(),
64+
"Failed to parse the complete path info for pv: " + onlyRoot);
5665

5766
alarmPVInfo = AlarmPVInfo.of(oneNode);
58-
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
67+
assertEquals(
5968
"/root/firstNode",
60-
alarmPVInfo.getCompletePath());
69+
alarmPVInfo.getCompletePath(),
70+
"Failed to parse the complete path info for pv: " + onlyRoot);
6171

6272
alarmPVInfo = AlarmPVInfo.of(twoNode);
63-
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
73+
assertEquals(
6474
"/root/firstNode/secondNode",
65-
alarmPVInfo.getCompletePath());
75+
alarmPVInfo.getCompletePath(),
76+
"Failed to parse the complete path info for pv: " + onlyRoot);
6677

6778
alarmPVInfo = AlarmPVInfo.of(leaf);
68-
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
79+
assertEquals(
6980
"/root/firstNode/secondNode/alarmPV",
70-
alarmPVInfo.getCompletePath());
81+
alarmPVInfo.getCompletePath(),
82+
"Failed to parse the complete path info for pv: " + onlyRoot);
7183
}
7284

7385
String activeField = "active";
@@ -82,51 +94,67 @@ public void parseCompletePath()
8294
public void parseFields()
8395
{
8496
AlarmPVInfo alarmPVInfo = AlarmPVInfo.of(onlyRoot+"."+activeField);
85-
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
86-
alarmPVInfo.getRoot(), "root");
87-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
88-
alarmPVInfo.getPath(), Optional.empty());
89-
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
97+
assertEquals(
98+
alarmPVInfo.getRoot(), "root",
99+
"Failed to parse the root info for pv: " + onlyRoot);
100+
assertEquals(
101+
alarmPVInfo.getPath(), Optional.empty(),
102+
"Failed to parse the path info for pv: " + onlyRoot);
103+
assertEquals(
90104
"/root",
91-
alarmPVInfo.getCompletePath());
92-
assertEquals("Failed to parse the field path info for pv: " + onlyRoot,
105+
alarmPVInfo.getCompletePath(),
106+
"Failed to parse the complete path info for pv: " + onlyRoot);
107+
assertEquals(
93108
Optional.of(activeField),
94-
alarmPVInfo.getField());
109+
alarmPVInfo.getField(),
110+
"Failed to parse the field path info for pv: " + onlyRoot);
95111

96112
alarmPVInfo = AlarmPVInfo.of(onlyRoot+"."+stateField);
97-
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
98-
alarmPVInfo.getRoot(), "root");
99-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
100-
alarmPVInfo.getPath(), Optional.empty());
101-
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
113+
assertEquals(
114+
alarmPVInfo.getRoot(), "root",
115+
"Failed to parse the root info for pv: " + onlyRoot);
116+
assertEquals(
117+
alarmPVInfo.getPath(), Optional.empty(),
118+
"Failed to parse the path info for pv: " + onlyRoot);
119+
assertEquals(
102120
"/root",
103-
alarmPVInfo.getCompletePath());
104-
assertEquals("Failed to parse the field path info for pv: " + onlyRoot,
121+
alarmPVInfo.getCompletePath(),
122+
"Failed to parse the complete path info for pv: " + onlyRoot);
123+
assertEquals(
105124
Optional.of(stateField),
106-
alarmPVInfo.getField());
125+
alarmPVInfo.getField(),
126+
"Failed to parse the field path info for pv: " + onlyRoot);
107127

108128
alarmPVInfo = AlarmPVInfo.of(onlyRoot+"."+enableField);
109-
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
110-
alarmPVInfo.getRoot(), "root");
111-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
112-
alarmPVInfo.getPath(), Optional.empty());
113-
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
129+
assertEquals(
130+
alarmPVInfo.getRoot(), "root",
131+
"Failed to parse the root info for pv: " + onlyRoot);
132+
assertEquals(
133+
alarmPVInfo.getPath(), Optional.empty(),
134+
"Failed to parse the path info for pv: " + onlyRoot);
135+
assertEquals(
114136
"/root",
115-
alarmPVInfo.getCompletePath());
116-
assertEquals("Failed to parse the field path info for pv: " + onlyRoot,
137+
alarmPVInfo.getCompletePath(),
138+
"Failed to parse the complete path info for pv: " + onlyRoot);
139+
assertEquals(
117140
Optional.of(enableField),
118-
alarmPVInfo.getField());
141+
alarmPVInfo.getField(),
142+
"Failed to parse the field path info for pv: " + onlyRoot);
119143

120144
alarmPVInfo = AlarmPVInfo.of(onlyRoot+"."+durationField);
121-
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
122-
alarmPVInfo.getRoot(), "root");
123-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
124-
alarmPVInfo.getPath(), Optional.empty());
125-
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
145+
assertEquals(
146+
alarmPVInfo.getRoot(), "root",
147+
"Failed to parse the root info for pv: " + onlyRoot);
148+
assertEquals(
149+
alarmPVInfo.getPath(), Optional.empty(),
150+
"Failed to parse the path info for pv: " + onlyRoot);
151+
assertEquals(
126152
"/root",
127-
alarmPVInfo.getCompletePath());
128-
assertEquals("Failed to parse the field path info for pv: " + onlyRoot,
153+
alarmPVInfo.getCompletePath(),
154+
"Failed to parse the complete path info for pv: " + onlyRoot);
155+
assertEquals(
129156
Optional.of(durationField),
130-
alarmPVInfo.getField());
157+
alarmPVInfo.getField(),
158+
"Failed to parse the field path info for pv: " + onlyRoot);
131159
}
132160
}

app/alarm/model/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<artifactId>app-alarm-model</artifactId>
99
<dependencies>
1010
<dependency>
11-
<groupId>junit</groupId>
12-
<artifactId>junit</artifactId>
11+
<groupId>org.junit.jupiter</groupId>
12+
<artifactId>junit-jupiter</artifactId>
1313
<version>${junit.version}</version>
1414
<scope>test</scope>
1515
</dependency>

app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmClientModelDemo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
*******************************************************************************/
88
package org.phoebus.applications.alarm;
99

10-
import java.util.concurrent.TimeUnit;
11-
12-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1311
import org.phoebus.applications.alarm.client.AlarmClient;
1412
import org.phoebus.applications.alarm.client.AlarmClientListener;
1513
import org.phoebus.applications.alarm.model.AlarmTreeItem;
1614
import org.phoebus.applications.alarm.model.print.ModelPrinter;
1715

16+
import java.util.concurrent.TimeUnit;
17+
1818
/** Demo of the {@link AlarmClient}
1919
* @author Kay Kasemir
2020
*/

app/alarm/model/src/test/java/org/phoebus/applications/alarm/AlarmConfigProducerDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import org.apache.kafka.clients.producer.ProducerRecord;
1919
import org.apache.kafka.common.serialization.Serializer;
2020
import org.apache.kafka.common.serialization.StringSerializer;
21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222
import org.phoebus.applications.alarm.client.AlarmClientLeaf;
2323
import org.phoebus.applications.alarm.client.AlarmClientNode;
2424
import org.phoebus.applications.alarm.model.AlarmTreeItem;

0 commit comments

Comments
 (0)