OrderedMap { public abstract void ensurePresent(AbstractRecord record) throws IOException, InterruptedException, DeadlockException, TransactionRolledBackException;  abstract void ensurePresent(AbstractRecord record); abstract AbstractRecord put(AbstractRecord record); abstract void ensureAbsent(AbstractKey key); abstract AbstractRecord delete(AbstractKey key); abstract void lock(AbstractKey key); abstract AbstractRecord find(AbstractKey key); abstract Cursor cursor(AbstractKey key); abstract Cursor first(); abstract Cursor last();  }
@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(); }