@Test
  public void testGetLogSegmentMetadataFilesAfterAddingNewLogSegments() throws StoreException, IOException {
    if (!this.isLogSegmented) {
      // This test is only applicable when the log is segmented
      return;
    }
    // Arrange
    final BlobStore blobStore = createAndStartBlobStore();

    long totalLogSegments = LOG_CAPACITY / SEGMENT_CAPACITY;
    LogSegment loadedSegment = getLogSegment(LogSegmentName.fromPositionAndGeneration(totalLogSegments, 0),
        SEGMENT_CAPACITY, true);
    List<LogSegment> segmentsToLoad = Collections.singletonList(loadedSegment);

    final Log log = new Log(tempDir.getAbsolutePath(), LOG_CAPACITY, StoreTestUtils.DEFAULT_DISK_SPACE_ALLOCATOR,
        createStoreConfig(SEGMENT_CAPACITY, true),
        null, true, segmentsToLoad, Collections.EMPTY_LIST.iterator(), null);
    blobStore.setLog(log);

    for (int i = 1; i < totalLogSegments; i++) {
      LogSegmentName segmentName = LogSegmentName.fromPositionAndGeneration(i, 0);
      LogSegment segment = getLogSegment(segmentName, SEGMENT_CAPACITY, true);
      blobStore.getLog().addSegment(segment, true);

      Path indexFilePath = Paths.get(blobStore.getDataDir() + "/" + segment.getName() + "_index");
      Files.copy(Paths.get(tempDir + "/0_0_18_index"), indexFilePath);

      Path bloomFilePath = Paths.get(blobStore.getDataDir() + "/" + segment.getName() + "_bloom");
      Files.copy(Paths.get(tempDir + "/0_0_18_bloom"), bloomFilePath);
    }

    // Act
    final List<LogInfo> storeLogInfos = blobStore.getLogSegmentMetadataFiles(true);

    // Assert
    assertEquals("Expecting " + totalLogSegments + " log segments", totalLogSegments, storeLogInfos.size());

    for (int i = 0; i < totalLogSegments - 1; i++) {
      LogSegmentName segmentName = LogSegmentName.fromPositionAndGeneration(i + 1, 0);
      assertEquals("Expecting the name of log segment = " + segmentName,
          segmentName.toString(), storeLogInfos.get(i).getLogSegment().getFileName());

      assertEquals("Expecting 1 index file for log segment =" + segmentName,
          1, storeLogInfos.get(i).getIndexSegments().size());
      assertEquals("Expecting name of index file for log segment =" + segmentName,
          segmentName + "_index", storeLogInfos.get(i).getIndexSegments().get(0).getFileName());

      assertEquals("Expecting 1 bloom file for log segment =" + segmentName,
          1, storeLogInfos.get(i).getBloomFilters().size());
      assertEquals("Expecting name of bloom file for log segment =" + segmentName,
          segmentName + "_bloom", storeLogInfos.get(i).getBloomFilters().get(0).getFileName());
    }
  }
Test {@link BlobStore#getLogSegmentMetadataFiles} for a store by adding new log segments.
@throws StoreException
@throws IOException
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java