test/src/kbasesearchengine/test/search/SearchTypesTest.java
@Test
    public void searchTypes_TypesGreaterThanAggregationSize() throws Exception {
        int itemCount = 16;
        int aggregationSize = 15;

        IndexingStorage indexStorage = createIndexingStorage(aggregationSize);

        ImmutableMap.Builder<String, Integer> expectedBuilder = ImmutableMap.<String, Integer>builder();
        for (int i = 0; i < itemCount; i += 1) {
                indexOne(indexStorage, new Integer(i), true);
                expectedBuilder.put("SearchType" + i, 1);
        }
        ImmutableMap<String, Integer> expected =  expectedBuilder.build();

        final Map<String, Integer> typeCounts = indexStorage.searchTypes(
                MatchFilter.getBuilder()
                        .withNullableFullTextInAll(null)
                        .withExcludeSubObjects(true)
                        .build(),
                AccessFilter.create()
                        .withPublic(true));
        
        assertThat("incorrect type count", typeCounts.size(), is(aggregationSize));
        assertThat("incorrect type count", typeCounts.size(), not(is(itemCount)));
        assertThat("unexpectly correct type count", typeCounts, not(is(expected)));
    }
/*
        searchTypes_TypesGreaterThanAggregationSize() tests a query over N+1 types with an
        aggregation size of N. This should lead fewer (15) types returned in
        the aggregation than actually exist (16).
        This simulates the boundary condition for the error which motivated 
        the creation of this test suite.
    */
searchTypes_TypesGreaterThanAggregationSize() tests a query over N+1 types with an
aggregation size of N. This should lead fewer (15) types returned in
the aggregation than actually exist (16).
This simulates the boundary condition for the error which motivated
the creation of this test suite.
searchTypes_TypesGreaterThanAggregationSize () tests a query over N + 1 types with an aggregation size of N . This should lead fewer ( 15 ) types returned in the aggregation than actually exist ( 16 ) . This simulates the boundary condition for the error which motivated the creation of this test suite .
@Test
    public void searchTypes_TypesGreaterThanAggregationSize() throws Exception {
        int itemCount = 16;
        int aggregationSize = 15;
        IndexingStorage indexStorage = createIndexingStorage(aggregationSize);
        ImmutableMap.Builder<String, Integer> expectedBuilder = ImmutableMap.<String, Integer>builder();
        for (int i = 0; i < itemCount; i += 1) {
                indexOne(indexStorage, new Integer(i), true);
                expectedBuilder.put("SearchType" + i, 1);
        }
        ImmutableMap<String, Integer> expected =  expectedBuilder.build();
        final Map<String, Integer> typeCounts = indexStorage.searchTypes(
                MatchFilter.getBuilder()
                        .withNullableFullTextInAll(null)
                        .withExcludeSubObjects(true)
                        .build(),
                AccessFilter.create()
                        .withPublic(true));
        assertThat("incorrect type count", typeCounts.size(), is(aggregationSize));
        assertThat("incorrect type count", typeCounts.size(), not(is(itemCount)));
        assertThat("unexpectly correct type count", typeCounts, not(is(expected)));
    }
@ Test public void searchTypes_TypesGreaterThanAggregationSize ( ) throws Exception { int itemCount = 16 ; int aggregationSize = 15 ; IndexingStorage indexStorage = createIndexingStorage ( aggregationSize ) ; ImmutableMap . Builder < String , Integer > expectedBuilder = ImmutableMap . < String , Integer > builder ( ) ; for ( int i = 0 ; i < itemCount ; i += 1 ) { indexOne ( indexStorage , new Integer ( i ) , true ) ; expectedBuilder . put ( "SearchType" + i , 1 ) ; } ImmutableMap < String , Integer > expected = expectedBuilder . build ( ) ; final Map < String , Integer > typeCounts = indexStorage . searchTypes ( MatchFilter . getBuilder ( ) . withNullableFullTextInAll ( null ) . withExcludeSubObjects ( true ) . build ( ) , AccessFilter . create ( ) . withPublic ( true ) ) ; assertThat ( "incorrect type count" , typeCounts . size ( ) , is ( aggregationSize ) ) ; assertThat ( "incorrect type count" , typeCounts . size ( ) , not ( is ( itemCount ) ) ) ; assertThat ( "unexpectly correct type count" , typeCounts , not ( is ( expected ) ) ) ; }
searchTypes_TypesGreaterThanAggregationSize() tests a query over N+1 types with an
aggregation size of N. This should lead fewer (15) types returned in
the aggregation than actually exist (16).
searchTypes_TypesGreaterThanAggregationSize () tests a query over N + 1 types with an aggregation size of N . This should lead fewer ( 15 ) types returned in the aggregation than actually exist ( 16 ) .