CognitoIdentitySecurityContextFactory extends AbstractSecurityContextFactory { @Override protected boolean isValid() { return getIdentitySafe().getCognitoIdentityId() != null; } protected  CognitoIdentitySecurityContextFactory(GatewayRequest request);   }
@Test public void isValid_NoCognitoIdentityIdGiven_ShouldNotBeValid() { GatewayRequest request = createRequestMock("cognitoAuthenticationType", null, null, null, null, null, null, null); assertFalse(createSecurityContextFactory(request).isValid()); }
@Test public void isValid_CognitoIdentityIdGiven_ShouldBeValid() { GatewayRequest request = createRequestMock("cognitoAuthenticationType", "cognitoIdentityId", null, null, null, null, null, null); assertTrue(createSecurityContextFactory(request).isValid()); }