Skip to content

Commit

Permalink
Merge pull request #41 from fkamau1/luhnsAlgorithm-test
Browse files Browse the repository at this point in the history
Luhns algorithm test
  • Loading branch information
fkamau1 authored Dec 4, 2023
2 parents d28f68e + b24e210 commit 7e69beb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/src/test/java/bankingapp/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@ public void testCreateAccount(){
//Ensure PIN is a 4 digit number
assertEquals(4, String.valueOf(pin).length());


//Asserts
assertNotNull(accountNum);
assertTrue(CreateAccount.luhnsAlgorithmCheck(accountNum));
}

@Test
public void testLuhnsAlgorithmValid(){
//Test an actual number already passing luhns algorith check
assertTrue(CreateAccount.luhnsAlgorithmCheck( "502091324785"));
}

@Test
public void testLuhnsAlgorithmInvalid(){
//Test an invalid number
assertFalse(CreateAccount.luhnsAlgorithmCheck( "1234567891234"));
}

}

0 comments on commit 7e69beb

Please sign in to comment.