public Account handleResponse()

in code-refactoring/long-method/java/src/main/java/com/epam/aicode/java/AccountService.java [5:26]


   public Account handleResponse(AccountResponse accountResponse) {
       if (accountResponse.getId() == null) {
           throw new IllegalArgumentException("Id is required");
       }
       if (accountResponse.getName() == null) {
           throw new IllegalArgumentException("Name is required");
       }
       if (accountResponse.getEmail() == null) {
           throw new IllegalArgumentException("Email is required");
       }
       if (accountResponse.getPhone() == null) {
           throw new IllegalArgumentException("Phone is required");
       }

       Account account = new Account();
       account.setId(accountResponse.getId());
       account.setName(accountResponse.getName());
       account.setEmail(accountResponse.getEmail());
       account.setPhone(accountResponse.getPhone());

       return account;
   }