### Question:
SubjectCredentialsResolver implements CredentialsResolver { @Override public Credentials getCredentials() { String header = headers.getHeaderString(ACT_USER_ID_HEADER); if (StringUtils.isBlank(header) || parseUserID(header) == -1) { return null; } return SubjectCredentials.builder() .setSubjectID(parseUserID(header)) .build(); } @Inject  SubjectCredentialsResolver(HttpHeaders headers); @Override Credentials getCredentials();  }### Answer:
@Test public void testActUserIdIsSetInRequestHeader() { when(httpHeaders.getHeaderString("ACT-User-ID")).thenReturn("1"); RequestHeader rh = resolver.getRequestHeader(); assertNotNull(rh.getCredentials()); assertTrue(rh.getCredentials() instanceof SubjectCredentials); assertEquals(1, ((SubjectCredentials) rh.getCredentials()).getSubjectID()); }
@Test public void testActUserIdOmittedHeader() { assertNull(resolver.getRequestHeader().getCredentials()); }
@Test public void testActUserIdOmitsNegativeId() { when(httpHeaders.getHeaderString("ACT-User-ID")).thenReturn("-1"); assertNull(resolver.getRequestHeader().getCredentials()); }