diff --git a/tests/Partitioning/swen90006/passbook/PartitioningTests.java b/tests/Partitioning/swen90006/passbook/PartitioningTests.java index c581067e47cb0f90dfa0034977a826298982d6a0..04b52bd17bf5d7652b47cdf3ed4469c500fdc702 100755 --- a/tests/Partitioning/swen90006/passbook/PartitioningTests.java +++ b/tests/Partitioning/swen90006/passbook/PartitioningTests.java @@ -51,24 +51,7 @@ public class PartitioningTests } - //Not Existed Username in PASSBOOK - @Test public void DuplicateUserTest2() throws WeakPassphraseException, DuplicateUserException { - boolean DuplicateUserException = false; - String passbookUsername = "ALexTina"; - String passbookphrase = "Abcd1234"; - String passbookUsername2 = "TinaAlex"; - String passbookphrase2 = "1234Abcd"; - try{ - pb.addUser(passbookUsername, passbookphrase); - pb.addUser(passbookUsername2, passbookphrase2); - } - catch(DuplicateUserException e){ - DuplicateUserException = true; - } - assertFalse (DuplicateUserException); ; - - } - + //WeakPassphraseException Test cases @@ -86,7 +69,7 @@ public class PartitioningTests assertTrue(WeakPassphraseException); } - //Passphrase = 8 + /* //Passphrase = 8 @Test public void WeakPassphraseException2() throws DuplicateUserException{ boolean WeakPassphraseException = false; String passbookUsername = "AlexTina"; @@ -113,7 +96,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 @@ -245,20 +230,6 @@ public class PartitioningTests //------------------------------loginUser Test Cases------------------------------------- - // user is in passbook - @Test public void NoSuchUserException() throws NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException { - boolean NoSuchUserException = false; - String passbookUsername = "AlexTina"; - String passbookphrase = "Abc234hg"; - try { - pb.addUser(passbookUsername,passbookphrase); - pb.loginUser(passbookUsername,passbookphrase); - } - catch (NoSuchUserException e){ - NoSuchUserException = true; - } - assertFalse(NoSuchUserException); - } // user is not in passbook @Test public void NoSuchUserException2() throws NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException { @@ -296,7 +267,7 @@ public class PartitioningTests assertTrue(AlreadyLoggedInException); } - //user has not login + /* //user has not login @Test public void AlreadyLoggedInException2() throws NoSuchUserException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException { boolean AlreadyLoggedInException = false; String passbookUsername = "AlexTina"; @@ -315,7 +286,7 @@ public class PartitioningTests } assertFalse(AlreadyLoggedInException); } - +*/ //passphrase is not equale to the saved one @Test public void IncorrectPassphraseException() throws WeakPassphraseException, DuplicateUserException, AlreadyLoggedInException, IncorrectPassphraseException, NoSuchUserException { boolean IncorrectPassphraseException = false; @@ -355,25 +326,6 @@ public class PartitioningTests //InvalidSessionIDException -// sessionID exist -@Test public void InvalidSessionIDException() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, InvalidSessionIDException { - boolean InvalidSessionIDException = false; - Integer sessionID ; - URL url = new URL ("http:AlexTinaAbc234hg"); - String Username = "AlexTina"; - String Password = "Abc234hg"; - String urlUsername = "AlexTina"; - String urlPassword = "Abc234hg"; - pb.addUser(Username,Password); - sessionID = pb.loginUser(Username,Password); - try{ - pb.updateDetails(sessionID,url,urlUsername,urlPassword); - }catch (InvalidSessionIDException e){ - InvalidSessionIDException = true; - } - assertFalse(InvalidSessionIDException); - -} // sessionID not exist @Test public void InvalidSessionIDException2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, InvalidSessionIDException { boolean InvalidSessionIDException = false; @@ -397,6 +349,7 @@ public class PartitioningTests //MalformedURLException + /* //Protocol = [http,https] @Test public void MalformedURLException() throws MalformedURLException, WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException { @@ -416,7 +369,7 @@ public class PartitioningTests } assertFalse(MalformedURLException); } - +*/ //Protocol != [http,https] @Test public void MalformedURLException2() throws MalformedURLException, WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException { @@ -524,7 +477,7 @@ public class PartitioningTests //------------------------------retrieveDetails Test Cases------------------------------------- //InvalidSessionIDException - // sessionID exist + /* // sessionID exist @Test public void InvalidSessionIDExceptionRE() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, NoSuchURLException { boolean InvalidSessionIDException = false; Integer sessionID ; @@ -545,6 +498,8 @@ public class PartitioningTests assertFalse(InvalidSessionIDException); } + */ + // sessionID not exist @Test public void InvalidSessionIDExceptionRE2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, NoSuchURLException { boolean InvalidSessionIDException = false; @@ -565,9 +520,28 @@ public class PartitioningTests } assertTrue(InvalidSessionIDException); + } + //contain http,http: + + @Test public void MalformedURLException3() throws MalformedURLException, WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException { + boolean MalformedURLException = false; + Integer sessionID ; + String Username = "AlexTina"; + String Password = "Abc234hg"; + String urlUsername = "AlexTina"; + String urlPassword = "Abc234hg"; + pb.addUser(Username,Password); + sessionID = pb.loginUser(Username,Password); + try{ + URL url = new URL ("TPP:AlexTinaAbc234hg"); + pb.updateDetails(sessionID,url,urlUsername,urlPassword); + }catch ( MalformedURLException e){ + MalformedURLException = true; + } + assertTrue(MalformedURLException); } // NoSuchURLException - // pt!=null + /* // pt!=null @Test public void NoSuchURLException() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { boolean NoSuchURLException = false; Integer sessionID ; @@ -587,6 +561,7 @@ public class PartitioningTests } assertFalse(NoSuchURLException); } + */ //pt==null @Test public void NoSuchURLException2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { boolean NoSuchURLException = false;