SearchIndexServiceImpl implements SearchIndexService { protected SearchIndexStatistics createSearchIndexStatistics(Settings settings, DocsStats docsStats, long indexCount) { SearchIndexStatistics searchIndexStatistics = new SearchIndexStatistics(); Long creationDate = settings.getAsLong(IndexMetadata.SETTING_CREATION_DATE, -1L); if (creationDate != -1L) { DateTime creationDateTime = new DateTime(creationDate, DateTimeZone.UTC); searchIndexStatistics.setIndexCreationDate(HerdDateUtils.getXMLGregorianCalendarValue(creationDateTime.toDate())); } searchIndexStatistics.setIndexNumberOfActiveDocuments(docsStats.getCount()); searchIndexStatistics.setIndexNumberOfDeletedDocuments(docsStats.getDeleted()); searchIndexStatistics.setIndexUuid(settings.get(IndexMetadata.SETTING_INDEX_UUID)); searchIndexStatistics.setIndexCount(indexCount); return searchIndexStatistics; }  @Override SearchIndex createSearchIndex(SearchIndexCreateRequest request); @Override SearchIndex deleteSearchIndex(SearchIndexKey searchIndexKey); @Override SearchIndex getSearchIndex(SearchIndexKey searchIndexKey); @Override SearchIndexKeys getSearchIndexes();  }
@Test public void testCreateSearchIndexStatisticsNoIndexCreationDate() { ImmutableOpenMap<String, Settings> getIndexResponseSettings = ImmutableOpenMap.<String, Settings>builder() .fPut(SEARCH_INDEX_NAME, Settings.builder().put(IndexMetadata.SETTING_INDEX_UUID, SEARCH_INDEX_STATISTICS_INDEX_UUID).build()).build(); DocsStats mockedDocsStats = mock(DocsStats.class); when(mockedDocsStats.getCount()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS); when(mockedDocsStats.getDeleted()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS); SearchIndexStatistics response = searchIndexServiceImpl.createSearchIndexStatistics(getIndexResponseSettings.get(SEARCH_INDEX_NAME), mockedDocsStats, 0L); verifyNoMoreInteractions(alternateKeyHelper, businessObjectDefinitionDao, businessObjectDefinitionHelper, configurationDaoHelper, configurationHelper, searchIndexDao, searchIndexDaoHelper, searchIndexHelperService, searchIndexStatusDaoHelper, searchIndexTypeDaoHelper); assertEquals(new SearchIndexStatistics(NO_SEARCH_INDEX_STATISTICS_CREATION_DATE, SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS, SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS, SEARCH_INDEX_STATISTICS_INDEX_UUID, 0L), response); }