@Test
public void testCheckExpiredSlicedMessageState() throws IOException {

    doReturn(1).when(mockInputStream).read(any(byte[].class));
    final int expiryDuration = 200;
    try (MessageSlicer slicer = MessageSlicer.builder().messageSliceSize(1)
            .logContext("testCheckExpiredSlicedMessageState")
            .fileBackedStreamFactory(mockFiledBackedStreamFactory)
            .expireStateAfterInactivity(expiryDuration, TimeUnit.MILLISECONDS).build()) {
        slice(slicer, IDENTIFIER, new BytesMessage(new byte[]{1, 2}), testProbe.ref(), testProbe.ref(),
                mockOnFailureCallback);
        Uninterruptibles.sleepUninterruptibly(expiryDuration + 50, TimeUnit.MILLISECONDS);
        slicer.checkExpiredSlicedMessageState();
        assertFailureCallback(RuntimeException.class);
        verify(mockFiledBackedStream).cleanup();
    }
}