@Test(expected = UserSearchException.class) public void testGetUserRemoteApiException() throws RemoteApiException { doThrow(RemoteApiException.class).when(userApiClient) .getUserByUsername(MOCK_SESSION_ID, MOCK_USERNAME); userService.getUser(MOCK_USERNAME); }
public User getUser(String username) { String sessionToken = authenticationProxy.getSessionToken(DEFAULT_USER_ID); try { return userApiClient.getUserByUsername(sessionToken, username); } catch (RemoteApiException e) { String message = logMessage.getMessage(FAIL_GET_USER_BY_USERNAME, username); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new UserSearchException(message, e, solution); } }
UserService { public User getUser(String username) { String sessionToken = authenticationProxy.getSessionToken(DEFAULT_USER_ID); try { return userApiClient.getUserByUsername(sessionToken, username); } catch (RemoteApiException e) { String message = logMessage.getMessage(FAIL_GET_USER_BY_USERNAME, username); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new UserSearchException(message, e, solution); } } }
UserService { public User getUser(String username) { String sessionToken = authenticationProxy.getSessionToken(DEFAULT_USER_ID); try { return userApiClient.getUserByUsername(sessionToken, username); } catch (RemoteApiException e) { String message = logMessage.getMessage(FAIL_GET_USER_BY_USERNAME, username); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new UserSearchException(message, e, solution); } }  }
UserService { public User getUser(String username) { String sessionToken = authenticationProxy.getSessionToken(DEFAULT_USER_ID); try { return userApiClient.getUserByUsername(sessionToken, username); } catch (RemoteApiException e) { String message = logMessage.getMessage(FAIL_GET_USER_BY_USERNAME, username); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new UserSearchException(message, e, solution); } }  @PostConstruct void init(); void setupBotUser(Application application); User getUser(String username); User getUser(Long userId); String getUsername(Application application); }
UserService { public User getUser(String username) { String sessionToken = authenticationProxy.getSessionToken(DEFAULT_USER_ID); try { return userApiClient.getUserByUsername(sessionToken, username); } catch (RemoteApiException e) { String message = logMessage.getMessage(FAIL_GET_USER_BY_USERNAME, username); String solution = logMessage.getMessage(FAIL_POD_API_SOLUTION); throw new UserSearchException(message, e, solution); } }  @PostConstruct void init(); void setupBotUser(Application application); User getUser(String username); User getUser(Long userId); String getUsername(Application application);  }