UsersExplorer extends AbstractEntityExplorer<User> { void onUserCreated(@Observes final CreateUserEvent createUserEvent) { attemptToShowSearch(); } @Inject  UsersExplorer(final ClientUserSystemManager userSystemManager,
                         final Event<OnErrorEvent> errorEvent,
                         final LoadingBox loadingBox,
                         final EntitiesList<User> entitiesList,
                         final EntitiesExplorerView view,
                         final Event<ReadUserEvent> readUserEvent,
                         final Event<NewUserEvent> newUserEvent);   }
@Test public void testOnCreateUser() throws Exception { final CreateUserEvent createUserEvent = mock(CreateUserEvent.class); presenter.context = mock(ExplorerViewContext.class); presenter.onUserCreated(createUserEvent); verify(userManagerService, times(1)).search(any(AbstractEntityManager.SearchRequest.class)); }
@Test public void testOnCreateUserButNoContext() throws Exception { final CreateUserEvent createUserEvent = mock(CreateUserEvent.class); presenter.context = null; presenter.onUserCreated(createUserEvent); verify(userManagerService, never()).search(any(AbstractEntityManager.SearchRequest.class)); }