Skip to content

Commit 77c1a7f

Browse files
committed
Added tests
1 parent 806fb6d commit 77c1a7f

4 files changed

Lines changed: 147 additions & 22 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.ros2.rcljava.tool;
2+
3+
import static org.junit.Assert.*;
4+
5+
import org.junit.Test;
6+
7+
import org.ros2.rcljava.tool.Ros2Nodes;
8+
9+
public class TestRos2Nodes {
10+
11+
@Test
12+
public final void testNodes() throws InterruptedException {
13+
Ros2Nodes.main(new String[]{});
14+
assertEquals(true, true);
15+
}
16+
17+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.ros2.rcljava.tool;
2+
3+
import static org.junit.Assert.*;
4+
5+
import org.junit.Test;
6+
7+
import org.ros2.rcljava.tool.Ros2Param;
8+
9+
public class TestRos2Param {
10+
11+
@Test
12+
public final void testEmpty() throws InterruptedException {
13+
Ros2Param.main(new String[]{});
14+
assertEquals(true, true);
15+
}
16+
17+
@Test
18+
public final void testBadCommand() throws InterruptedException {
19+
Ros2Param.main(new String[]{"foo"});
20+
assertEquals(true, true);
21+
}
22+
23+
@Test
24+
public final void testList() throws InterruptedException {
25+
Ros2Param.main(new String[]{"list"});
26+
assertEquals(true, true);
27+
}
28+
29+
30+
@Test
31+
public final void testType() throws InterruptedException {
32+
Ros2Param.main(new String[]{"get"});
33+
assertEquals(true, true);
34+
}
35+
36+
@Test
37+
public final void testInfo() throws InterruptedException {
38+
Ros2Param.main(new String[]{"set"});
39+
assertEquals(true, true);
40+
}
41+
42+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.ros2.rcljava.tool;
2+
3+
import static org.junit.Assert.*;
4+
5+
import org.junit.Test;
6+
7+
import org.ros2.rcljava.tool.Ros2Services;
8+
9+
public class TestRos2Services {
10+
11+
@Test
12+
public final void testEmpty() throws InterruptedException {
13+
Ros2Services.main(new String[]{});
14+
assertEquals(true, true);
15+
}
16+
17+
@Test
18+
public final void testBadCommand() throws InterruptedException {
19+
Ros2Services.main(new String[]{"foo"});
20+
assertEquals(true, true);
21+
}
22+
23+
@Test
24+
public final void testFind() throws InterruptedException {
25+
Ros2Services.main(new String[]{"find"});
26+
Ros2Services.main(new String[]{"find", "rcl_interfaces/ListParameters"});
27+
assertEquals(true, true);
28+
}
29+
30+
@Test
31+
public final void testList() throws InterruptedException {
32+
Ros2Services.main(new String[]{"list"});
33+
assertEquals(true, true);
34+
}
35+
36+
37+
@Test
38+
public final void testType() throws InterruptedException {
39+
Ros2Services.main(new String[]{"type"});
40+
Ros2Services.main(new String[]{"type", "/ros2services/_list_parameters"});
41+
assertEquals(true, true);
42+
}
43+
44+
@Test
45+
public final void testInfo() throws InterruptedException {
46+
Ros2Services.main(new String[]{"info"});
47+
assertEquals(true, true);
48+
}
49+
50+
@Test
51+
public final void testBw() throws InterruptedException {
52+
Ros2Services.main(new String[]{"req"});
53+
Ros2Services.main(new String[]{"req", "/ros2services/_list_parameters"});
54+
Ros2Services.main(new String[]{"req", "/ros2services/_list_parameters", "rcl_interfaces/ListParameters"});
55+
assertEquals(true, true);
56+
}
57+
58+
}

rcljava_utils/src/test/java/com/ros2/rcljava/tool/TestRos2Topics.java

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,21 @@
22

33
import static org.junit.Assert.*;
44

5-
import org.junit.After;
6-
import org.junit.AfterClass;
7-
import org.junit.Before;
8-
import org.junit.BeforeClass;
9-
import org.junit.Ignore;
105
import org.junit.Test;
6+
117
import org.ros2.rcljava.tool.Ros2Topics;
128

139
public class TestRos2Topics {
1410

15-
@BeforeClass
16-
public static void setUpBeforeClass() throws Exception {
17-
}
18-
19-
@AfterClass
20-
public static void tearDownAfterClass() throws Exception {
21-
}
22-
23-
@Before
24-
public void setUp() throws Exception {
25-
}
26-
27-
@After
28-
public void tearDown() throws Exception {
11+
@Test
12+
public final void testEmpty() throws InterruptedException {
13+
Ros2Topics.main(new String[]{});
14+
assertEquals(true, true);
2915
}
3016

3117
@Test
32-
@Ignore
33-
public final void testFullUsage() throws InterruptedException {
34-
Ros2Topics.main(new String[]{});
18+
public final void testBadCommand() throws InterruptedException {
19+
Ros2Topics.main(new String[]{"foo"});
3520
assertEquals(true, true);
3621
}
3722

@@ -44,6 +29,7 @@ public final void testEcho() throws InterruptedException {
4429
@Test
4530
public final void testFind() throws InterruptedException {
4631
Ros2Topics.main(new String[]{"find"});
32+
Ros2Topics.main(new String[]{"find", "std_msgs/String"});
4733
assertEquals(true, true);
4834
}
4935

@@ -62,12 +48,34 @@ public final void testList() throws InterruptedException {
6248
@Test
6349
public final void testPub() throws InterruptedException {
6450
Ros2Topics.main(new String[]{"pub"});
51+
Ros2Topics.main(new String[]{"pub", "/rosout"});
52+
Ros2Topics.main(new String[]{"pub", "/rosout", "std_msgs/String"});
53+
Ros2Topics.main(new String[]{"pub", "/rosout", "std_msgs/String", "iii", "-1"});
6554
assertEquals(true, true);
6655
}
6756

6857
@Test
6958
public final void testType() throws InterruptedException {
7059
Ros2Topics.main(new String[]{"type"});
60+
Ros2Topics.main(new String[]{"type", "/rosout"});
61+
assertEquals(true, true);
62+
}
63+
64+
@Test
65+
public final void testInfo() throws InterruptedException {
66+
Ros2Topics.main(new String[]{"info"});
67+
assertEquals(true, true);
68+
}
69+
70+
@Test
71+
public final void testBw() throws InterruptedException {
72+
Ros2Topics.main(new String[]{"bw"});
73+
assertEquals(true, true);
74+
}
75+
76+
@Test
77+
public final void testDelay() throws InterruptedException {
78+
Ros2Topics.main(new String[]{"delay"});
7179
assertEquals(true, true);
7280
}
7381

0 commit comments

Comments
 (0)