### Question:
TreeState { static void write( PageCursor cursor, long stableGeneration, long unstableGeneration, long rootId, long rootGeneration, long lastId, long freeListWritePageId, long freeListReadPageId, int freeListWritePos, int freeListReadPos, boolean clean ) { GenerationSafePointer.assertGenerationOnWrite( stableGeneration ); GenerationSafePointer.assertGenerationOnWrite( unstableGeneration ); writeStateOnce( cursor, stableGeneration, unstableGeneration, rootId, rootGeneration, lastId, freeListWritePageId, freeListReadPageId, freeListWritePos, freeListReadPos, clean ); writeStateOnce( cursor, stableGeneration, unstableGeneration, rootId, rootGeneration, lastId, freeListWritePageId, freeListReadPageId, freeListWritePos, freeListReadPos, clean ); } TreeState( long pageId, long stableGeneration, long unstableGeneration, long rootId, long rootGeneration,
            long lastId, long freeListWritePageId, long freeListReadPageId, int freeListWritePos, int freeListReadPos,
            boolean clean, boolean valid ); @Override String toString(); @Override boolean equals( Object o ); @Override int hashCode(); boolean isClean();  }### Answer:
@Test void shouldNotWriteInvalidStableGeneration() { long generation = GenerationSafePointer.MAX_GENERATION + 1; assertThrows( IllegalArgumentException.class, () -> { long pageId = cursor.getCurrentPageId(); write( cursor, new TreeState( pageId, generation, 2, 3, 4, 5, 6, 7, 8, 9, true, true ) ); } ); }
@Test void shouldNotWriteInvalidUnstableGeneration() { long generation = GenerationSafePointer.MAX_GENERATION + 1; assertThrows( IllegalArgumentException.class, () -> { long pageId = cursor.getCurrentPageId(); write( cursor, new TreeState( pageId, 1, generation, 3, 4, 5, 6, 7, 8, 9, true, true ) ); } ); }