@Test void getParametersMapWithNullValue() { DecoratorConfiguration config = mock(DecoratorConfiguration.class); DecoratorParameters params1 = mock(DecoratorParameters.class, Mockito.RETURNS_DEEP_STUBS); DecoratorParameters params2 = mock(DecoratorParameters.class, Mockito.RETURNS_DEEP_STUBS); when(config.getDecoratorParameters()).thenReturn(Stream.of(params1, params2)); when(params1.getParameters()).thenReturn("{attr: 'test'}"); when(params2.getParameters()).thenReturn(null); when(params1.getDecorator().getId()).thenReturn("dec1"); when(params2.getDecorator().getId()).thenReturn("dec2"); Map<String, Map<String, Object>> expected = of("dec1", of("attr", "test"), "dec2", emptyMap()); Map<String, Map<String, Object>> parameterMap = registry.getParameterMap(config); assertEquals(expected, parameterMap); }
Map<String, Map<String, Object>> getParameterMap(DecoratorConfiguration configuration) { return configuration .getDecoratorParameters() .collect( toMap( param -> param.getDecorator().getId(), param -> jsonToMap(param.getParameters()))); }
DynamicRepositoryDecoratorRegistryImpl implements DynamicRepositoryDecoratorRegistry { Map<String, Map<String, Object>> getParameterMap(DecoratorConfiguration configuration) { return configuration .getDecoratorParameters() .collect( toMap( param -> param.getDecorator().getId(), param -> jsonToMap(param.getParameters()))); } }
DynamicRepositoryDecoratorRegistryImpl implements DynamicRepositoryDecoratorRegistry { Map<String, Map<String, Object>> getParameterMap(DecoratorConfiguration configuration) { return configuration .getDecoratorParameters() .collect( toMap( param -> param.getDecorator().getId(), param -> jsonToMap(param.getParameters()))); } DynamicRepositoryDecoratorRegistryImpl(DataService dataService, Gson gson); }
DynamicRepositoryDecoratorRegistryImpl implements DynamicRepositoryDecoratorRegistry { Map<String, Map<String, Object>> getParameterMap(DecoratorConfiguration configuration) { return configuration .getDecoratorParameters() .collect( toMap( param -> param.getDecorator().getId(), param -> jsonToMap(param.getParameters()))); } 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 { Map<String, Map<String, Object>> getParameterMap(DecoratorConfiguration configuration) { return configuration .getDecoratorParameters() .collect( toMap( param -> param.getDecorator().getId(), param -> jsonToMap(param.getParameters()))); } 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);  }