@Test public void testExecuteWithDefault() { final String secretKey = "Very secret key"; UserResponse response = new UserResponse(); response.setSecretKey(secretKey); when(accountService.getUserByApiKey(null)).thenReturn(userAccount); when(responseGenerator.createUserResponse(userAccount)).thenReturn(response); getUserCmd.execute(); response = (UserResponse) getUserCmd.getResponseObject(); assertFalse("SecretKey was revealed in ResponseObject, wasn't masked", secretKey.equals(response.getSecretKey())); }
@Override public void execute() { final UserAccount result = _accountService.getUserByApiKey(getApiKey()); if (result != null) { final UserResponse response = _responseGenerator.createUserResponse(result); if (StringUtils.isNotBlank(response.getSecretKey())) { response.setSecretKey("SecretKey only visible when generating a new key"); } response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new InvalidParameterValueException("User with specified API key does not exist"); } }
GetUserCmd extends BaseCmd { @Override public void execute() { final UserAccount result = _accountService.getUserByApiKey(getApiKey()); if (result != null) { final UserResponse response = _responseGenerator.createUserResponse(result); if (StringUtils.isNotBlank(response.getSecretKey())) { response.setSecretKey("SecretKey only visible when generating a new key"); } response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new InvalidParameterValueException("User with specified API key does not exist"); } } }
GetUserCmd extends BaseCmd { @Override public void execute() { final UserAccount result = _accountService.getUserByApiKey(getApiKey()); if (result != null) { final UserResponse response = _responseGenerator.createUserResponse(result); if (StringUtils.isNotBlank(response.getSecretKey())) { response.setSecretKey("SecretKey only visible when generating a new key"); } response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new InvalidParameterValueException("User with specified API key does not exist"); } }  }
GetUserCmd extends BaseCmd { @Override public void execute() { final UserAccount result = _accountService.getUserByApiKey(getApiKey()); if (result != null) { final UserResponse response = _responseGenerator.createUserResponse(result); if (StringUtils.isNotBlank(response.getSecretKey())) { response.setSecretKey("SecretKey only visible when generating a new key"); } response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new InvalidParameterValueException("User with specified API key does not exist"); } }  @Override void execute(); String getApiKey(); @Override String getCommandName(); @Override long getEntityOwnerId(); }
GetUserCmd extends BaseCmd { @Override public void execute() { final UserAccount result = _accountService.getUserByApiKey(getApiKey()); if (result != null) { final UserResponse response = _responseGenerator.createUserResponse(result); if (StringUtils.isNotBlank(response.getSecretKey())) { response.setSecretKey("SecretKey only visible when generating a new key"); } response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new InvalidParameterValueException("User with specified API key does not exist"); } }  @Override void execute(); String getApiKey(); @Override String getCommandName(); @Override long getEntityOwnerId(); static final Logger s_logger; }