### Question:
GrpcClient { public FetchEligibleCampaignsResponse fetchEligibleCampaigns(FetchEligibleCampaignsRequest req) { return stub.withDeadlineAfter(30000, TimeUnit.MILLISECONDS).fetchEligibleCampaigns(req); } @Inject  GrpcClient(InAppMessagingSdkServingBlockingStub stub); FetchEligibleCampaignsResponse fetchEligibleCampaigns(FetchEligibleCampaignsRequest req);  }### Answer:
@Test public void testFetchEligibleCampaignsSuccess() { grpcServerRule .getServiceRegistry() .addService(new FakeFetchService(r -> assertEquals(fetchEligibleCampaignsRequest, r))); assertEquals( testFetchEligibleCampaignsResponse, grpcClient.fetchEligibleCampaigns(fetchEligibleCampaignsRequest)); }
@Test public void testFetchEligibleCampaignsFailure() { grpcServerRule .getServiceRegistry() .addService( new FakeFetchService( r -> { throw new RuntimeException("any exception"); })); assertThrows( StatusRuntimeException.class, () -> grpcClient.fetchEligibleCampaigns(fetchEligibleCampaignsRequest)); }