Relevant snippet of test case extracted below:
scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() );
scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
scoped_ptr<SortedDataBuilderInterface> builder(
sorted->getBulkBuilder( opCtx.get(), true /* allow duplicates */ ) );
ASSERT_OK( builder->addKey( key1, loc2 ) );
ASSERT_EQUALS( ErrorCodes::InternalError, builder->addKey( key1, loc1 ) );
builder->commit( false );
ASSERT_EQUALS( 1, sorted->numEntries( opCtx.get() ) );