GlobalConfiguration gc = new GlobalConfigurationBuilder().build();
Set<String> cachesSet = new HashSet<>();
EmbeddedCacheManager cm = mock(EmbeddedCacheManager.class);
GlobalComponentRegistry gcr = new GlobalComponentRegistry(gc, cm, cachesSet);
gcr.registerComponent(timeService, TimeService.class);
ComponentRegistry registry = new ComponentRegistry(cacheName, configuration, cache, gcr,
configuration.getClass().getClassLoader());
when(cache.getName()).thenReturn(cacheName);
when(cache.getAdvancedCache()).thenReturn(cache);