### Question:
IndexingManager { public UserRegistry getRegistry(int tenantId) { if (tenantId == MultitenantConstants.SUPER_TENANT_ID) { return registry; } else { try { return Utils.getRegistryService().getRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME, tenantId); } catch (RegistryException ignore) { return null; } } } private  IndexingManager(); static IndexingManager getInstance(); synchronized void startIndexing(); synchronized void restartIndexing(); synchronized void stopIndexing(); long getStartingDelayInSecs(); boolean canIndex(String path); long getIndexingFreqInSecs(); String getLastAccessTimeLocation(); long getBatchSize(); int getIndexerPoolSize(); boolean isCacheSkipped(); void deleteFromIndex(String oldPath, int tenantId); void submitFileForIndexing(int tenantID, String tenantDomain, String path,
            String sourceURL); Indexer getIndexerForMediaType(String mimeType); UserRegistry getRegistry(int tenantId); Date getLastAccessTime(int tenantId); void setLastAccessTime(int tenantId, Date lastAccessTime);  }### Answer:
@Test public void testGetRegistry() throws RegistryException { UserRegistry userRegistry = mock(UserRegistry.class); RegistryService registryService = mock(RegistryService.class); when(registryService.getRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME)).thenReturn(userRegistry); when(registryService.getRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME, 10)).thenReturn (userRegistry); when(registryService.getRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME, -1)).thenThrow(new RegistryException("Invalid Tenant ID")); Utils.setRegistryService(registryService); IndexingManager manager = IndexingManager.getInstance(); assertNotNull(manager.getRegistry(-1234)); assertNotNull(manager.getRegistry(10)); assertNull(manager.getRegistry(-1)); }