### Question:
DefaultWorkloadApiClient implements WorkloadApiClient { @Override public JwtSvid validateJwtSvid(@NonNull final String token, @NonNull final String audience) throws JwtSvidException { val request = createJwtSvidRequest(token, audience); Workload.ValidateJWTSVIDResponse response; try (val cancellableContext = Context.current().withCancellation()) { response = cancellableContext.call(() -> workloadApiBlockingStub.validateJWTSVID(request)); } catch (Exception e) { throw new JwtSvidException("Error validating JWT SVID", e); } if (response == null || StringUtils.isBlank(response.getSpiffeId())) { throw new JwtSvidException("Error validating JWT SVID. Empty response from Workload API"); } return JwtSvid.parseInsecure(token, Collections.singleton(audience)); } private  DefaultWorkloadApiClient(final SpiffeWorkloadAPIStub workloadApiAsyncStub,
                                     final SpiffeWorkloadAPIBlockingStub workloadApiBlockingStub,
                                     final ManagedChannelWrapper managedChannel,
                                     final ExponentialBackoffPolicy exponentialBackoffPolicy,
                                     final ScheduledExecutorService retryExecutor,
                                     final ExecutorService executorService);   DefaultWorkloadApiClient(final SpiffeWorkloadAPIStub workloadApiAsyncStub,
                             final SpiffeWorkloadAPIBlockingStub workloadApiBlockingStub,
                             final ManagedChannelWrapper managedChannel,
                             final ExponentialBackoffPolicy backoffPolicy); static WorkloadApiClient newClient(); static WorkloadApiClient newClient(@NonNull final ClientOptions options); @Override X509Context fetchX509Context(); @Override void watchX509Context(@NonNull final Watcher<X509Context> watcher); @Override JwtSvid fetchJwtSvid(@NonNull String audience, String... extraAudience); @Override JwtSvid fetchJwtSvid(@NonNull final SpiffeId subject,
                                @NonNull final String audience,
                                final String... extraAudience); @Override JwtBundleSet fetchJwtBundles(); @Override JwtSvid validateJwtSvid(@NonNull final String token, @NonNull final String audience); @Override void watchJwtBundles(@NonNull final Watcher<JwtBundleSet> watcher); @Override void close();  }### Answer:
@Test void testValidateJwtSvid() { String token = generateToken("spiffe: try { JwtSvid jwtSvid = workloadApiClient.validateJwtSvid(token, "aud1"); assertNotNull(jwtSvid); assertEquals(SpiffeId.parse("spiffe: assertTrue(jwtSvid.getAudience().contains("aud1")); assertEquals(1, jwtSvid.getAudience().size()); } catch (JwtSvidException e) { fail(e); } }
@Test void testValidateJwtSvid_nullToken() { try { JwtSvid jwtSvid = workloadApiClient.validateJwtSvid(null, "aud1"); } catch (NullPointerException e) { assertEquals("token is marked non-null but is null", e.getMessage()); } catch (JwtSvidException e) { fail(); } }
@Test void testValidateJwtSvid_nullAudience() { try { JwtSvid jwtSvid = workloadApiClient.validateJwtSvid("token", null); } catch (NullPointerException e) { assertEquals("audience is marked non-null but is null", e.getMessage()); } catch (JwtSvidException e) { fail(); } }