diff --git a/src/main/java/com/booleanuk/core/Account.java b/src/main/java/com/booleanuk/core/Account.java new file mode 100644 index 000000000..84c0c48dc --- /dev/null +++ b/src/main/java/com/booleanuk/core/Account.java @@ -0,0 +1,86 @@ +package com.booleanuk.core; + +import java.util.ArrayList; + +public class Account { + + private final ArrayList transactions; + private final int accountNumber; + private StringBuilder stringBuilder = new StringBuilder(); + private int prefix; + private double limit; + private boolean overDraftRequested; + private double requestedLimit; + + + public Account(int prefix, int accountNumber) { + this.accountNumber = accountNumber; + this.transactions = new ArrayList<>(); + this.stringBuilder.insert(0, String.format("%21s || %10s || %8s || %8s\n", "Date", "Withdrawal", "Deposit", "Balance")); + this.prefix = prefix; + this.limit = 0.0; + this.requestedLimit = 0.0; + this.overDraftRequested = false; + } + + public void makeTransaction(double amount) { + Transaction transaction = new Transaction(amount); + this.transactions.add(transaction); + //It might seem a bit odd to already start generating the statement here, but the only alternative I can think of + //is that Transaction gets to know about the balance of the account despite it just being a record class. + //Looping over the transaction list after every transaction has been completed only gives the final balance, not the balance after each transaction + this.stringBuilder.append(String.format(transaction + "%8s\n", getBalance())); + + } + + public StringBuilder generateStatement() { + return this.stringBuilder; + } + + public ArrayList getTransactions() { + return this.transactions; + } + + public double getBalance() { + double total = 0.0; + for (Transaction transaction: this.transactions) { + if (transaction.getType().equals(Transaction.Type.DEPOSIT)) { + total += transaction.getAmount(); + } else { + if (total - transaction.getAmount() > this.limit) { + total -= transaction.getAmount(); + } + } + } + return total; + } + + public int getAccountNumber() { + return this.accountNumber; + } + + public int getPrefix() { + return this.prefix; + } + + public double getLimit() { + return this.limit; + } + + public void requestOverdraft(double amount) { + this.overDraftRequested = true; + this.requestedLimit = amount; + } + + public void changeLimit() { + this.limit -= this.requestedLimit; + this.overDraftRequested = false; + this.requestedLimit = 0.0; + } + + public boolean getRequestStatus() { + return this.overDraftRequested; + } + + +} diff --git a/src/main/java/com/booleanuk/core/BankChallengeClassDiagram.png b/src/main/java/com/booleanuk/core/BankChallengeClassDiagram.png new file mode 100644 index 000000000..be428f2f6 Binary files /dev/null and b/src/main/java/com/booleanuk/core/BankChallengeClassDiagram.png differ diff --git a/src/main/java/com/booleanuk/core/Branch.java b/src/main/java/com/booleanuk/core/Branch.java new file mode 100644 index 000000000..e110e37e7 --- /dev/null +++ b/src/main/java/com/booleanuk/core/Branch.java @@ -0,0 +1,11 @@ +package com.booleanuk.core; + +import java.util.ArrayList; + +public interface Branch { + enum Type {SAVINGS, CURRENT}; + void handleOverdraftRequest(double amountInCurrency, Account account); + void createAndAddAccount(int accountNumber, Type type); + + +} diff --git a/src/main/java/com/booleanuk/core/CurrentAccount.java b/src/main/java/com/booleanuk/core/CurrentAccount.java new file mode 100644 index 000000000..c81d4a7c1 --- /dev/null +++ b/src/main/java/com/booleanuk/core/CurrentAccount.java @@ -0,0 +1,15 @@ +package com.booleanuk.core; + +public class CurrentAccount extends Account { + private boolean overDraftRequested; + private double limit; + private double requestedLimit; + + public CurrentAccount(int prefix, int accountNumber) { + super(prefix, accountNumber); + this.limit = 0.0; + this.requestedLimit = 0.0; + this.overDraftRequested = false; + } + +} diff --git a/src/main/java/com/booleanuk/core/Extension-domain-model.md b/src/main/java/com/booleanuk/core/Extension-domain-model.md new file mode 100644 index 000000000..5dbdfefff --- /dev/null +++ b/src/main/java/com/booleanuk/core/Extension-domain-model.md @@ -0,0 +1,43 @@ +I have no idea if it's a good idea to use interfaces for this, but I still decided to use interfaces for practice. + +# Interface: Branch + +| Members | Methods | +|-----------|----------------------------------------------------------------| +| enum Type | void createAndAddAccount((int accountNumber, Type accountType) | +| | void handleOverdraftRequest(double amount, Account account) | + + +# Class: NorwayBranch + +| Implements interface | Members | Methods | Scenario | Result/Output | +|----------------------|------------------------------|---------------------------------------------------------------|----------------------------------------------------|-----------------------------------------------------------------------| +| Branch | ArrayList\ accounts | void createAndAddAccount(int accountNumber, Type accountType) | | account gets created with norwayPrefix and added to the accounts-list | +| | int norwayPrefix | void handleOverdraftRequest(double amount, Account account) | account type == SavingsAccount | Deny (do nothing) | +| | | | account type == CurrentAccount, but amount > 1000 | Deny (do nothing) | +| | | | account type == CurrentAccount, and amount <= 1000 | Accept (update the lower limit) | + + + +# Class: SwedenBranch + +| Implements interface | Members | Methods | Scenario | Result/Output | +|----------------------|------------------------------|---------------------------------------------------------------|---------------------------------------------------|-----------------------------------------------------------------------| +| Branch | ArrayList\ accounts | void createAndAddAccount(int accountNumber, Type accountType) | | account gets created with swedenPrefix and added to the accounts-list | +| | int swedenPrefix | void handleOverdraftRequest(double amount, Account account) | account type == SavingsAccount | Deny (do nothing) | +| | | | account type == CurrentAccount, but amount > 982 | Deny (do nothing) | +| | | | account type == CurrentAccount, and amount <= 982 | Accept (update the lower limit) | + + + +# Class: UKBranch + +| Implements interface | Members | Methods | Scenario | Result/Output | +|----------------------|------------------------------|---------------------------------------------------------------|--------------------------------------------------|-------------------------------------------------------------------| +| Branch | ArrayList\ accounts | void createAndAddAccount(int accountNumber, Type accountType) | | account gets created with ukPrefix and added to the accounts-list | +| | int ukPrefix | void handleOverdraftRequest(double amount, Account account) | account type == SavingsAccount | Deny (do nothing) | +| | | | account type == CurrentAccount, but amount > 72 | Deny (do nothing) | +| | | | account type == CurrentAccount, and amount <= 72 | Accept (update the lower limit) | + + + diff --git a/src/main/java/com/booleanuk/core/NorwayBranch.java b/src/main/java/com/booleanuk/core/NorwayBranch.java new file mode 100644 index 000000000..f1cd71f06 --- /dev/null +++ b/src/main/java/com/booleanuk/core/NorwayBranch.java @@ -0,0 +1,33 @@ +package com.booleanuk.core; + +import java.util.ArrayList; + +public class NorwayBranch implements Branch { + + private final ArrayList accounts = new ArrayList<>(); + private final int prefix = 1; + private double overdraftLimit = 1000.0; + + + @Override + public void handleOverdraftRequest(double amountInKroner, Account account) { + if (account instanceof CurrentAccount && account.getRequestStatus() && amountInKroner <= this.overdraftLimit) { + account.changeLimit(); + } + } + + @Override + public void createAndAddAccount(int accountNumber, Type type) { + if (type.equals(Type.SAVINGS)) { + this.accounts.add(new SavingsAccount(this.prefix, accountNumber)); + } else if (type.equals(Type.CURRENT)) { + this.accounts.add(new CurrentAccount(this.prefix, accountNumber)); + } else { + System.out.println("Invalid account type!"); + } + } + + public ArrayList getAccounts() { + return this.accounts; + } +} diff --git a/src/main/java/com/booleanuk/core/SavingsAccount.java b/src/main/java/com/booleanuk/core/SavingsAccount.java new file mode 100644 index 000000000..8f332057c --- /dev/null +++ b/src/main/java/com/booleanuk/core/SavingsAccount.java @@ -0,0 +1,8 @@ +package com.booleanuk.core; + +public class SavingsAccount extends Account { + public SavingsAccount(int prefix, int accountNumber) { + super(prefix, accountNumber); + } +//cant have overdraft +} diff --git a/src/main/java/com/booleanuk/core/SwedenBranch.java b/src/main/java/com/booleanuk/core/SwedenBranch.java new file mode 100644 index 000000000..3c042257d --- /dev/null +++ b/src/main/java/com/booleanuk/core/SwedenBranch.java @@ -0,0 +1,35 @@ +package com.booleanuk.core; + + +import java.util.ArrayList; + +public class SwedenBranch implements Branch { + + private final ArrayList accounts = new ArrayList<>(); + private final int prefix = 2; + private double overdraftLimit = 982.0; + + @Override + public void handleOverdraftRequest(double amountInKroner, Account account) { + if (account instanceof CurrentAccount && account.getRequestStatus() && amountInKroner <= this.overdraftLimit) { + account.changeLimit(); + } + } + + @Override + public void createAndAddAccount(int accountNumber, Type type) { + if (type.equals(Type.SAVINGS)) { + this.accounts.add(new SavingsAccount(this.prefix, accountNumber)); + } else if (type.equals(Type.CURRENT)) { + this.accounts.add(new CurrentAccount(this.prefix, accountNumber)); + } else { + System.out.println("Invalid account type!"); + } + } + + + public ArrayList getAccounts() { + return this.accounts; + } + +} diff --git a/src/main/java/com/booleanuk/core/Transaction.java b/src/main/java/com/booleanuk/core/Transaction.java new file mode 100644 index 000000000..1c51a95df --- /dev/null +++ b/src/main/java/com/booleanuk/core/Transaction.java @@ -0,0 +1,59 @@ +package com.booleanuk.core; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.UUID; + + +public class Transaction { + private final String date; //needs time as well!! + private double amount; + enum Type {WITHDRAWAL, DEPOSIT}; + private final Type type; + private final UUID uid; + + public Transaction(double amount){ + this.date = new SimpleDateFormat("yyyy.MM.dd HH:mm z").format(Calendar.getInstance().getTime()); + this.amount = amount; + this.type = this.setType(); + this.uid = UUID.randomUUID(); + } + + public String getDate() { + return date; + } + + //Don't want other classes to be able to set the type so this is done internally + //This means that even if a negative transaction amount is passed in, the behaviour is still expected. + private Type setType() { + if (this.amount < 0.0) { + this.amount *= -1; + return Type.WITHDRAWAL; + } else { + return Type.DEPOSIT; + } + } + + public double getAmount() { + return amount; + } + + public Type getType() { + return this.type; + } + + public UUID getUid() { + return this.uid; + } + + @Override + public String toString() { + if (this.type.equals(Type.WITHDRAWAL)) { + return String.format("%21s || %10s || %8s || ", this.date, this.amount, " "); + } else { + return String.format("%21s || %10s || %8s || ", this.date, " ", this.amount); + } + + } + +} diff --git a/src/main/java/com/booleanuk/core/UKBranch.java b/src/main/java/com/booleanuk/core/UKBranch.java new file mode 100644 index 000000000..513548e3b --- /dev/null +++ b/src/main/java/com/booleanuk/core/UKBranch.java @@ -0,0 +1,34 @@ +package com.booleanuk.core; + + +import java.util.ArrayList; + +public class UKBranch implements Branch { + + private final ArrayList accounts = new ArrayList<>(); + private final int prefix = 3; + private double overdraftLimit = 72.0; + + @Override + public void handleOverdraftRequest(double amountInKroner, Account account) { + if (account instanceof CurrentAccount && account.getRequestStatus() && amountInKroner <= this.overdraftLimit) { + account.changeLimit(); + } + } + + @Override + public void createAndAddAccount(int accountNumber, Type type) { + if (type.equals(Type.SAVINGS)) { + this.accounts.add(new SavingsAccount(this.prefix, accountNumber)); + } else if (type.equals(Type.CURRENT)) { + this.accounts.add(new CurrentAccount(this.prefix, accountNumber)); + } else { + System.out.println("Invalid account type!"); + } + } + + public ArrayList getAccounts() { + return this.accounts; + } + +} diff --git a/src/test/java/com/booleanuk/core/AccountTest.java b/src/test/java/com/booleanuk/core/AccountTest.java new file mode 100644 index 000000000..30be9630d --- /dev/null +++ b/src/test/java/com/booleanuk/core/AccountTest.java @@ -0,0 +1,60 @@ +package com.booleanuk.core; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; + +public class AccountTest { + + @Test + public void createAccountWithGivenNumber() { + //Check if an account is created correctly with default values with given number + Account accountWithGivenNumber = new Account(1, 12345678); + Assertions.assertEquals(12345678, accountWithGivenNumber.getAccountNumber()); + Assertions.assertEquals(0.0, accountWithGivenNumber.getBalance()); + Assertions.assertEquals(new ArrayList(), accountWithGivenNumber.getTransactions()); + } + + @Test + public void testMakeTransactionDeposit() { + Account account = new Account(1, 12345678); + account.makeTransaction(100.0); + Assertions.assertEquals(100.0, account.getBalance()); + Assertions.assertEquals(Transaction.Type.DEPOSIT, account.getTransactions().getFirst().getType()); + } + + @Test + public void testMakeTransactionWithdrawal() { + Account account = new Account( 1, 12345678); + account.makeTransaction(500.0); + account.makeTransaction(-100.0); + Assertions.assertEquals(400.0, account.getBalance()); + Assertions.assertEquals(Transaction.Type.WITHDRAWAL, account.getTransactions().get(1).getType()); + } + + @Test + public void testStatementGeneration() { + Account account = new Account( 1, 12345678); + account.makeTransaction(500.0); + account.makeTransaction(-100.0); + account.makeTransaction(150.0); + String date = new SimpleDateFormat("yyyy.MM.dd HH:mm z").format(Calendar.getInstance().getTime()); + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append(String.format("%21s || %10s || %8s || %8s\n", "Date", "Withdrawal", "Deposit", "Balance")); + stringbuilder.append(String.format("%21s || %10s || %8s || %8s\n", date, " ", "500.0", "500.0")); + stringbuilder.append(String.format("%21s || %10s || %8s || %8s\n", date, "100.0", " ", "400.0")); + stringbuilder.append(String.format("%21s || %10s || %8s || %8s\n", date, " ", "150.0", "550.0")); + Assertions.assertEquals(0, stringbuilder.compareTo(account.generateStatement())); + + } + + + + + + + +} diff --git a/src/test/java/com/booleanuk/core/NorwayBranchTest.java b/src/test/java/com/booleanuk/core/NorwayBranchTest.java new file mode 100644 index 000000000..951acca6c --- /dev/null +++ b/src/test/java/com/booleanuk/core/NorwayBranchTest.java @@ -0,0 +1,54 @@ +package com.booleanuk.core; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NorwayBranchTest { + + @Test + public void testAccountCreation() { + NorwayBranch norway = new NorwayBranch(); + norway.createAndAddAccount(12345678, Branch.Type.CURRENT); + Assertions.assertEquals(1, norway.getAccounts().getFirst().getPrefix()); + Assertions.assertEquals(12345678, norway.getAccounts().getFirst().getAccountNumber()); + Assertions.assertInstanceOf(CurrentAccount.class, norway.getAccounts().getFirst()); + } + + @Test + public void testValidOverdraftRequestCurrent() { + NorwayBranch norway = new NorwayBranch(); + norway.createAndAddAccount(12345678, Branch.Type.CURRENT); + norway.getAccounts().getFirst().requestOverdraft(500.0); + norway.handleOverdraftRequest(500.0, norway.getAccounts().getFirst()); + Assertions.assertEquals(-500.0, norway.getAccounts().getFirst().getLimit()); + //also check if that account now can actually use the overdraft + norway.getAccounts().getFirst().makeTransaction(-400.0); + Assertions.assertEquals(-400.0, norway.getAccounts().getFirst().getBalance()); + } + + @Test + public void testInvalidOverdraftRequest() { + NorwayBranch norway = new NorwayBranch(); + norway.createAndAddAccount(12345678, Branch.Type.CURRENT); + norway.getAccounts().getFirst().requestOverdraft(1001.0); + norway.handleOverdraftRequest(1001.0, norway.getAccounts().getFirst()); + //Limit should not have changed since 1001 > 1000 + Assertions.assertEquals(0.0, norway.getAccounts().getFirst().getLimit()); + //also check if that account can't use the overdraft + norway.getAccounts().getFirst().makeTransaction(-400.0); + Assertions.assertEquals(0.0, norway.getAccounts().getFirst().getBalance()); + + } + + @Test + public void testOverdraftRequestSavings() { + NorwayBranch norway = new NorwayBranch(); + norway.createAndAddAccount(12345678, Branch.Type.SAVINGS); + norway.getAccounts().getFirst().requestOverdraft(500.0); + norway.handleOverdraftRequest(500.0, norway.getAccounts().getFirst()); + Assertions.assertEquals(0.0, norway.getAccounts().getFirst().getLimit()); + //also check if that account still can't use the overdraft + norway.getAccounts().getFirst().makeTransaction(-400.0); + Assertions.assertEquals(0.0, norway.getAccounts().getFirst().getBalance()); + } +} diff --git a/src/test/java/com/booleanuk/core/SwedenBranchTest.java b/src/test/java/com/booleanuk/core/SwedenBranchTest.java new file mode 100644 index 000000000..fdda10c9e --- /dev/null +++ b/src/test/java/com/booleanuk/core/SwedenBranchTest.java @@ -0,0 +1,54 @@ +package com.booleanuk.core; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SwedenBranchTest { + + @Test + public void testAccountCreation() { + SwedenBranch sweden = new SwedenBranch(); + sweden.createAndAddAccount(12345678, Branch.Type.CURRENT); + Assertions.assertEquals(2, sweden.getAccounts().getFirst().getPrefix()); + Assertions.assertEquals(12345678, sweden.getAccounts().getFirst().getAccountNumber()); + Assertions.assertInstanceOf(CurrentAccount.class, sweden.getAccounts().getFirst()); + } + + @Test + public void testValidOverdraftRequestCurrent() { + SwedenBranch sweden = new SwedenBranch(); + sweden.createAndAddAccount(12345678, Branch.Type.CURRENT); + sweden.getAccounts().getFirst().requestOverdraft(50.0); + sweden.handleOverdraftRequest(50.0, sweden.getAccounts().getFirst()); + Assertions.assertEquals(-50.0, sweden.getAccounts().getFirst().getLimit()); + //also check if that account now can actually use the overdraft + sweden.getAccounts().getFirst().makeTransaction(-40.0); + Assertions.assertEquals(-40.0, sweden.getAccounts().getFirst().getBalance()); + } + + @Test + public void testInvalidOverdraftRequest() { + SwedenBranch sweden = new SwedenBranch(); + sweden.createAndAddAccount(12345678, Branch.Type.CURRENT); + sweden.getAccounts().getFirst().requestOverdraft(1001.0); + sweden.handleOverdraftRequest(1001.0, sweden.getAccounts().getFirst()); + //Limit should not have changed since 1001 > 1000 + Assertions.assertEquals(0.0, sweden.getAccounts().getFirst().getLimit()); + //also check if that account can't use the overdraft + sweden.getAccounts().getFirst().makeTransaction(-400.0); + Assertions.assertEquals(0.0, sweden.getAccounts().getFirst().getBalance()); + + } + + @Test + public void testOverdraftRequestSavings() { + SwedenBranch sweden = new SwedenBranch(); + sweden.createAndAddAccount(12345678, Branch.Type.SAVINGS); + sweden.getAccounts().getFirst().requestOverdraft(50.0); + sweden.handleOverdraftRequest(50.0, sweden.getAccounts().getFirst()); + Assertions.assertEquals(0.0, sweden.getAccounts().getFirst().getLimit()); + //also check if that account still can't use the overdraft + sweden.getAccounts().getFirst().makeTransaction(-40.0); + Assertions.assertEquals(0.0, sweden.getAccounts().getFirst().getBalance()); + } +} diff --git a/src/test/java/com/booleanuk/core/TransactionTest.java b/src/test/java/com/booleanuk/core/TransactionTest.java new file mode 100644 index 000000000..502a821ca --- /dev/null +++ b/src/test/java/com/booleanuk/core/TransactionTest.java @@ -0,0 +1,45 @@ +package com.booleanuk.core; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.text.SimpleDateFormat; +import java.util.Calendar; + +public class TransactionTest { + + + + @Test + public void testDate() { + Transaction transaction = new Transaction(100); + Assertions.assertEquals(new SimpleDateFormat("yyyy.MM.dd HH:mm z").format(Calendar.getInstance().getTime()),transaction.getDate()); + } + @Test + public void testSetType() { + Transaction deposit = new Transaction(100.0); + Assertions.assertEquals(Transaction.Type.DEPOSIT, deposit.getType()); + Assertions.assertEquals(100.0, deposit.getAmount()); + Transaction withdrawal = new Transaction((-100.0)); + Assertions.assertEquals(Transaction.Type.WITHDRAWAL, withdrawal.getType()); + Assertions.assertEquals(100.0, deposit.getAmount()); + } + + @Test + public void testFormattingDeposit() { + Transaction deposit = new Transaction(100.0); + String date = new SimpleDateFormat("yyyy.MM.dd HH:mm z").format(Calendar.getInstance().getTime()); + String testString = String.format("%21s || %10s || %8s || ", date, " ", 100.0); + Assertions.assertEquals(testString, deposit.toString()); + } + + @Test + public void testFormattingWithdrawal() { + Transaction withdrawal = new Transaction(-100.0); + String date = new SimpleDateFormat("yyyy.MM.dd HH:mm z").format(Calendar.getInstance().getTime()); + String testString = String.format("%21s || %10s || %8s || ", date, 100.0, " "); + Assertions.assertEquals(testString, withdrawal.toString()); + } + +} diff --git a/src/test/java/com/booleanuk/core/UKBranchTest.java b/src/test/java/com/booleanuk/core/UKBranchTest.java new file mode 100644 index 000000000..35280e9fa --- /dev/null +++ b/src/test/java/com/booleanuk/core/UKBranchTest.java @@ -0,0 +1,55 @@ +package com.booleanuk.core; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class UKBranchTest { + + @Test + public void testAccountCreation() { + UKBranch uk = new UKBranch(); + uk.createAndAddAccount(12345678, Branch.Type.CURRENT); + Assertions.assertEquals(3, uk.getAccounts().getFirst().getPrefix()); + Assertions.assertEquals(12345678, uk.getAccounts().getFirst().getAccountNumber()); + Assertions.assertInstanceOf(CurrentAccount.class, uk.getAccounts().getFirst()); + } + + @Test + public void testValidOverdraftRequestCurrent() { + UKBranch uk = new UKBranch(); + uk.createAndAddAccount(12345678, Branch.Type.CURRENT); + uk.getAccounts().getFirst().requestOverdraft(50.0); + uk.handleOverdraftRequest(50.0, uk.getAccounts().getFirst()); + Assertions.assertEquals(-50.0, uk.getAccounts().getFirst().getLimit()); + //also check if that account now can actually use the overdraft + uk.getAccounts().getFirst().makeTransaction(-40.0); + Assertions.assertEquals(-40.0, uk.getAccounts().getFirst().getBalance()); + } + + @Test + public void testInvalidOverdraftRequest() { + UKBranch uk = new UKBranch(); + uk.createAndAddAccount(12345678, Branch.Type.CURRENT); + uk.getAccounts().getFirst().requestOverdraft(1001.0); + uk.handleOverdraftRequest(1001.0, uk.getAccounts().getFirst()); + //Limit should not have changed since 1001 > 1000 + Assertions.assertEquals(0.0, uk.getAccounts().getFirst().getLimit()); + //also check if that account can't use the overdraft + uk.getAccounts().getFirst().makeTransaction(-400.0); + Assertions.assertEquals(0.0, uk.getAccounts().getFirst().getBalance()); + + } + + @Test + public void testOverdraftRequestSavings() { + UKBranch uk = new UKBranch(); + uk.createAndAddAccount(12345678, Branch.Type.SAVINGS); + uk.getAccounts().getFirst().requestOverdraft(50.0); + uk.handleOverdraftRequest(50.0, uk.getAccounts().getFirst()); + Assertions.assertEquals(0.0, uk.getAccounts().getFirst().getLimit()); + //also check if that account still can't use the overdraft + uk.getAccounts().getFirst().makeTransaction(-40.0); + Assertions.assertEquals(0.0, uk.getAccounts().getFirst().getBalance()); + } + +}