@Test
public void failedItemIsStoredIfBothKeyAndFailedItemAreNotNull() throws IOException {

    // given
    String fileName = createTempFile().getAbsolutePath();
    ChronicleMap<CharSequence, ItemSource> failedItems = createDefaultTestChronicleMap();
    ChronicleMapRetryFailoverPolicy.Builder builder =
            createDefaultTestFailoverPolicyBuilder(fileName, failedItems);
    ChronicleMapRetryFailoverPolicy failoverPolicy = builder.build();
    ItemSource<Object> failedItemSource = mock(FailedItemSource.class);
    String expectedKey = UUID.randomUUID().toString();
    // when
    boolean result = failoverPolicy.tryPut(expectedKey, failedItemSource);
    // then
    assertTrue(result);
    verify(failedItems).put(eq(expectedKey), eq(failedItemSource));
}