test/src/kbasesearchengine/test/main/NarrativeInfoDecoratorTest.java
@Test
    public void searchObjectsDecorateWithNoData() throws Exception {
        final SearchInterface search = mock(SearchInterface.class);
        final NarrativeInfoProvider nip = mock(NarrativeInfoProvider.class);
        final AuthInfoProvider aip = mock(AuthInfoProvider.class);

        final NarrativeInfoDecorator nid = new NarrativeInfoDecorator(search, nip, aip);

        /* since a) the generated input class has no hashcode or equals and
         * b) the argument is just a straight pass through, we just use an identity match
         * for mockito to recognize the argument
         */
        final SearchObjectsInput dummyInput = new SearchObjectsInput()
                .withPostProcessing(new PostProcessing().withAddNarrativeInfo(1L));

        when(search.searchObjects(dummyInput, "user")).thenReturn(new SearchObjectsOutput()
                .withObjects(Collections.emptyList())
                .withAccessGroupNarrativeInfo(null));

        when(aip.findUserDisplayNames(set())).thenReturn(Collections.emptyMap());

        final SearchObjectsOutput res = nid.searchObjects(dummyInput, "user");

        assertThat("incorrect object data", res.getObjects(), is(Collections.emptyList()));
        assertThat("incorrect narr info", res.getAccessGroupNarrativeInfo(),
                is(Collections.emptyMap()));
    }
/* Note that the implementation is the same for GetObjects and SearchObjects and so it
     * seems pointless to repeat the same tests for GetObjects. As such, only a very simple
     * test is run to ensure that objects are decorated.
     *
     * If the implementation of GetObjects changes be sure to update the tests.
     */
Note that the implementation is the same for GetObjects and SearchObjects and so it
seems pointless to repeat the same tests for GetObjects. As such, only a very simple
test is run to ensure that objects are decorated.

If the implementation of GetObjects changes be sure to update the tests.
Note that the implementation is the same for GetObjects and SearchObjects and so it seems pointless to repeat the same tests for GetObjects . As such only a very simple test is run to ensure that objects are decorated . If the implementation of GetObjects changes be sure to update the tests .
@Test
    public void searchObjectsDecorateWithNoData() throws Exception {
        final SearchInterface search = mock(SearchInterface.class);
        final NarrativeInfoProvider nip = mock(NarrativeInfoProvider.class);
        final AuthInfoProvider aip = mock(AuthInfoProvider.class);
        final NarrativeInfoDecorator nid = new NarrativeInfoDecorator(search, nip, aip);
        /* since a) the generated input class has no hashcode or equals and
         * b) the argument is just a straight pass through, we just use an identity match
         * for mockito to recognize the argument
         */
        final SearchObjectsInput dummyInput = new SearchObjectsInput()
                .withPostProcessing(new PostProcessing().withAddNarrativeInfo(1L));
        when(search.searchObjects(dummyInput, "user")).thenReturn(new SearchObjectsOutput()
                .withObjects(Collections.emptyList())
                .withAccessGroupNarrativeInfo(null));
        when(aip.findUserDisplayNames(set())).thenReturn(Collections.emptyMap());
        final SearchObjectsOutput res = nid.searchObjects(dummyInput, "user");
        assertThat("incorrect object data", res.getObjects(), is(Collections.emptyList()));
        assertThat("incorrect narr info", res.getAccessGroupNarrativeInfo(),
                is(Collections.emptyMap()));
    }
@ Test public void searchObjectsDecorateWithNoData ( ) throws Exception { final SearchInterface search = mock ( SearchInterface . class ) ; final NarrativeInfoProvider nip = mock ( NarrativeInfoProvider . class ) ; final AuthInfoProvider aip = mock ( AuthInfoProvider . class ) ; final NarrativeInfoDecorator nid = new NarrativeInfoDecorator ( search , nip , aip ) ; /* since a) the generated input class has no hashcode or equals and
         * b) the argument is just a straight pass through, we just use an identity match
         * for mockito to recognize the argument
         */ final SearchObjectsInput dummyInput = new SearchObjectsInput ( ) . withPostProcessing ( new PostProcessing ( ) . withAddNarrativeInfo ( 1L ) ) ; when ( search . searchObjects ( dummyInput , "user" ) ) . thenReturn ( new SearchObjectsOutput ( ) . withObjects ( Collections . emptyList ( ) ) . withAccessGroupNarrativeInfo ( null ) ) ; when ( aip . findUserDisplayNames ( set ( ) ) ) . thenReturn ( Collections . emptyMap ( ) ) ; final SearchObjectsOutput res = nid . searchObjects ( dummyInput , "user" ) ; assertThat ( "incorrect object data" , res . getObjects ( ) , is ( Collections . emptyList ( ) ) ) ; assertThat ( "incorrect narr info" , res . getAccessGroupNarrativeInfo ( ) , is ( Collections . emptyMap ( ) ) ) ; }
Note that the implementation is the same for GetObjects and SearchObjects and so it
 seems pointless to repeat the same tests for GetObjects.
Note that the implementation is the same for GetObjects and SearchObjects and so it seems pointless to repeat the same tests for GetObjects .