### Question:
IndexingManager { public synchronized void startIndexing() { stopIndexing(); if (registryConfig.IsStartIndexing()) { submittingExecutor = Executors.newSingleThreadScheduledExecutor(); submittingExecutor.scheduleWithFixedDelay(new ResourceSubmitter(this), getStartingDelayInSecs(), getIndexingFreqInSecs(), TimeUnit.SECONDS); indexingExecutor = Executors.newSingleThreadScheduledExecutor(); indexingExecutor.scheduleWithFixedDelay(indexer, getStartingDelayInSecs(), getIndexingFreqInSecs(), TimeUnit.SECONDS); readLastAccessTime(); } } 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 testStartIndexing() throws RegistryException { Long lastAccessTime = Calendar.getInstance().getTimeInMillis(); UserRegistry userRegistry = mock(UserRegistry.class); ResourceImpl resource = new ResourceImpl(); resource.setPath(lastAccessPath); resource.setCreatedTime(Calendar.getInstance().getTime()); resource.setProperty("12", String.valueOf(lastAccessTime)); resource.setProperty("-1234", String.valueOf(lastAccessTime)); resource.setProperty("2", String.valueOf(lastAccessTime)); when(userRegistry.get(lastAccessPath)).thenReturn(resource); doNothing().when(userRegistry).delete(lastAccessPath); RegistryService registryService = mock(RegistryService.class); when(userRegistry.resourceExists(lastAccessPath)).thenReturn(true); when(registryService.getRegistry(CarbonConstants.REGISTRY_SYSTEM_USERNAME)).thenReturn(userRegistry); Utils.setRegistryService(registryService); IndexingManager manager = IndexingManager.getInstance(); manager.startIndexing(); assertEquals(new Date(lastAccessTime), manager.getLastAccessTime(12)); }