### Question:
AbstractEdgeGridRequestSigner { public void sign(RequestT request, MutableRequestT requestToUpdate) throws RequestSigningException { Request req = map(request); ClientCredential credential; try { credential = clientCredentialProvider.getClientCredential(req); } catch (NoMatchingCredentialException e) { throw e; } if (credential == null) { throw new NoMatchingCredentialException(); } String newHost = credential.getHost(); URI originalUri = Objects.requireNonNull(requestUri(request), "Request-URI cannot be null"); URI newUri = withNewHost(originalUri, newHost); setHost(requestToUpdate, newHost, newUri); String authorization = edgeGridSigner.getSignature(req, credential); setAuthorization(requestToUpdate, authorization); } AbstractEdgeGridRequestSigner(ClientCredential clientCredential);  AbstractEdgeGridRequestSigner(ClientCredentialProvider clientCredentialProvider); final ClientCredentialProvider getClientCredentialProvider(); void sign(RequestT request, MutableRequestT requestToUpdate);  }### Answer:
@Test(expectedExceptions = NoMatchingCredentialException.class) public void shouldTerminateSigningForMissingCredential() throws RequestSigningException { AbstractEdgeGridRequestSigner mockedSigner = mockedSigner(new ClientCredentialProvider() { @Override public ClientCredential getClientCredential(Request request) throws NoMatchingCredentialException { throw new NoMatchingCredentialException(); } }); mockedSigner.sign(new Object(), new Object()); }
@Test(expectedExceptions = NoMatchingCredentialException.class) public void shouldTerminateSigningForNullCredential() throws RequestSigningException { AbstractEdgeGridRequestSigner mockedSigner = mockedSigner(new ClientCredentialProvider() { @Override public ClientCredential getClientCredential(Request request) throws NoMatchingCredentialException { return null; } }); mockedSigner.sign(new Object(), new Object()); }
@Test public void shouldNotTerminateSigningForValidCredentialAndRequest() throws RequestSigningException { AbstractEdgeGridRequestSigner mockedSigner = mockedSigner(new ClientCredentialProvider() { @Override public ClientCredential getClientCredential(Request request) throws NoMatchingCredentialException { return ClientCredential.builder() .accessToken("accessToken") .clientSecret("clientSecret") .clientToken("clientToken") .host("host") .build(); } }); mockedSigner.sign(new Object(), new Object()); }