Skip to content

Commit 167a3e0

Browse files
author
jvmlet
committed
proper assertion
1 parent 76322a0 commit 167a3e0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

grpc-spring-boot-starter-demo/src/test/java/org/lognet/springboot/grpc/GreeterAppTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.lognet.springboot.grpc;
22

3-
import static org.junit.Assert.assertEquals;
3+
import static org.junit.Assert.*;
44
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT;
55

66
import java.util.concurrent.ExecutionException;
@@ -44,13 +44,12 @@ public void tearDown() {
4444

4545
@Test
4646
public void simpleGreeting() throws ExecutionException, InterruptedException {
47-
47+
String name = "John";
4848
final GreeterGrpc.GreeterFutureStub greeterFutureStub = GreeterGrpc.newFutureStub(channel);
49-
final GreeterOuterClass.HelloRequest
50-
helloRequest =
51-
GreeterOuterClass.HelloRequest.newBuilder().setName("John").build();
49+
final GreeterOuterClass.HelloRequest helloRequest =GreeterOuterClass.HelloRequest.newBuilder().setName(name).build();
5250
final String reply = greeterFutureStub.sayHello(helloRequest).get().getMessage();
53-
assertEquals("Hello John", reply);
51+
assertNotNull(reply);
52+
assertTrue(String.format("Replay should contain name '%s'",name),reply.contains(name));
5453
}
5554

5655
@Test

0 commit comments

Comments
 (0)