assertEquals(136, getAmortizedSize(builder));
}
@Test
public void testFlatNodeUpdate() {
SegmentStore store = new MemoryStore();
SegmentWriter writer = store.getWriter();
NodeBuilder builder = EMPTY_NODE.builder();
for (int i = 0; i < 1000; i++) {
builder.child("child" + i);
}
SegmentNodeState state = writer.writeNode(builder.getNodeState());
writer.flush();
Segment segment = store.readSegment(state.getRecordId().getSegmentId());
assertEquals(27508, Segment.WEIGHER.weigh(null, segment));
writer.flush(); // force flushing of the previous segment
builder = state.builder();
builder.child("child1000");
state = writer.writeNode(builder.getNodeState());
writer.flush();
segment = store.readSegment(state.getRecordId().getSegmentId());
assertEquals(484, Segment.WEIGHER.weigh(null, segment));
}