@Test void testGetFactory() { DynamicRepositoryDecoratorFactory factory = mock(DynamicRepositoryDecoratorFactory.class); when(factory.getId()).thenReturn("test"); registry.addFactory(factory); DynamicRepositoryDecoratorFactory returnedFactory = registry.getFactory("test"); assertEquals(factory, returnedFactory); }
@Override public DynamicRepositoryDecoratorFactory getFactory(String id) { if (!factories.containsKey(id)) { throw new IllegalArgumentException(format("Decorator [%s] does not exist", id)); } return factories.get(id); }
DynamicRepositoryDecoratorRegistryImpl implements DynamicRepositoryDecoratorRegistry { @Override public DynamicRepositoryDecoratorFactory getFactory(String id) { if (!factories.containsKey(id)) { throw new IllegalArgumentException(format("Decorator [%s] does not exist", id)); } return factories.get(id); } }
DynamicRepositoryDecoratorRegistryImpl implements DynamicRepositoryDecoratorRegistry { @Override public DynamicRepositoryDecoratorFactory getFactory(String id) { if (!factories.containsKey(id)) { throw new IllegalArgumentException(format("Decorator [%s] does not exist", id)); } return factories.get(id); } DynamicRepositoryDecoratorRegistryImpl(DataService dataService, Gson gson); }
DynamicRepositoryDecoratorRegistryImpl implements DynamicRepositoryDecoratorRegistry { @Override public DynamicRepositoryDecoratorFactory getFactory(String id) { if (!factories.containsKey(id)) { throw new IllegalArgumentException(format("Decorator [%s] does not exist", id)); } return factories.get(id); } DynamicRepositoryDecoratorRegistryImpl(DataService dataService, Gson gson); @Override synchronized void addFactory(DynamicRepositoryDecoratorFactory factory); @Override Stream<String> getFactoryIds(); @Override DynamicRepositoryDecoratorFactory getFactory(String id); @Override synchronized Repository<Entity> decorate(Repository<Entity> repository); @EventListener void onApplicationEvent(BootstrappingEvent bootstrappingEvent); }
DynamicRepositoryDecoratorRegistryImpl implements DynamicRepositoryDecoratorRegistry { @Override public DynamicRepositoryDecoratorFactory getFactory(String id) { if (!factories.containsKey(id)) { throw new IllegalArgumentException(format("Decorator [%s] does not exist", id)); } return factories.get(id); } DynamicRepositoryDecoratorRegistryImpl(DataService dataService, Gson gson); @Override synchronized void addFactory(DynamicRepositoryDecoratorFactory factory); @Override Stream<String> getFactoryIds(); @Override DynamicRepositoryDecoratorFactory getFactory(String id); @Override synchronized Repository<Entity> decorate(Repository<Entity> repository); @EventListener void onApplicationEvent(BootstrappingEvent bootstrappingEvent);  }