@Test
public void testEnsurePresent()
    throws IOException,
           InterruptedException,
           DeadlockException,
           TransactionRolledBackException
{

    Database db = new DisklessTestDatabase(FACTORY);
    OrderedMap map = db.createMap(MAP_NAME, RecordFactory.simpleRecordFactory(TestKey.class, TestRecord.class));
    for (int i = 0; i < N; i++) {
        map.ensurePresent(TestRecord.createRecord(i, "first"));
    }
    for (int i = 0; i < N; i++) {
        map.ensurePresent(TestRecord.createRecord(i, "second"));
    }
    Cursor cursor = map.first();
    TestRecord record;
    int expected = 0;
    while ((record = (TestRecord) cursor.next()) != null) {
        assertEquals(expected++, ((TestKey) record.key()).key());
        assertEquals("second", record.stringValue());
    }
    assertEquals(N, expected);
    db.close();
}