private void checkLog(Log log, long expectedSegmentCapacity, List<LogSegmentName> expectedSegmentNames) {
    LogSegment nextSegment = log.getFirstSegment();
    assertNull("Prev segment should be null", log.getPrevSegment(nextSegment));
    for (LogSegmentName segmentName : expectedSegmentNames) {
      assertNotNull(
          "Next segment is null -  expectedSegmentNames=" + expectedSegmentNames + ". Expected next=" + segmentName,
          nextSegment);
      assertEquals("Next segment is not as expected - expectedSegmentNames=" + expectedSegmentNames, segmentName,
          nextSegment.getName());
      LogSegment segment = log.getSegment(segmentName);
      assertEquals("Segment name is not as expected - expectedSegmentNames=" + expectedSegmentNames, segmentName,
          segment.getName());
      assertEquals("Segment capacity not as expected", expectedSegmentCapacity, segment.getCapacityInBytes());
      assertEquals("Segment returned by getSegment() is incorrect", segment, log.getSegment(segment.getName()));
      nextSegment = log.getNextSegment(segment);
      if (nextSegment != null) {
        assertEquals("Prev segment not as expected - expectedSegmentNames=" + expectedSegmentNames, segment,
            log.getPrevSegment(nextSegment));
      }
    }
    assertNull(
        "Next segment should be null - expectedSegmentNames=" + expectedSegmentNames + ", nextSegment=" + nextSegment,
        nextSegment);
    assertEquals("Unexpected result for isLogSegmented()", log.getCapacityInBytes() != expectedSegmentCapacity,
        log.isLogSegmented());
    long expectedUnallocatedSegments =
        (log.getCapacityInBytes() / expectedSegmentCapacity) - expectedSegmentNames.size();
    assertEquals("DiskSpaceRequirements has wrong number of unallocated segments", expectedUnallocatedSegments,
        log.getRemainingUnallocatedSegments());
  }
Checks the log to ensure segment names, capacities and count.
@param log the {@link Log} instance to check.
@param expectedSegmentCapacity the expected capacity of each segment.
@param expectedSegmentNames the expected names of all segments that should have been created in the {@code log}.
ambry-store/src/test/java/com/github/ambry/store/LogTest.java