LoadUserDetailsUseCase extends UseCase { @Override public Observable buildUseCase(String username) throws NullPointerException { if (username == null) { throw new NullPointerException("Username must not be null"); } return getGitHubService().getRepositoriesFromUser(username); } @Inject  LoadUserDetailsUseCase(GitHubService gitHubService, ThreadExecutor threadExecutor,
      PostExecutionThread postExecutionThread); @Override Observable buildUseCase(String username);  }
@Test public void buildUseCaseShouldGetRepositoriesFromUser() throws Exception { loadUserDetailsUseCase.buildUseCase(MockFactory.TEST_USERNAME); verify(gitHubService).getRepositoriesFromUser(MockFactory.TEST_USERNAME); }
@Test(expected = NullPointerException.class) public void buildUseCaseShouldThrowNullPointerExceptionIfUsernameNotSet() throws Exception { loadUserDetailsUseCase.buildUseCase(null); }