@Test
public void testStoredRecordSizeIsPlausible() {

    try (FDBRecordContext context = openContext()) {
        openSimpleRecordStore(context, TEST_SPLIT_HOOK);
        TestRecords1Proto.MySimpleRecord.Builder recBuilder = TestRecords1Proto.MySimpleRecord.newBuilder();
        recBuilder.setRecNo(1);
        recBuilder.setStrValueIndexed(Strings.repeat("x", 10));
        FDBStoredRecord<Message> rec1 = recordStore.saveRecord(recBuilder.build());
        assertEquals(1, rec1.getKeyCount(), "small record should only need one key-value pair");
        assertThat("small record should only need few key bytes", rec1.getKeySize(), allOf(greaterThan(5), lessThan(100)));
        assertThat("small record should only need few value bytes", rec1.getValueSize(), allOf(greaterThan(10), lessThan(100)));
        recBuilder.setRecNo(2);
        recBuilder.setStrValueIndexed(Strings.repeat("x", 100000));
        FDBStoredRecord<Message> rec2 = recordStore.saveRecord(recBuilder.build());
        assertThat("large record should only need several key-value pairs", rec2.getKeyCount(), allOf(greaterThan(1), lessThan(10)));
        assertThat("large record should only need few key bytes", rec2.getKeySize(), allOf(greaterThan(10), lessThan(100)));
        assertThat("large record should only need many value bytes", rec2.getValueSize(), allOf(greaterThan(100000), lessThan(101000)));
        FDBStoredRecord<Message> rec1x = recordStore.loadRecord(rec1.getPrimaryKey());
        assertEquals(rec1.getKeyCount(), rec1x.getKeyCount(), "small record loaded key count should match");
        assertEquals(rec1.getKeySize(), rec1x.getKeySize(), "small record loaded key size should match");
        assertEquals(rec1.getValueSize(), rec1x.getValueSize(), "small record loaded value size should match");
        FDBStoredRecord<Message> rec2x = recordStore.loadRecord(rec2.getPrimaryKey());
        assertEquals(rec2.getKeyCount(), rec2x.getKeyCount(), "large record loaded key count should match");
        assertEquals(rec2.getKeySize(), rec2x.getKeySize(), "large record loaded key size should match");
        assertEquals(rec2.getValueSize(), rec2x.getValueSize(), "large record loaded value size should match");
        commit(context);
    }
}