### Question:
SaveableObjectPropertySet extends PropertySet { public void putObject(long index, Saveable value) { PropertyPage page = getOrCreatePage(getPageID(index)); int n = page.getSize(); page.addSaveableObject(getPageOffset(index), value); numProperties += page.getSize() - n; } SaveableObjectPropertySet(String name, Class<?> objectClass); @Override int getDataSize(); void putObject(long index, Saveable value); Saveable getObject(long index); @Override void applyValue(PropertyVisitor visitor, long addr);  }### Answer:
@Test public void testGetSize() { for (int i = 0; i < 1000; i++) { ps.putObject(10000 * i, new SaveableInt(i)); } assertEquals(1000, ps.getSize()); }
@Test public void testPropertyIndex() throws NoSuchIndexException { for (int i = 0; i < 1000; i++) { ps.putObject(10000 * i, new SaveableInt(i)); } assertEquals(0, ps.getFirstPropertyIndex()); assertEquals(9990000, ps.getLastPropertyIndex()); assertEquals(10000, ps.getNextPropertyIndex(0)); assertEquals(0, ps.getPreviousPropertyIndex(10000)); assertEquals(10000, ps.getNextPropertyIndex(1)); assertEquals(0, ps.getPreviousPropertyIndex(2)); LongIterator it = ps.getPropertyIterator(); int count = 0; while (it.hasNext()) { it.next(); count++; } assertEquals(1000, count); }
@Test public void testPropertyIndex2() throws NoSuchIndexException { for (int i = 0; i < 10000; i++) { ps.putObject(3 * i, new SaveableInt(i)); } assertEquals(10000, ps.getSize()); assertEquals(0, ps.getFirstPropertyIndex()); assertEquals(3 * 9999, ps.getLastPropertyIndex()); assertEquals(3, ps.getNextPropertyIndex(0)); assertEquals(0, ps.getPreviousPropertyIndex(3)); assertEquals(3, ps.getNextPropertyIndex(1)); assertEquals(0, ps.getPreviousPropertyIndex(2)); LongIterator it = ps.getPropertyIterator(); int count = 0; while (it.hasNext()) { it.next(); count++; } assertEquals(10000, count); }
@Test public void testPropertyIndex3() throws NoSuchIndexException { for (int i = 0; i < 10000; i++) { ps.putObject(i, new SaveableInt(i)); } assertEquals(10000, ps.getSize()); assertEquals(0, ps.getFirstPropertyIndex()); assertEquals(9999, ps.getLastPropertyIndex()); assertEquals(1, ps.getNextPropertyIndex(0)); assertEquals(2, ps.getPreviousPropertyIndex(3)); assertEquals(2, ps.getNextPropertyIndex(1)); assertEquals(1, ps.getPreviousPropertyIndex(2)); LongIterator it = ps.getPropertyIterator(); int count = 0; while (it.hasNext()) { it.next(); count++; } assertEquals(10000, count); }
@Test public void testIterator() { for (int i = 0; i < 1000; i++) { ps.putObject(100 * i, new SaveableInt(i)); } LongIterator it = ps.getPropertyIterator(); int i = 0; while (it.hasNext()) { long l = it.next(); assertEquals(100 * i, l); i++; } assertEquals(i, 1000); }
@Test public void testIterator2() { for (int i = 0; i < 10000; i++) { ps.putObject(i, new SaveableInt(i)); } LongIterator it = ps.getPropertyIterator(); int i = 0; while (it.hasNext()) { long l = it.next(); assertEquals(i, l); i++; } assertEquals(i, 10000); }