Closed draugrmorar closed 2 years ago
I found answer on my question! Thank you for your work.
May be for somebody it will be useful:
stubFor(unaryMethod(UserGrpc.getCreateUserMethod())
.willReturn(new ExceptionResponseActionBuilderImpl(
new StatusRuntimeException(Status.INVALID_ARGUMENT, getErrorMetadata(111, "Error")
)))
);
@Radnaeva there's a method to return any expection: https://github.com/Fadelis/grpcmock/blob/2ffbbbca6d8e030a0da15218e90d3ca21ef38d80/grpcmock-core/src/main/java/org/grpcmock/GrpcMock.java#L318
Doesn't work with StatusRuntimeException! Our Grpc Service throw StatusRuntimeException. I tried your GrpcMock and i can't to throw exception from stubFor. I saw that i can return Status, but not Exception. Please, help me) May be in your library it is impossible?