@Test public void writeNewReadExisting() throws IOException { io.write("checkpoint.head", 1, 2, 3, 4, 5); Checkpoint checkpoint = io.read("checkpoint.head"); assertThat(checkpoint.getPageNum(), is(equalTo(1))); assertThat(checkpoint.getFirstUnackedPageNum(), is(equalTo(2))); assertThat(checkpoint.getFirstUnackedSeqNum(), is(equalTo(3L))); assertThat(checkpoint.getMinSeqNum(), is(equalTo(4L))); assertThat(checkpoint.getElementCount(), is(equalTo(5))); }
@Test public void readInnexisting() throws IOException { Checkpoint checkpoint = io.read("checkpoint.invalid"); assertThat(checkpoint, is(equalTo(null))); }