test/src/kbasesearchengine/test/search/SearchTypesTest.java
@Test
    public void searchTypes_NothingFound() throws Exception {
        int indexedItemsAndTypeCount = 5;
        int expectedItemCount = 0;
        String searchFor = "quidditch";

        IndexingStorage indexStorage = createIndexingStorage(null);

        for (int i = 0; i < indexedItemsAndTypeCount; i += 1) {
                indexOne(indexStorage, new Integer(i), true);
        }

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

        final Map<String, Integer> typeCounts = indexStorage.searchTypes(
                MatchFilter.getBuilder()
                        .withNullableFullTextInAll(searchFor)
                        .withExcludeSubObjects(true)
                        .build(),
                AccessFilter.create()
                        .withPublic(true));

        assertThat("incorrect type count", typeCounts.size(), is(expectedItemCount));
        assertThat("incorrect type summary", typeCounts, is(expected));
    }
/*
        searchTypes_NothingFound() tests the boundary condition of applying
        a query which matches nothing. The aggregation set should be empty.
    */
searchTypes_NothingFound() tests the boundary condition of applying
a query which matches nothing. The aggregation set should be empty.
searchTypes_NothingFound () tests the boundary condition of applying a query which matches nothing . The aggregation set should be empty .
@Test
    public void searchTypes_NothingFound() throws Exception {
        int indexedItemsAndTypeCount = 5;
        int expectedItemCount = 0;
        String searchFor = "quidditch";
        IndexingStorage indexStorage = createIndexingStorage(null);
        for (int i = 0; i < indexedItemsAndTypeCount; i += 1) {
                indexOne(indexStorage, new Integer(i), true);
        }
        ImmutableMap.Builder<String, Integer> expectedBuilder = ImmutableMap.<String, Integer>builder();
        for (int i = 0; i < expectedItemCount; i += 1) {
                expectedBuilder.put("SearchType" + i, 1);
        }
        ImmutableMap<String, Integer> expected =  expectedBuilder.build();
        final Map<String, Integer> typeCounts = indexStorage.searchTypes(
                MatchFilter.getBuilder()
                        .withNullableFullTextInAll(searchFor)
                        .withExcludeSubObjects(true)
                        .build(),
                AccessFilter.create()
                        .withPublic(true));
        assertThat("incorrect type count", typeCounts.size(), is(expectedItemCount));
        assertThat("incorrect type summary", typeCounts, is(expected));
    }
@ Test public void searchTypes_NothingFound ( ) throws Exception { int indexedItemsAndTypeCount = 5 ; int expectedItemCount = 0 ; String searchFor = "quidditch" ; IndexingStorage indexStorage = createIndexingStorage ( null ) ; for ( int i = 0 ; i < indexedItemsAndTypeCount ; i += 1 ) { indexOne ( indexStorage , new Integer ( i ) , true ) ; } ImmutableMap . Builder < String , Integer > expectedBuilder = ImmutableMap . < String , Integer > builder ( ) ; for ( int i = 0 ; i < expectedItemCount ; i += 1 ) { expectedBuilder . put ( "SearchType" + i , 1 ) ; } ImmutableMap < String , Integer > expected = expectedBuilder . build ( ) ; final Map < String , Integer > typeCounts = indexStorage . searchTypes ( MatchFilter . getBuilder ( ) . withNullableFullTextInAll ( searchFor ) . withExcludeSubObjects ( true ) . build ( ) , AccessFilter . create ( ) . withPublic ( true ) ) ; assertThat ( "incorrect type count" , typeCounts . size ( ) , is ( expectedItemCount ) ) ; assertThat ( "incorrect type summary" , typeCounts , is ( expected ) ) ; }
searchTypes_NothingFound() tests the boundary condition of applying
a query which matches nothing.
searchTypes_NothingFound () tests the boundary condition of applying a query which matches nothing .