### Question:
EPPolicyTemplateProviderRegistryImpl implements EPPolicyTemplateProviderRegistry { @Override public ObjectRegistration<EPPolicyTemplateProvider> registerTemplateProvider(final EPPolicyTemplateProvider templateProvider) { distributeTemplateProvider(templateProvider); return new AbstractObjectRegistration<EPPolicyTemplateProvider>(templateProvider) { @Override protected void removeRegistration() { distributeTemplateProvider(null); } }; }  @Override ObjectRegistration<EPPolicyTemplateProvider> registerTemplateProvider(final EPPolicyTemplateProvider templateProvider); @Override void addDistributionTarget(final TemplateProviderDistributionTarget<EPPolicyTemplateProvider> templateProviderDistributionTarget); @Override void close();  }### Answer:
@Test public void testRegisterTemplateProvider() throws Exception { registry.addDistributionTarget(target1); final ObjectRegistration<EPPolicyTemplateProvider> registration = registry.registerTemplateProvider(templateProvider); Mockito.verify(target1).setTemplateProvider(templateProvider); registry.addDistributionTarget(target2); Mockito.verify(target2).setTemplateProvider(templateProvider); registration.close(); Mockito.verify(target1).setTemplateProvider(null); Mockito.verify(target2).setTemplateProvider(null); registry.addDistributionTarget(target3); Mockito.verifyNoMoreInteractions(target1, target2, target3); }