Skip to content

Commit 83dd8ea

Browse files
committed
More of the same: migration to Junit5
1 parent 9f87c08 commit 83dd8ea

File tree

165 files changed

+1170
-1164
lines changed

Some content is hidden

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

165 files changed

+1170
-1164
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
*******************************************************************************/
88
package org.phoebus.app.viewer3d;
99

10-
import static org.junit.Assert.assertEquals;
11-
import static org.junit.Assert.assertTrue;
10+
import static org.junit.jupiter.api.Assertions.*;
1211

1312
import java.io.ByteArrayInputStream;
1413

15-
import org.junit.Test;
14+
import org.junit.jupiter.api.Test;
1615
import org.phoebus.applications.viewer3d.Viewer3d;
1716
import org.phoebus.applications.viewer3d.Xform;
1817

app/alarm/datasource/src/test/java/org/phoebus/pv/alarm/AlarmContextTest.java

Lines changed: 2 additions & 18 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.*;
66

77
public class AlarmContextTest {
88

@@ -38,22 +38,6 @@ public void testURLDecoding()
3838
assertEquals("Failed to decode pv name with delimiter and colon", pathWithDelimiterAndColon, AlarmContext.decodedURLPath(encodedPathWithDelimiterAndColon));
3939
}
4040

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-
5741
@Test
5842
public void testKafkaPathDecoding()
5943
{

app/alarm/datasource/src/test/java/org/phoebus/pv/alarm/AlarmPVInfoTest.java

Lines changed: 38 additions & 26 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.*;
88

99
public class AlarmPVInfoTest {
1010

@@ -19,26 +19,30 @@ public void parsePath()
1919
AlarmPVInfo alarmPVInfo = AlarmPVInfo.of(onlyRoot);
2020
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
2121
alarmPVInfo.getRoot(), "root");
22-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
23-
alarmPVInfo.getPath(), Optional.empty());
22+
assertEquals(
23+
alarmPVInfo.getPath(), Optional.empty(),
24+
"Failed to parse the path info for pv: " + onlyRoot);
2425

2526
alarmPVInfo = AlarmPVInfo.of(oneNode);
2627
assertEquals("Failed to parse the root info for pv: " + oneNode,
2728
alarmPVInfo.getRoot(), "root");
28-
assertEquals("Failed to parse the path info for pv: " + oneNode,
29-
alarmPVInfo.getPath(), Optional.of("/firstNode"));
29+
assertEquals(
30+
alarmPVInfo.getPath(), Optional.of("/firstNode"),
31+
"Failed to parse the path info for pv: " + oneNode);
3032

3133
alarmPVInfo = AlarmPVInfo.of(twoNode);
3234
assertEquals("Failed to parse the root info for pv: " + twoNode,
3335
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.getPath(), Optional.of("/firstNode/secondNode"),
38+
"Failed to parse the path info for pv: " + twoNode);
3639

3740
alarmPVInfo = AlarmPVInfo.of(leaf);
3841
assertEquals("Failed to parse the root info for pv: " + leaf,
3942
alarmPVInfo.getRoot(), "root");
40-
assertEquals("Failed to parse the path info for pv: " + leaf,
41-
alarmPVInfo.getPath(), Optional.of("/firstNode/secondNode/alarmPV"));
43+
assertEquals(
44+
alarmPVInfo.getPath(), Optional.of("/firstNode/secondNode/alarmPV"),
45+
"Failed to parse the path info for pv: " + leaf);
4246

4347
}
4448

@@ -84,49 +88,57 @@ public void parseFields()
8488
AlarmPVInfo alarmPVInfo = AlarmPVInfo.of(onlyRoot+"."+activeField);
8589
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
8690
alarmPVInfo.getRoot(), "root");
87-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
88-
alarmPVInfo.getPath(), Optional.empty());
91+
assertEquals(
92+
alarmPVInfo.getPath(), Optional.empty(),
93+
"Failed to parse the path info for pv: " + onlyRoot);
8994
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
9095
"/root",
9196
alarmPVInfo.getCompletePath());
92-
assertEquals("Failed to parse the field path info for pv: " + onlyRoot,
97+
assertEquals(
9398
Optional.of(activeField),
94-
alarmPVInfo.getField());
99+
alarmPVInfo.getField(),
100+
"Failed to parse the field path info for pv: " + onlyRoot);
95101

96102
alarmPVInfo = AlarmPVInfo.of(onlyRoot+"."+stateField);
97103
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
98104
alarmPVInfo.getRoot(), "root");
99-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
100-
alarmPVInfo.getPath(), Optional.empty());
105+
assertEquals(
106+
alarmPVInfo.getPath(), Optional.empty(),
107+
"Failed to parse the path info for pv: " + onlyRoot);
101108
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
102109
"/root",
103110
alarmPVInfo.getCompletePath());
104-
assertEquals("Failed to parse the field path info for pv: " + onlyRoot,
111+
assertEquals(
105112
Optional.of(stateField),
106-
alarmPVInfo.getField());
113+
alarmPVInfo.getField(),
114+
"Failed to parse the field path info for pv: " + onlyRoot);
107115

108116
alarmPVInfo = AlarmPVInfo.of(onlyRoot+"."+enableField);
109117
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
110118
alarmPVInfo.getRoot(), "root");
111-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
112-
alarmPVInfo.getPath(), Optional.empty());
119+
assertEquals(
120+
alarmPVInfo.getPath(), Optional.empty(),
121+
"Failed to parse the path info for pv: " + onlyRoot);
113122
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
114123
"/root",
115124
alarmPVInfo.getCompletePath());
116-
assertEquals("Failed to parse the field path info for pv: " + onlyRoot,
125+
assertEquals(
117126
Optional.of(enableField),
118-
alarmPVInfo.getField());
127+
alarmPVInfo.getField(),
128+
"Failed to parse the field path info for pv: " + onlyRoot);
119129

120130
alarmPVInfo = AlarmPVInfo.of(onlyRoot+"."+durationField);
121131
assertEquals("Failed to parse the root info for pv: " + onlyRoot,
122132
alarmPVInfo.getRoot(), "root");
123-
assertEquals("Failed to parse the path info for pv: " + onlyRoot,
124-
alarmPVInfo.getPath(), Optional.empty());
133+
assertEquals(
134+
alarmPVInfo.getPath(), Optional.empty(),
135+
"Failed to parse the path info for pv: " + onlyRoot);
125136
assertEquals("Failed to parse the complete path info for pv: " + onlyRoot,
126137
"/root",
127138
alarmPVInfo.getCompletePath());
128-
assertEquals("Failed to parse the field path info for pv: " + onlyRoot,
139+
assertEquals(
129140
Optional.of(durationField),
130-
alarmPVInfo.getField());
141+
alarmPVInfo.getField(),
142+
"Failed to parse the field path info for pv: " + onlyRoot);
131143
}
132144
}

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;

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

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

10-
import static org.junit.Assert.assertEquals;
11-
import static org.junit.Assert.assertTrue;
12-
13-
import java.io.ByteArrayInputStream;
14-
import java.io.InputStream;
15-
import java.util.List;
16-
import java.time.LocalDateTime;
17-
18-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1911
import org.phoebus.applications.alarm.client.AlarmClientNode;
2012
import org.phoebus.applications.alarm.model.AlarmTreeItem;
2113
import org.phoebus.applications.alarm.model.AlarmTreeLeaf;
2214
import org.phoebus.applications.alarm.model.TitleDetail;
2315
import org.phoebus.applications.alarm.model.TitleDetailDelay;
2416
import org.phoebus.applications.alarm.model.xml.XmlModelReader;
2517

18+
import java.io.ByteArrayInputStream;
19+
import java.io.InputStream;
20+
import java.time.LocalDateTime;
21+
import java.util.List;
22+
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertFalse;
25+
import static org.junit.jupiter.api.Assertions.assertTrue;
26+
2627
/** JUnit test of {@link XmlModelReader}
2728
* @author Evan Smith
2829
*/
@@ -179,7 +180,7 @@ public void testAlarmModelReader() throws Exception
179180

180181
assertEquals("a2pv1", ((AlarmTreeItem<?>) a2pv1).getName());
181182
assertEquals("a2pv1 description", a2pv1.getDescription());
182-
assertTrue( ! a2pv1.isEnabled() );
183+
assertFalse(a2pv1.isEnabled());
183184
assertTrue(a2pv1.isLatching());
184185
assertTrue(a2pv1.isAnnunciating());
185186

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import java.io.ByteArrayOutputStream;
1111

12-
import org.junit.Test;
12+
import org.junit.jupiter.api.Test;
1313
import org.phoebus.applications.alarm.client.AlarmClient;
1414
import org.phoebus.applications.alarm.client.AlarmConfigMonitor;
1515
import org.phoebus.applications.alarm.model.xml.XmlModelWriter;

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

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

10-
import static org.junit.Assert.assertEquals;
11-
import static org.junit.Assert.assertTrue;
12-
13-
import java.io.ByteArrayOutputStream;
14-
import java.util.ArrayList;
15-
import java.util.List;
16-
17-
import org.junit.Test;
10+
import org.junit.jupiter.api.Test;
1811
import org.phoebus.applications.alarm.client.AlarmClientLeaf;
1912
import org.phoebus.applications.alarm.client.AlarmClientNode;
2013
import org.phoebus.applications.alarm.model.TitleDetail;
2114
import org.phoebus.applications.alarm.model.TitleDetailDelay;
2215
import org.phoebus.applications.alarm.model.xml.XmlModelWriter;
2316

17+
import java.io.ByteArrayOutputStream;
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
21+
import static org.junit.jupiter.api.Assertions.assertEquals;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
23+
2424
/** JUnit test of {@link XmlModelWriter}
2525
* @author Evan Smith
2626
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.phoebus.applications.alarm;
22

3-
import org.junit.Test;
3+
44
import java.io.IOException;
55
import org.phoebus.applications.alarm.model.EnabledState;
66
import org.phoebus.applications.alarm.messages.EnabledDeserializer;

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

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

10-
import static org.hamcrest.CoreMatchers.equalTo;
11-
import static org.junit.Assert.assertThat;
10+
import org.junit.jupiter.api.Test;
1211

1312
import java.util.concurrent.Executors;
1413
import java.util.concurrent.ScheduledExecutorService;
1514
import java.util.concurrent.TimeUnit;
1615

17-
import org.junit.Test;
16+
import static org.hamcrest.CoreMatchers.equalTo;
17+
import static org.hamcrest.MatcherAssert.assertThat;
18+
1819

1920
/** JUnit test of the {@link ResettableTimeout}
2021
* @author Kay Kasemir
@@ -23,7 +24,7 @@
2324
public class ResettableTimeoutTest
2425
{
2526
@Test
26-
public void testTimer() throws Exception
27+
public void testTimer()
2728
{
2829
System.out.println("Check for no timeout ...");
2930
ResettableTimeout timer = new ResettableTimeout(5);
@@ -40,7 +41,7 @@ public void testTimer() throws Exception
4041
}
4142

4243
@Test
43-
public void testReset() throws Exception
44+
public void testReset()
4445
{
4546
System.out.println("Timeout in 4 secs?");
4647
final ResettableTimeout timer = new ResettableTimeout(4);

0 commit comments

Comments
 (0)