mardi 31 mai 2016

How to unit test grpc-java server implementation functions?

I have an implementation of GRPC-java server code, but I didn't find the example code to unit test the StreamObserver. Does anyone know the right way to unit test the function?

public class RpcTrackDataServiceImpl implements TrackDataServiceGrpc.TrackDataService {

  @Override
  public void getTracks(
  GetTracksRequest request,
  StreamObserver<GetTracksResponse> responseObserver) {
GetTracksResponse reply = GetTracksResponse.newBuilder()
    .addTracks(TrackInfo.newBuilder()
        .setOwner("test")
        .setTrackName("test").build())
    .build();
responseObserver.onNext(reply);
responseObserver.onCompleted();
  }
}

Aucun commentaire:

Enregistrer un commentaire