HttpJsonCallContext implements ApiCallContext { @Override public HttpJsonCallContext withCredentials(Credentials newCredentials) { return new HttpJsonCallContext( this.channel, this.timeout, this.deadline, newCredentials, this.extraHeaders, this.tracer); } private  HttpJsonCallContext(
      HttpJsonChannel channel,
      Duration timeout,
      Instant deadline,
      Credentials credentials,
      ImmutableMap<String, List<String>> extraHeaders,
      ApiTracer tracer); static HttpJsonCallContext createDefault(); @Override HttpJsonCallContext nullToSelf(ApiCallContext inputContext); @Override HttpJsonCallContext merge(ApiCallContext inputCallContext); @Override HttpJsonCallContext withCredentials(Credentials newCredentials); @Override HttpJsonCallContext withTransportChannel(TransportChannel inputChannel); @Override HttpJsonCallContext withTimeout(Duration timeout); @Nullable @Override Duration getTimeout(); @Override ApiCallContext withStreamWaitTimeout(@Nonnull Duration streamWaitTimeout); @Nullable @Override Duration getStreamWaitTimeout(); @Override ApiCallContext withStreamIdleTimeout(@Nonnull Duration streamIdleTimeout); @Nullable @Override Duration getStreamIdleTimeout(); @BetaApi("The surface for extra headers is not stable yet and may change in the future.") @Override ApiCallContext withExtraHeaders(Map<String, List<String>> extraHeaders); @BetaApi("The surface for extra headers is not stable yet and may change in the future.") @Override Map<String, List<String>> getExtraHeaders(); HttpJsonChannel getChannel(); Instant getDeadline(); Credentials getCredentials(); HttpJsonCallContext withChannel(HttpJsonChannel newChannel); HttpJsonCallContext withDeadline(Instant newDeadline); @Nonnull @Override ApiTracer getTracer(); @Override HttpJsonCallContext withTracer(@Nonnull ApiTracer newTracer); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testWithCredentials() { Credentials credentials = Mockito.mock(Credentials.class); HttpJsonCallContext emptyContext = HttpJsonCallContext.createDefault(); Truth.assertThat(emptyContext.getCredentials()).isNull(); HttpJsonCallContext context = emptyContext.withCredentials(credentials); Truth.assertThat(context.getCredentials()).isNotNull(); }