### Question:
AbstractJwtHandler extends AbstractGrantHandler { protected void validateSignature(JwsHeaders headers, String unsignedText, byte[] signature) { JwsSignatureVerifier theSigVerifier = getInitializedSigVerifier(headers); if (!theSigVerifier.verify(headers, unsignedText, signature)) { throw new OAuthServiceException(OAuthConstants.INVALID_GRANT); } } protected  AbstractJwtHandler(List<String> grants); void setSupportedIssuers(Set<String> supportedIssuers); void setJwsVerifier(JwsSignatureVerifier jwsVerifier); int getTtl(); void setTtl(int ttl); int getClockOffset(); void setClockOffset(int clockOffset); String getAudience(); void setAudience(String audience);  }### Answer:
@Test public void testValidateSignatureWithValidSignature() { expect(signatureVerifier.verify(headers, UNSIGNED_TEXT, SIGNATURE)).andReturn(true); replay(signatureVerifier); handler.validateSignature(headers, UNSIGNED_TEXT, SIGNATURE); verify(signatureVerifier); }
@Test public void testValidateSignatureWithInvalidSignature() { expect(signatureVerifier.verify(headers, UNSIGNED_TEXT, SIGNATURE)).andReturn(false); replay(signatureVerifier); try { handler.validateSignature(headers, UNSIGNED_TEXT, SIGNATURE); fail("OAuthServiceException expected"); } catch (OAuthServiceException expected) { } verify(signatureVerifier); }