@Test
public void contains() {

    // Insert a few ranges manually.
    db.run(tr -> {
        tr.set(rsSubspace.pack(new byte[]{(byte)0x10}), new byte[]{(byte)0x66});
        tr.set(rsSubspace.pack(new byte[]{(byte)0x77}), new byte[]{(byte)0x88});
        tr.set(rsSubspace.pack(new byte[]{(byte)0x88}), new byte[]{(byte)0x99});
        tr.set(rsSubspace.pack(new byte[]{(byte)0x99}), new byte[]{(byte)0x99,(byte)0x00});
        return null;
    });
    // Before range.
    assertFalse(rs.contains(db, new byte[]{(byte) 0x05}).join(), "Key \\x05 inside when shouldn't be");
    // Within range.
    assertTrue(rs.contains(db, new byte[]{(byte) 0x10}).join(), "Key \\x10 outside when shouldn't be");
    assertTrue(rs.contains(db, new byte[]{(byte) 0x10, (byte) 0x66}).join(), "Key \\x10\\x66 outside when shouldn't be");
    assertTrue(rs.contains(db, new byte[]{(byte) 0x55}).join(), "Key \\x55 outside when shouldn't be");
    // After range.
    assertFalse(rs.contains(db, new byte[]{(byte) 0x66}).join(), "Key \\x66 inside when shouldn't be");
    assertFalse(rs.contains(db, new byte[]{(byte) 0x66, (byte) 0x00}).join(), "Key \\x66\\x00 inside when shouldn't be");
    assertFalse(rs.contains(db, new byte[]{(byte) 0x70, (byte) 0x00}).join(), "Key \\x70\\x00 inside when shouldn't be");
    // Within second and third ranges.
    assertTrue(rs.contains(db, new byte[]{(byte) 0x77}).join(), "Key \\x77 outside when shouldn't be");
    assertTrue(rs.contains(db, new byte[]{(byte) 0x77, (byte) 0x00}).join(), "Key \\x77\\x00 outside when shouldn't be");
    assertTrue(rs.contains(db, new byte[]{(byte) 0x79, (byte) 0x00}).join(), "Key \\x79\\x00 outside when shouldn't be");
    assertTrue(rs.contains(db, new byte[]{(byte) 0x88}).join(), "Key \\x88 outside when shouldn't be");
    assertTrue(rs.contains(db, new byte[]{(byte) 0x99}).join(), "Key \\x99 outside when shouldn't be");
    // Outside last set of ranges.
    assertFalse(rs.contains(db, new byte[]{(byte) 0x99, (byte) 0x00}).join(), "Key \\x99\\x00 inside when shouldn't be");
    assertFalse(rs.contains(db, new byte[]{(byte) 0xaa}).join(), "Key \\xaa inside when shouldn't be");
}