### Question:
JwtClaimSubject implements EntitlementSubject { @Override public SubjectDecision evaluate(final String realm, final SubjectAttributesManager mgr, final Subject subject, final String resourceName, final Map<String, Set<String>> environment) throws EntitlementException { final Set<JwtPrincipal> jwts = subject.getPrincipals(JwtPrincipal.class); if (jwts.isEmpty()) { DEBUG.message("No JWT principal in subject"); return new SubjectDecision(false, NO_ADVICE); } final JwtPrincipal jwt = jwts.iterator().next(); final String value = jwt.getClaim(claimName); final boolean match = StringUtils.equals(claimValue, value); return new SubjectDecision(match, NO_ADVICE); }  @Override void setState(final String state); @Override String getState(); @Override Map<String, Set<String>> getSearchIndexAttributes(); @Override Set<String> getRequiredAttributeNames(); @Override SubjectDecision evaluate(final String realm, final SubjectAttributesManager mgr, final Subject subject,
                                    final String resourceName, final Map<String, Set<String>> environment); @Override boolean isIdentity(); void setClaimName(String claim); String getClaimName(); void setClaimValue(String value); String getClaimValue(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void shouldDenyIfJwtPrincipalNotPresent() throws Exception { final Subject subject = new Subject(); final SubjectDecision result = testSubject.evaluate(null, null, subject, null, null); assertThat(result.isSatisfied()).isFalse(); }
@Test public void shouldDenyIfClaimIsMissing() throws Exception { final Subject subject = getTestSubject("wibble", "badger"); final SubjectDecision result = testSubject.evaluate(null, null, subject, null, null); assertThat(result.isSatisfied()).isFalse(); }
@Test public void shouldDenyIfClaimDoesNotMatch() throws Exception { final Subject subject = getTestSubject(CLAIM, "badger"); final SubjectDecision result = testSubject.evaluate(null, null, subject, null, null); assertThat(result.isSatisfied()).isFalse(); }
@Test public void shouldAllowIfClaimDoesMatch() throws Exception { final Subject subject = getTestSubject(CLAIM, VALUE); final SubjectDecision result = testSubject.evaluate(null, null, subject, null, null); assertThat(result.isSatisfied()).isTrue(); }