### Question:
DefaultCellSTSReqValidator implements CellSTSRequestValidator { @Override public void validate(CellStsRequest cellStsRequest) throws CellSTSRequestValidationFailedException { String subject = cellStsRequest.getRequestHeaders().get(Constants.CELLERY_AUTH_SUBJECT_HEADER); if (StringUtils.isNotBlank(subject)) { throw new CellSTSRequestValidationFailedException("A subject header is found in the inbound request," + " before security validation: " + subject); } } DefaultCellSTSReqValidator(); @Override void validate(CellStsRequest cellStsRequest); @Override boolean isAuthenticationRequired(CellStsRequest cellStsRequest);  }### Answer:
@Test(expectedExceptions = CellSTSRequestValidationFailedException.class) public void testValidate() throws Exception { CellStsRequest.CellStsRequestBuilder cellStsRequestBuilder = new CellStsRequest.CellStsRequestBuilder(); HashMap headers = new HashMap(); headers.put(Constants.CELLERY_AUTH_SUBJECT_HEADER, "Alice"); cellStsRequestBuilder.setRequestHeaders(headers); defaultCellSTSReqValidator.validate(cellStsRequestBuilder.build()); }
@Test public void testValidateWithException() throws Exception { CellStsRequest.CellStsRequestBuilder cellStsRequestBuilder = new CellStsRequest.CellStsRequestBuilder(); HashMap headers = new HashMap(); cellStsRequestBuilder.setRequestHeaders(headers); defaultCellSTSReqValidator.validate(cellStsRequestBuilder.build()); }