Skip to content

Commit 88d90b3

Browse files
committed
refactoring: code refactoring
1 parent e62eb8c commit 88d90b3

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

src/main/java/com/example/paul/constants/constants.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ public class constants {
2222

2323
public static final String INVALID_TRANSACTION =
2424
"Account information is invalid or transaction has been denied for your protection. Please try again.";
25+
public static final String CREATE_ACCOUNT_FAILED =
26+
"Error happened during creating new account";
2527
}
26-

src/main/java/com/example/paul/controllers/AccountRestController.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public class AccountRestController {
2626

2727
private static final Logger LOGGER = LoggerFactory.getLogger(AccountRestController.class);
2828

29-
private static final String CREATE_ACCOUNT_FAILED =
30-
"Error happened during creating new account";
31-
3229
private final AccountService accountService;
3330

3431
@Autowired
@@ -77,7 +74,7 @@ public ResponseEntity<?> createAccount(
7774

7875
// Return the account details, or warn that no account was found for given input
7976
if (account == null) {
80-
return new ResponseEntity<>(CREATE_ACCOUNT_FAILED, HttpStatus.OK);
77+
return new ResponseEntity<>(constants.CREATE_ACCOUNT_FAILED, HttpStatus.OK);
8178
} else {
8279
return new ResponseEntity<>(account, HttpStatus.OK);
8380
}

src/main/java/com/example/paul/utils/CreateAccountInput.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
package com.example.paul.utils;
22

3-
import com.example.paul.constants.constants;
4-
import com.mifmif.common.regex.Generex;
5-
63
import javax.validation.constraints.NotBlank;
74
import java.util.Objects;
85

9-
import static com.example.paul.constants.constants.ACCOUNT_NUMBER_PATTERN_STRING;
10-
import static com.example.paul.constants.constants.SORT_CODE_PATTERN_STRING;
11-
126
public class CreateAccountInput {
137

148
@NotBlank(message = "Bank name is mandatory")

0 commit comments

Comments
 (0)