### Question:
GenerationSafePointerPair { public static long write( PageCursor cursor, long pointer, long stableGeneration, long unstableGeneration ) { int offset = cursor.getOffset(); pointer = pointer( pointer ); long generationA = readGeneration( cursor ); long pointerA = readPointer( cursor ); short readChecksumA = readChecksum( cursor ); short checksumA = checksumOf( generationA, pointerA ); boolean correctChecksumA = readChecksumA == checksumA; long generationB = readGeneration( cursor ); long pointerB = readPointer( cursor ); short readChecksumB = readChecksum( cursor ); short checksumB = checksumOf( generationB, pointerB ); boolean correctChecksumB = readChecksumB == checksumB; byte pointerStateA = pointerState( stableGeneration, unstableGeneration, generationA, pointerA, correctChecksumA ); byte pointerStateB = pointerState( stableGeneration, unstableGeneration, generationB, pointerB, correctChecksumB ); long writeResult = writeResult( pointerStateA, pointerStateB, generationA, generationB ); if ( isSuccess( writeResult ) ) { boolean writeToA = ( writeResult & SLOT_MASK) == FLAG_SLOT_A; int writeOffset = writeToA ? offset : offset + GenerationSafePointer.SIZE; cursor.setOffset( writeOffset ); GenerationSafePointer.write( cursor, unstableGeneration, pointer ); } return writeResult; } private  GenerationSafePointerPair(); static long read( PageCursor cursor, long stableGeneration, long unstableGeneration, GBPTreeGenerationTarget generationTarget ); static long write( PageCursor cursor, long pointer, long stableGeneration, long unstableGeneration );  }### Answer:
@Test public void shouldWrite() { cursor.setOffset( SLOT_A_OFFSET ); long preStatePointerA = stateA.materialize( cursor, POINTER_A ); cursor.setOffset( SLOT_B_OFFSET ); long preStatePointerB = stateB.materialize( cursor, POINTER_B ); cursor.setOffset( GSPP_OFFSET ); long written = GenerationSafePointerPair.write( cursor, WRITTEN_POINTER, STABLE_GENERATION, UNSTABLE_GENERATION ); expectedWriteOutcome.verifyWrite( cursor, written, stateA, stateB, preStatePointerA, preStatePointerB ); }