@Test
  public void testResolveReplicaSealStatusFromLogSize() {
    PersistentIndex mockPersistentIndex = mock(PersistentIndex.class);
    MockReplicaId replicaId = (MockReplicaId) store.getReplicaId();
    StoreConfig config = new StoreConfig(new VerifiableProperties(new Properties()));
    store.index = mockPersistentIndex;
    // When store has usage higher than StoreConfig#storeReadOnlyEnableSizeThresholdPercentage
    // then replica seal status should be resolved as ReplicaSealStatus#Sealed.
    replicaId.setSealedState(ReplicaSealStatus.NOT_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storeReadOnlyEnableSizeThresholdPercentage)/100 + 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.SEALED);

    replicaId.setSealedState(ReplicaSealStatus.PARTIALLY_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storeReadOnlyEnableSizeThresholdPercentage)/100 + 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.SEALED);

    replicaId.setSealedState(ReplicaSealStatus.SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storeReadOnlyEnableSizeThresholdPercentage)/100 + 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.SEALED);

    // When store has usage is less than StoreConfig#storeReadOnlyEnableSizeThresholdPercentage but more than
    // StoreConfig#storeReadOnlyToPartialWriteEnableSizeThresholdPercentageDelta and replicas status is
    // ReplicaSealStatus#UNSEALED then replica seal status should be resolved as ReplicaSealStatus#PartiallySealed.
    replicaId.setSealedState(ReplicaSealStatus.NOT_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storeReadOnlyEnableSizeThresholdPercentage)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.PARTIALLY_SEALED);

    // When store has usage is less than StoreConfig#storeReadOnlyEnableSizeThresholdPercentage but more than
    // StoreConfig#storeReadOnlyToPartialWriteEnableSizeThresholdPercentageDelta and replicas status is
    // ReplicaSealStatus#PARTIALLY_SELAED then replica seal status should be resolved as ReplicaSealStatus#PartiallySealed.
    replicaId.setSealedState(ReplicaSealStatus.PARTIALLY_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storeReadOnlyEnableSizeThresholdPercentage)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.PARTIALLY_SEALED);

    // When store has usage is less than StoreConfig#storeReadOnlyEnableSizeThresholdPercentage but more than
    // StoreConfig#storeReadOnlyToPartialWriteEnableSizeThresholdPercentageDelta and replicas status is
    // ReplicaSealStatus#SEALED then replica seal status should be resolved as ReplicaSealStatus#PartiallySealed.
    replicaId.setSealedState(ReplicaSealStatus.SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storeReadOnlyEnableSizeThresholdPercentage)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.SEALED);

    // When store has usage is greater than StoreConfig#storePartialWriteEnableSizeThresholdPercentage but less than
    // StoreConfig#storeReadOnlyEnableSizeThresholdPercentage and replicas status is
    // ReplicaSealStatus#SEALED then replica seal status should be resolved as ReplicaSealStatus#PartiallySealed.
    replicaId.setSealedState(ReplicaSealStatus.NOT_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storePartialWriteEnableSizeThresholdPercentage)/100 + 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.PARTIALLY_SEALED);

    // When store has usage is greater than StoreConfig#storePartialWriteEnableSizeThresholdPercentage but less than
    // StoreConfig#storeReadOnlyEnableSizeThresholdPercentage and replicas status is
    // ReplicaSealStatus#PARTIALLY_SEALED then replica seal status should be resolved as ReplicaSealStatus#PARTIALLY_SEALED.
    replicaId.setSealedState(ReplicaSealStatus.PARTIALLY_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storePartialWriteEnableSizeThresholdPercentage)/100 + 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.PARTIALLY_SEALED);

    // When store has usage is greater than StoreConfig#storePartialWriteEnableSizeThresholdPercentage but less than
    // StoreConfig#storeReadOnlyEnableSizeThresholdPercentage and replicas status is
    // ReplicaSealStatus#PARTIALLY_SEALED then replica seal status should be resolved as ReplicaSealStatus#PARTIALLY_SEALED.
    replicaId.setSealedState(ReplicaSealStatus.SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storePartialWriteEnableSizeThresholdPercentage)/100 + 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.PARTIALLY_SEALED);

    replicaId.setSealedState(ReplicaSealStatus.NOT_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storePartialWriteEnableSizeThresholdPercentage)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.NOT_SEALED);

    replicaId.setSealedState(ReplicaSealStatus.PARTIALLY_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storePartialWriteEnableSizeThresholdPercentage)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.PARTIALLY_SEALED);

    replicaId.setSealedState(ReplicaSealStatus.SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * config.storePartialWriteEnableSizeThresholdPercentage)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.NOT_SEALED);

    long readWritePercentageLimit = config.storePartialWriteEnableSizeThresholdPercentage - config.storePartialWriteToReadWriteEnableSizeThresholdPercentageDelta;
    replicaId.setSealedState(ReplicaSealStatus.NOT_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * readWritePercentageLimit)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.NOT_SEALED);

    replicaId.setSealedState(ReplicaSealStatus.PARTIALLY_SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * readWritePercentageLimit)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.NOT_SEALED);

    replicaId.setSealedState(ReplicaSealStatus.SEALED);
    when(mockPersistentIndex.getLogUsedCapacity()).thenReturn(
        (LOG_CAPACITY * readWritePercentageLimit)/100 - 1);
    assertEquals(store.resolveReplicaSealStatusFromLogSize(), ReplicaSealStatus.NOT_SEALED);
  }
Test sealing logic in {@link BlobStore#resolveReplicaSealStatusFromLogSize()}.
ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java