Skip to content

Commit d15062f

Browse files
committed
EchoJsonRpcServiceTest: direct test of EchoJsonRpcService in Java
1 parent 32b8ded commit d15062f

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2014-2026 ConsensusJ Developers.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.consensusj.jsonrpc.services;
17+
18+
import org.consensusj.jsonrpc.JsonRpcShutdownService;
19+
import org.junit.jupiter.api.AfterEach;
20+
import org.junit.jupiter.api.Disabled;
21+
import org.junit.jupiter.api.Test;
22+
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
25+
/**
26+
* Test a {@link EchoJsonRpcService} instance.
27+
*/
28+
public class EchoJsonRpcServiceTest {
29+
final EchoJsonRpcService service = new EchoJsonRpcService(new JsonRpcShutdownService.NoopShutdownService());;
30+
31+
@AfterEach
32+
void cleanUp() {
33+
service.close();
34+
}
35+
36+
@Test
37+
void testEcho() {
38+
String hello = service.echo("hello").join();
39+
assertEquals("hello", hello);
40+
41+
}
42+
43+
@Test
44+
void testHelpSummary() {
45+
String help = service.help(/* null */).join();
46+
assertEquals("echo message\nhelp\nstop\n", help);
47+
}
48+
49+
@Test
50+
@Disabled
51+
void testHelpDetail() {
52+
String help = service.help(/* "help" */).join();
53+
assertEquals("help help", help);
54+
}
55+
}

0 commit comments

Comments
 (0)