@Test
public void testMaskLast() {
LongKeyDomain keys = LongKeyDomain.create(2, 7, 8, 42, 639);
keys.setActive(4, false);
LongSortedSet set = new LongSortedArraySet(keys);
assertThat(set, hasSize(4));
assertThat(set.first(), equalTo(2l));
assertThat(set.last(), equalTo(42l));
assertTrue(set.contains(8));
assertFalse(set.contains(639));
assertThat(LongIterators.unwrap(set.iterator()),
equalTo(new long[]{2, 7, 8, 42}));
assertThat(LongIterators.unwrap(set.iterator(2)),
equalTo(new long[]{7, 8, 42}));
assertThat(LongIterators.unwrap(set.iterator(7)),
equalTo(new long[]{8, 42}));
assertThat(set.headSet(42).toLongArray(),
equalTo(new long[]{2, 7, 8}));
assertThat(set.tailSet(7).toLongArray(),
equalTo(new long[]{7, 8, 42}));
}