@Test
public void recreateExistingFsCheckpoint() throws IOException {

    FileSystem fsMock = mock(FileSystem.class);
    Path returnedPath = new Path("testPath");
    when(fsMock.exists(returnedPath)).thenReturn(true);
    FsBasedCheckpointer cptr = new FsBasedCheckpointer(fsMock, (ignored, alsoIgnored) -> returnedPath);
    Assert.assertFalse(cptr.tryCheckpoint(1, Instant.MIN));
    // Don't use the same cache, to make sure FS is invoked for file existence
    FsBasedCheckpointer otherCptr = new FsBasedCheckpointer(fsMock, (ignored, alsoIgnored) -> returnedPath);
    Assert.assertFalse(otherCptr.tryCheckpoint(1, Instant.MIN));
    verify(fsMock, times(2)).exists(returnedPath);
}