public void test_canonicalizingCache(){
  final Properties properties=getProperties();
  properties.setProperty(AbstractTransactionService.Options.MIN_RELEASE_AGE,"5000");
  final Journal journal=new Journal(properties);
  try {
    final long commitTime0=journal.commit();
    assertTrue(commitTime0 != 0L);
    final ICommitRecord commitRecord0=journal.getCommitRecord(commitTime0);
    assertEquals(commitRecord0,journal.getCommitRecord());
    journal.write(ByteBuffer.wrap(new byte[]{1,2,3}));
    final long commitTime1=journal.commit();
    assertTrue(commitTime1 != 0L);
    final ICommitRecord commitRecord1=journal.getCommitRecord(commitTime1);
    assertEquals(commitRecord1,journal.getCommitRecord());
    assertTrue(commitRecord0 == journal.getCommitRecord(commitTime1 - 1));
    assertTrue(commitRecord1 == journal.getCommitRecord(commitTime1 + 0));
    assertTrue(commitRecord1 == journal.getCommitRecord(commitTime1 + 1));
  }
  finally {
    journal.destroy();
  }
}

public void test_canonicalizingCache ( ) { final Properties properties = getProperties ( ) ; properties . setProperty ( AbstractTransactionService . Options . MIN_RELEASE_AGE , "5000" ) ; final Journal journal = new Journal ( properties ) ; try { final long commitTime0 = journal . commit ( ) ; assertTrue ( commitTime0 != 0L ) ; final ICommitRecord commitRecord0 = journal . getCommitRecord ( commitTime0 ) ; assertEquals ( commitRecord0 , journal . getCommitRecord ( ) ) ; journal . write ( ByteBuffer . wrap ( new byte [ ] { 1 , 2 , 3 } ) ) ; final long commitTime1 = journal . commit ( ) ; assertTrue ( commitTime1 != 0L ) ; final ICommitRecord commitRecord1 = journal . getCommitRecord ( commitTime1 ) ; assertEquals ( commitRecord1 , journal . getCommitRecord ( ) ) ; assertTrue ( commitRecord0 == journal . getCommitRecord ( commitTime1 - 1 ) ) ; assertTrue ( commitRecord1 == journal . getCommitRecord ( commitTime1 + 0 ) ) ; assertTrue ( commitRecord1 == journal . getCommitRecord ( commitTime1 + 1 ) ) ; } finally { journal . destroy ( ) ; } }
test verifies that exact match and find always return the same reference for the same commit record ( at least as long as the test holds a hard reference to the commit record of interest ) .
