### Question:
DefaultNonUniqueIndexSampler implements NonUniqueIndexSampler { @Override public void include( String value ) { include( value, 1 ); } DefaultNonUniqueIndexSampler( int sampleSizeLimit ); @Override void include( String value ); @Override void include( String value, long increment ); @Override void exclude( String value ); @Override void exclude( String value, long decrement ); @Override IndexSample result(); @Override IndexSample result( int numDocs );  }### Answer:
@Test public void shouldSampleASingleValue() { NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler( 10 ); sampler.include( value, 2 ); assertSampledValues( sampler, 2, 1, 2 ); }
@Test public void shouldSampleDuplicateValues() { NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler( 10 ); sampler.include( value, 5 ); sampler.include( value, 4 ); sampler.include( "bbb", 3 ); assertSampledValues( sampler, 12, 2, 12 ); }
@Test public void shouldDivideTheSamplingInStepsNotBiggerThanBatchSize() { NonUniqueIndexSampler sampler = new DefaultNonUniqueIndexSampler( 1 ); sampler.include( value, 5 ); sampler.include( value, 4 ); sampler.include( "bbb", 3 ); int expectedSampledSize = 12 / 3; assertSampledValues( sampler, 12, 1, expectedSampledSize ); }