Skip to content

Commit 8d69a4e

Browse files
Evan PhilakhongEvan Philakhong
authored andcommitted
refactor: ran spotlessApply
1 parent 1f7acc3 commit 8d69a4e

File tree

8 files changed

+23
-35
lines changed

8 files changed

+23
-35
lines changed

lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank/Account.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
package com.codedifferently.lesson17.bank;
22

33
import com.codedifferently.lesson17.bank.exceptions.InsufficientFundsException;
4-
4+
import java.util.Set;
55
import lombok.Getter;
66
import lombok.Setter;
77

8-
import java.util.Set;
9-
10-
/**
11-
* Abstract base class for all bank accounts.
12-
*/
8+
/** Abstract base class for all bank accounts. */
139
@Getter
1410
@Setter
1511
public abstract class Account {
@@ -22,7 +18,7 @@ public abstract class Account {
2218
* Creates a new account.
2319
*
2420
* @param accountNumber The account number.
25-
* @param owners The owners of the account.
21+
* @param owners The owners of the account.
2622
* @param initalBalance The inital balance of the account.
2723
*/
2824
public Account(String accountNumber, Set<Customer> owners, double initalBalance) {
@@ -66,9 +62,7 @@ public void withdraw(double amount) throws InsufficientFundsException {
6662
balance -= amount;
6763
}
6864

69-
/**
70-
* Closes the account.
71-
*/
65+
/** Closes the account. */
7266
public void closeAccount() throws IllegalStateException {
7367
if (balance > 0) {
7468
throw new IllegalStateException("Cannot close account with a positive balance");

lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank/BankAtm.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public Set<Account> findAccountsByCustomerId(UUID customerId) {
4343
* Deposits funds into an account.
4444
*
4545
* @param accountNumber The account number.
46-
* @param amount The amount to deposit.
46+
* @param amount The amount to deposit.
4747
*/
4848
public void depositFunds(String accountNumber, double amount) {
4949
Account account = getAccountOrThrow(accountNumber);
@@ -54,7 +54,7 @@ public void depositFunds(String accountNumber, double amount) {
5454
* Deposits funds into an account using a check.
5555
*
5656
* @param accountNumber The account number.
57-
* @param check The check to deposit.
57+
* @param check The check to deposit.
5858
*/
5959
public void depositFunds(String accountNumber, Check check) {
6060
Account account = getAccountOrThrow(accountNumber);

lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank/Check.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class Check {
1414
* Creates a new check.
1515
*
1616
* @param checkNumber The check number.
17-
* @param amount The amount of the check.
18-
* @param account The account the check is drawn on.
17+
* @param amount The amount of the check.
18+
* @param account The account the check is drawn on.
1919
*/
2020
public Check(String checkNumber, double amount, Account account) {
2121
if (amount < 0) {

lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank/CheckingAccount.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public class CheckingAccount extends Account {
88
/**
99
* Creates a new checking account.
1010
*
11-
* @param accountNumber The account number.
12-
* @param owners The owners of the account.
11+
* @param accountNumber The account number.
12+
* @param owners The owners of the account.
1313
* @param initialBalance The initial balance of the account.
1414
*/
1515
public CheckingAccount(String accountNumber, Set<Customer> owners, double initialBalance) {

lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank/Customer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import java.util.HashSet;
44
import java.util.Set;
55
import java.util.UUID;
6-
76
import lombok.Getter;
87
import lombok.Setter;
98

@@ -14,17 +13,20 @@ public class Customer {
1413

1514
private final UUID id;
1615
private final String name;
16+
private final CustomerType type;
1717
private final Set<Account> accounts = new HashSet<>();
1818

1919
/**
2020
* Creates a new customer.
2121
*
22-
* @param id The ID of the customer.
22+
* @param id The ID of the customer.
2323
* @param name The name of the customer.
24+
* @param type The type of customer (individual or business)
2425
*/
25-
public Customer(UUID id, String name) {
26+
public Customer(UUID id, String name, CustomerType type) {
2627
this.id = id;
2728
this.name = name;
29+
this.type = type;
2830
}
2931

3032
/**
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.codedifferently.lesson17.bank;
2+
3+
public enum CustomerType {
4+
INDIVIDUAL,
5+
BUSINESS
6+
}

lesson_17/bank/bank_app/src/main/java/com/codedifferently/lesson17/bank/SavingsAccount.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class SavingsAccount extends Account {
99
* Creates a new sacings account.
1010
*
1111
* @param accountNumber The account number.
12-
* @param owners The ownders of the account.
12+
* @param owners The ownders of the account.
1313
* @param initalBalance The inital balance of the account.
1414
*/
1515
public SavingsAccount(String accountNumber, Set<Customer> owners, double initalBalance) {
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
11
package com.codedifferently.lesson17.bank;
22

3-
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
4-
import static org.junit.jupiter.api.Assertions.assertEquals;
5-
import static org.junit.jupiter.api.Assertions.assertFalse;
6-
import static org.junit.jupiter.api.Assertions.assertTrue;
7-
8-
import com.codedifferently.lesson17.bank.exceptions.InsufficientFundsException;
9-
import java.util.HashSet;
10-
import java.util.Set;
11-
import java.util.UUID;
12-
import org.junit.jupiter.api.BeforeEach;
13-
import org.junit.jupiter.api.Test;
14-
15-
class CheckingAccountTest {
16-
17-
}
3+
class CheckingAccountTest {}

0 commit comments

Comments
 (0)