diff --git a/tests/Boundary/swen90006/passbook/BoundaryTests.java b/tests/Boundary/swen90006/passbook/BoundaryTests.java index 2109c80f45f71f1c4e3f7c322020d02831915fbb..782c560d0a5df475b1af38c5786b32737a03fb3d 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 04b52bd17bf5d7652b47cdf3ed4469c500fdc702..4e951029c21281472dc43a9b938cf8ba30ec4f55 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-------------------------------------