From 32e9550adfb7a46dd1e5a89c3c6062ea29c0e2d2 Mon Sep 17 00:00:00 2001 From: fkamau Date: Sun, 3 Dec 2023 19:22:07 -0600 Subject: [PATCH 1/2] Start work on issue #39 From b24e210b3954bfaebbaca26c6cdee6c054ba3cbc Mon Sep 17 00:00:00 2001 From: fkamau Date: Sun, 3 Dec 2023 19:25:42 -0600 Subject: [PATCH 2/2] Create luhnsAlgorithm tests #39 --- app/src/test/java/bankingapp/AppTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/bankingapp/AppTest.java b/app/src/test/java/bankingapp/AppTest.java index 574d930..40ba420 100644 --- a/app/src/test/java/bankingapp/AppTest.java +++ b/app/src/test/java/bankingapp/AppTest.java @@ -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")); + } + }