public void setAuthenticationPolicy(AuthenticationPolicy authenticationPolicy) {
        this.authenticationPolicy = authenticationPolicy;
    }
@Test
    public void testSetAuthenticationPolicy() {
        AuthenticationPolicy policy = new AuthenticationPolicy() {
            @Override
            public void customizeSubject(Subject.Builder subjectBuilder, ConnectionReference ref) {
                //To change body of implemented methods use File | Settings | File Templates.
            }

            @Override
            public boolean isAuthenticationRequired(SubjectConnectionReference ref) {
                return false;  //To change body of implemented methods use File | Settings | File Templates.
            }
        };
        factory.setAuthenticationPolicy(policy);
        assertSame(policy, factory.getAuthenticationPolicy());
    }