diff --git a/tests/Boundary/swen90006/passbook/BoundaryTests.java b/tests/Boundary/swen90006/passbook/BoundaryTests.java index fbae8682d6faad22b6f4b5eb8d25e4170421fd2c..7b0c52d0dc473e1c8bebafb40ec4a329aa349c0c 100755 --- a/tests/Boundary/swen90006/passbook/BoundaryTests.java +++ b/tests/Boundary/swen90006/passbook/BoundaryTests.java @@ -41,7 +41,6 @@ public class BoundaryTests assertFalse(WeakPassphraseException); } - - + } diff --git a/tests/Partitioning/swen90006/passbook/PartitioningTests.java b/tests/Partitioning/swen90006/passbook/PartitioningTests.java index 5dc1d450fa19853c7845c37a4182fdd558b3b5ab..3747384e87b2f53f8b43b8e2919b957693253c6d 100755 --- a/tests/Partitioning/swen90006/passbook/PartitioningTests.java +++ b/tests/Partitioning/swen90006/passbook/PartitioningTests.java @@ -76,7 +76,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); } @@ -114,72 +114,9 @@ public class PartitioningTests assertFalse(WeakPassphraseException); } - // passphrase.length = 8 && passphrase only contain one kind factory in Lower, Upper and Number + - @Test public void Contains() throws DuplicateUserException - { - boolean WeakPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "AAAABBBC"; - try{ - pb.addUser(passbookUsername,passbookphrase); - } - catch (WeakPassphraseException e){ - WeakPassphraseException = true; - } - assertTrue(WeakPassphraseException); - } - - // passphrase.length = 8 && passphrase only contain two kind factory in Lower, Upper and Number - - @Test public void Contains2() throws DuplicateUserException - { - boolean WeakPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "AAA2232C"; - try{ - pb.addUser(passbookUsername,passbookphrase); - } - catch (WeakPassphraseException e){ - WeakPassphraseException = true; - } - assertTrue(WeakPassphraseException); - } - - // passphrase.length = 8 && passphrase contain no kind factory in Lower, Upper and Number - - @Test public void Contains3() throws DuplicateUserException - { - boolean WeakPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "^&*($%@#"; - try{ - pb.addUser(passbookUsername,passbookphrase); - } - catch (WeakPassphraseException e){ - WeakPassphraseException = true; - } - assertTrue(WeakPassphraseException); - } - - // passphrase.length = 8 && passphrase contain all kinds factory in Lower, Upper and Number - - @Test public void Contains4() throws DuplicateUserException - { - boolean WeakPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "Ab23cd54"; - try{ - pb.addUser(passbookUsername,passbookphrase); - } - catch (WeakPassphraseException e){ - WeakPassphraseException = true; - } - assertFalse(WeakPassphraseException); - } - - - // passphrase.length > 8 && passphrase only contain one kind factory in Lower, Upper and Number + // passphrase.length >= 8 && passphrase not fit the requirement @Test public void Contains5() throws DuplicateUserException { @@ -195,41 +132,10 @@ public class PartitioningTests assertTrue(WeakPassphraseException); } - // passphrase.length > 8 && passphrase only contain two kind factory in Lower, Upper and Number - @Test public void Contains6() throws DuplicateUserException - { - boolean WeakPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "AAA223293289312C"; - try{ - pb.addUser(passbookUsername,passbookphrase); - } - catch (WeakPassphraseException e){ - WeakPassphraseException = true; - } - assertTrue(WeakPassphraseException); - } - - // passphrase.length > 8 && passphrase contain no kind factory in Lower, Upper and Number + // passphrase.length >= 8 && passphrase contain all kinds factory in Lower, Upper and Number - @Test public void Contains7() throws DuplicateUserException - { - boolean WeakPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "^&*($%@#%^&*("; - try{ - pb.addUser(passbookUsername,passbookphrase); - } - catch (WeakPassphraseException e){ - WeakPassphraseException = true; - } - assertTrue(WeakPassphraseException); - } - - // passphrase.length > 8 && passphrase contain all kinds factory in Lower, Upper and Number - - @Test public void Contains8() throws DuplicateUserException + @Test public void Contains6() throws DuplicateUserException { boolean WeakPassphraseException = false; String passbookUsername = "AlexTina"; @@ -277,22 +183,7 @@ public class PartitioningTests assertTrue(NoSuchUserException); } - // username is NULL - @Test public void NoSuchUserException3() throws NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException { - boolean NoSuchUserException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "Abc234hg"; - String passbookUsername2 = ""; - String passbookphrase2 = "Abc234hg"; - try { - pb.addUser(passbookUsername,passbookphrase); - pb.loginUser(passbookUsername2,passbookphrase2); - } - catch (NoSuchUserException e){ - NoSuchUserException = true; - } - assertTrue(NoSuchUserException); - } + // user has login @Test public void AlreadyLoggedInException() throws NoSuchUserException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException { boolean AlreadyLoggedInException = false; @@ -364,22 +255,7 @@ public class PartitioningTests } assertFalse(IncorrectPassphraseException); } - //passphrase is NULL - @Test public void IncorrectPassphraseException3() throws WeakPassphraseException, DuplicateUserException, AlreadyLoggedInException, IncorrectPassphraseException, NoSuchUserException { - boolean IncorrectPassphraseException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "Abc234hg"; - String passbookUsername2 = "AlexTina"; - String passbookphrase2 = ""; - try { - pb.addUser(passbookUsername,passbookphrase); - pb.loginUser(passbookUsername2,passbookphrase2); - } - catch (IncorrectPassphraseException e){ - IncorrectPassphraseException = true; - } - assertTrue(IncorrectPassphraseException); - } + //------------------------------updateDetails Test Cases------------------------------------- @@ -490,7 +366,7 @@ public class PartitioningTests assertFalse(NoSuchUserException); } - //urlUsername = null || urlPassword !=null + //!(urlUsername =! null || urlPassword !=null) @Test public void checkRemove2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { boolean NoSuchUserException = false; Integer sessionID ; @@ -510,46 +386,7 @@ public class PartitioningTests } assertTrue(NoSuchUserException); } - //urlUsername != null || urlPassword =null - @Test public void checkRemove3() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { - boolean NoSuchUserException = false; - Integer sessionID ; - String Username = "AlexTina"; - String Password = "Abc234hg"; - String urlUsername = "AlexTina"; - String urlPassword = null; - pb.addUser(Username,Password); - sessionID = pb.loginUser(Username,Password); - try{ - URL url = new URL ("http:AlexTinaAbc234hg"); - pb.updateDetails(sessionID,url,urlUsername,urlPassword); - pb.retrieveDetails(sessionID,url); - } - catch (NoSuchURLException e){ - NoSuchUserException = true; - } - assertTrue(NoSuchUserException); - } - //urlUsername != null || urlPassword !=null - @Test public void checkRemove4() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { - boolean NoSuchUserException = false; - Integer sessionID ; - String Username = "AlexTina"; - String Password = "Abc234hg"; - String urlUsername = null; - String urlPassword = null; - pb.addUser(Username,Password); - sessionID = pb.loginUser(Username,Password); - try{ - URL url = new URL ("http:AlexTinaAbc234hg"); - pb.updateDetails(sessionID,url,urlUsername,urlPassword); - pb.retrieveDetails(sessionID,url); - } - catch (NoSuchURLException e){ - NoSuchUserException = true; - } - assertTrue(NoSuchUserException); - } + //------------------------------retrieveDetails Test Cases------------------------------------- //InvalidSessionIDException @@ -685,26 +522,6 @@ public class PartitioningTests - @Test public void aTest() - { - //the assertEquals method used to check whether two values are - //equal, using the equals method - final int expected = 2; - final int actual = 1 + 1; - assertEquals(expected, actual); - } - - - //To test an exception, specify the expected exception after the @Test - @Test(expected = java.io.IOException.class) - public void anExceptionTest() - throws Throwable - { - throw new java.io.IOException(); - } - - //This test should fail. - //To provide additional feedback when a test fails, an error message - //can be included + }