@Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "Extending service can not be null") public void testPolicyCreationNoExtender() { ContextAwarePolicyAdapter.createPolicy(new KeyBasedVerificationPolicy(), Mockito.mock(PublicationsHandler.class), null); }
public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) { if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){ throw new IllegalArgumentException("Unsupported verification policy."); } Util.notNull(handler, "Publications handler"); Util.notNull(extendingService, "Extending service"); return new ContextAwarePolicyAdapter(policy, new PolicyContext(handler, extendingService)); }
ContextAwarePolicyAdapter implements ContextAwarePolicy { public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) { if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){ throw new IllegalArgumentException("Unsupported verification policy."); } Util.notNull(handler, "Publications handler"); Util.notNull(extendingService, "Extending service"); return new ContextAwarePolicyAdapter(policy, new PolicyContext(handler, extendingService)); } }
ContextAwarePolicyAdapter implements ContextAwarePolicy { public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) { if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){ throw new IllegalArgumentException("Unsupported verification policy."); } Util.notNull(handler, "Publications handler"); Util.notNull(extendingService, "Extending service"); return new ContextAwarePolicyAdapter(policy, new PolicyContext(handler, extendingService)); } private  ContextAwarePolicyAdapter(Policy policy, PolicyContext context); }
ContextAwarePolicyAdapter implements ContextAwarePolicy { public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) { if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){ throw new IllegalArgumentException("Unsupported verification policy."); } Util.notNull(handler, "Publications handler"); Util.notNull(extendingService, "Extending service"); return new ContextAwarePolicyAdapter(policy, new PolicyContext(handler, extendingService)); } private  ContextAwarePolicyAdapter(Policy policy, PolicyContext context); static ContextAwarePolicy createInternalPolicy(); static ContextAwarePolicy createKeyPolicy(PublicationsHandler handler); static ContextAwarePolicy createPublicationsFilePolicy(PublicationsHandler handler); static ContextAwarePolicy createPublicationsFilePolicy(PublicationsHandler handler, Extender extender); static ContextAwarePolicy createCalendarPolicy(Extender extender); static ContextAwarePolicy createUserProvidedPublicationPolicy(PublicationData publicationData); static ContextAwarePolicy createUserProvidedPublicationPolicy(PublicationData publicationData, Extender extender); static ContextAwarePolicy createDefaultPolicy(PublicationsHandler handler, Extender extender); static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService); PolicyContext getPolicyContext(); List<Rule> getRules(); String getName(); String getType(); Policy getFallbackPolicy(); void setFallbackPolicy(Policy fallbackPolicy); }
ContextAwarePolicyAdapter implements ContextAwarePolicy { public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) { if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){ throw new IllegalArgumentException("Unsupported verification policy."); } Util.notNull(handler, "Publications handler"); Util.notNull(extendingService, "Extending service"); return new ContextAwarePolicyAdapter(policy, new PolicyContext(handler, extendingService)); } private  ContextAwarePolicyAdapter(Policy policy, PolicyContext context); static ContextAwarePolicy createInternalPolicy(); static ContextAwarePolicy createKeyPolicy(PublicationsHandler handler); static ContextAwarePolicy createPublicationsFilePolicy(PublicationsHandler handler); static ContextAwarePolicy createPublicationsFilePolicy(PublicationsHandler handler, Extender extender); static ContextAwarePolicy createCalendarPolicy(Extender extender); static ContextAwarePolicy createUserProvidedPublicationPolicy(PublicationData publicationData); static ContextAwarePolicy createUserProvidedPublicationPolicy(PublicationData publicationData, Extender extender); static ContextAwarePolicy createDefaultPolicy(PublicationsHandler handler, Extender extender); static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService); PolicyContext getPolicyContext(); List<Rule> getRules(); String getName(); String getType(); Policy getFallbackPolicy(); void setFallbackPolicy(Policy fallbackPolicy);  }