Skip to content

Commit

Permalink
Create test cases for CreateAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
fkamau committed Dec 4, 2023
1 parent c4e3934 commit e1e2b4a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/src/test/java/bankingapp/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,25 @@ public void testCreateAccount(){
//Method to create account
CreateAccount account = new CreateAccount();

//Generate account number
//Test generating account number
account.setAccountNumber();

//Validate
//Validate account number
String accountNum = account.getAccountNumber();

//Test setting PIN number
account.setPinNumber();

//Validate PIN number
int pin = account.getPinNumber();

//Ensure the generated PIN number is within pin >=1000 && pin <= 9999
assertTrue(pin >= 1000 && pin <= 9999);

//Ensure PIN is a 4 digit number
assertEquals(4, String.valueOf(pin).length());


//Asserts
assertNotNull(accountNum);
assertTrue(CreateAccount.luhnsAlgorithmCheck(accountNum));
Expand Down

0 comments on commit e1e2b4a

Please sign in to comment.