SearchUserUseCase extends UseCase { @Override public Observable buildUseCase(String username) throws NullPointerException { if (username == null) { throw new NullPointerException("Query must not be null"); } return getGitHubService().searchUser(username); } @Inject  SearchUserUseCase(GitHubService gitHubService, ThreadExecutor threadExecutor,
      PostExecutionThread postExecutionThread); @Override Observable buildUseCase(String username);  }
@Test public void buildUseCaseShouldCallSearchUser() throws Exception { searchUserUseCase.buildUseCase(MockFactory.TEST_USERNAME); verify(gitHubService).searchUser(MockFactory.TEST_USERNAME); }
@Test(expected = NullPointerException.class) public void buildUseCaseShouldThrowNullPointerExceptionIfQueryNotSet() throws Exception { searchUserUseCase.buildUseCase(null); }