From 624e70069fe5091e4763d03690430be0ddfc6c08 Mon Sep 17 00:00:00 2001 From: CONGRANLI <907112284@qq.com> Date: Fri, 6 Sep 2019 07:11:32 +1000 Subject: [PATCH] another --- .../swen90006/passbook/BoundaryTests.java | 50 ++++++++-------- .../swen90006/passbook/PartitioningTests.java | 60 ++++++++++++++++++- 2 files changed, 81 insertions(+), 29 deletions(-) diff --git a/tests/Boundary/swen90006/passbook/BoundaryTests.java b/tests/Boundary/swen90006/passbook/BoundaryTests.java index 2109c80..782c560 100755 --- a/tests/Boundary/swen90006/passbook/BoundaryTests.java +++ b/tests/Boundary/swen90006/passbook/BoundaryTests.java @@ -14,37 +14,35 @@ import static org.junit.Assert.*; public class BoundaryTests extends PartitioningTests { - - //Test on point 7 - @Test public void WeakPassphraseException() throws DuplicateUserException { - boolean WeakPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "123Abcd"; - try{ - pb.addUser(passbookUsername,passbookphrase); - }catch(WeakPassphraseException e){ - WeakPassphraseException = true; - } - assertTrue(WeakPassphraseException); + + @Test public void ascLowerCase() throws DuplicateUserException { + boolean WeakPassphraseException = false; + String passbookUsername = "AlexTina"; + String passbookphrase = "'{A11234"; + try { + pb.addUser(passbookUsername, passbookphrase); + }catch(WeakPassphraseException e) { + WeakPassphraseException = true; + } + assertTrue(WeakPassphraseException); } - - //Test on point 8 - @Test public void WeakPassphraseException2() throws DuplicateUserException { - boolean WeakPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "1234ABCd"; - try{ - pb.addUser(passbookUsername,passbookphrase); - }catch(WeakPassphraseException e){ - WeakPassphraseException = true; - } - assertFalse(WeakPassphraseException); + + @Test public void ascUpperCase() throws DuplicateUserException { + boolean WeakPassphraseException = false; + String passbookUsername = "AlexTina"; + String passbookphrase = "@[abc234"; + try { + pb.addUser(passbookUsername, passbookphrase); + }catch(WeakPassphraseException e) { + WeakPassphraseException = true; + } + assertTrue(WeakPassphraseException); } - @Test public void Contains3() throws DuplicateUserException { + @Test public void ascNumCase() throws DuplicateUserException { boolean WeakPassphraseException = false; String passbookUsername = "AlexTina"; - String passbookphrase = "'{@[/:Cd"; + String passbookphrase = ":/Abcdef"; try { pb.addUser(passbookUsername, passbookphrase); }catch(WeakPassphraseException e) { diff --git a/tests/Partitioning/swen90006/passbook/PartitioningTests.java b/tests/Partitioning/swen90006/passbook/PartitioningTests.java index 04b52bd..4e95102 100755 --- a/tests/Partitioning/swen90006/passbook/PartitioningTests.java +++ b/tests/Partitioning/swen90006/passbook/PartitioningTests.java @@ -59,7 +59,7 @@ public class PartitioningTests @Test public void WeakPassphraseException() throws DuplicateUserException{ boolean WeakPassphraseException = false; String passbookUsername = "AlexTina"; - String passbookphrase = "Ab23"; + String passbookphrase = "Ab23333"; try{ pb.addUser(passbookUsername,passbookphrase); } @@ -96,8 +96,7 @@ public class PartitioningTests } assertFalse(WeakPassphraseException); } -*/ - + // passphrase.length = 8 && passphrase only contain one kind factory in Lower, Upper and Number @@ -227,6 +226,61 @@ public class PartitioningTests } assertFalse(WeakPassphraseException); } + */ + //passphrase.length >=8 not containsLowerCase + @Test public void NocontainLowerCase() throws DuplicateUserException { + boolean WeakPassphraseException = false; + String passbookUsername = "AlexTina"; + String passbookphrase = "ABCD1234"; + try { + pb.addUser(passbookUsername, passbookphrase); + } + catch(WeakPassphraseException e) { + WeakPassphraseException = true; + } + assertTrue(WeakPassphraseException); + } + + //passphrase.length >=8 not containsUpperCase + @Test public void NocontainUpperCase() throws DuplicateUserException { + boolean WeakPassphraseException = false; + String passbookUsername = "AlexTina"; + String passbookphrase = "abcd1234"; + try { + pb.addUser(passbookUsername, passbookphrase); + } + catch(WeakPassphraseException e) { + WeakPassphraseException = true; + } + assertTrue(WeakPassphraseException); + } + + //passphrase.length >=8 not containsNumCase + @Test public void NocontainNumCase() throws DuplicateUserException { + boolean WeakPassphraseException = false; + String passbookUsername = "AlexTina"; + String passbookphrase = "abcdABCD"; + try { + pb.addUser(passbookUsername, passbookphrase); + } + catch(WeakPassphraseException e) { + WeakPassphraseException = true; + } + assertTrue(WeakPassphraseException); + } + //passphrase.length >=8 containsNumCase + @Test public void containNumCase() throws DuplicateUserException { + boolean WeakPassphraseException = false; + String passbookUsername = "AlexTina"; + String passbookphrase = "abABCD12"; + try { + pb.addUser(passbookUsername, passbookphrase); + } + catch(WeakPassphraseException e) { + WeakPassphraseException = true; + } + assertFalse(WeakPassphraseException); + } //------------------------------loginUser Test Cases------------------------------------- -- GitLab