Skip to content
Snippets Groups Projects
Commit 6c8eb9ec authored by CONGRANLI's avatar CONGRANLI
Browse files

add some feedback

parent 624e7006
Branches
No related tags found
No related merge requests found
Pipeline #5992 passed
...@@ -269,17 +269,23 @@ public class PartitioningTests ...@@ -269,17 +269,23 @@ public class PartitioningTests
assertTrue(WeakPassphraseException); assertTrue(WeakPassphraseException);
} }
//passphrase.length >=8 containsNumCase //passphrase.length >=8 containsNumCase
@Test public void containNumCase() throws DuplicateUserException { @Test public void containNumCase() throws DuplicateUserException, swen90006.passbook.AlreadyLoggedInException, swen90006.passbook.IncorrectPassphraseException {
boolean NoSuchUserException = false;
boolean WeakPassphraseException = false; boolean WeakPassphraseException = false;
String passbookUsername = "AlexTina"; String passbookUsername = "AlexTina";
String passbookphrase = "abABCD12"; String passbookphrase = "abABCD12";
try { try {
pb.addUser(passbookUsername, passbookphrase); pb.addUser(passbookUsername, passbookphrase);
pb.loginUser(passbookUsername, passbookphrase);
} }
catch(WeakPassphraseException e) { catch(WeakPassphraseException e) {
WeakPassphraseException = true; WeakPassphraseException = true;
} }
catch(NoSuchUserException e) {
NoSuchUserException = true;
}
assertFalse(WeakPassphraseException); assertFalse(WeakPassphraseException);
assertFalse(NoSuchUserException);
} }
//------------------------------loginUser Test Cases------------------------------------- //------------------------------loginUser Test Cases-------------------------------------
...@@ -359,20 +365,27 @@ public class PartitioningTests ...@@ -359,20 +365,27 @@ public class PartitioningTests
} }
//passphrase is equale to the saved one //passphrase is equale to the saved one
@Test public void IncorrectPassphraseException2() throws WeakPassphraseException, DuplicateUserException, AlreadyLoggedInException, IncorrectPassphraseException, NoSuchUserException { @Test public void IncorrectPassphraseException2() throws WeakPassphraseException, DuplicateUserException, AlreadyLoggedInException, IncorrectPassphraseException, NoSuchUserException, MalformedURLException, InvalidSessionIDException {
boolean IncorrectPassphraseException = false; boolean IncorrectPassphraseException = false;
boolean InvalidSessionIDException = false;
String passbookUsername = "AlexTina"; String passbookUsername = "AlexTina";
String passbookphrase = "Abc234hg"; String passbookphrase = "Abc234hg";
String passbookUsername2 = "AlexTina"; URL url = new URL ("http:AlexTinaAbc234hg");
String passbookphrase2 = "Abc234hg"; String urlUsername = "AlexTina";
String urlPassword = "Abc234hg";
try { try {
pb.addUser(passbookUsername,passbookphrase); pb.addUser(passbookUsername,passbookphrase);
pb.loginUser(passbookUsername2,passbookphrase2); pb.updateDetails( pb.loginUser(passbookUsername,passbookphrase), url, urlUsername, urlPassword);
} }
catch (IncorrectPassphraseException e){ catch (IncorrectPassphraseException e){
IncorrectPassphraseException = true; IncorrectPassphraseException = true;
} }
catch (InvalidSessionIDException e) {
InvalidSessionIDException = true;
}
assertFalse(IncorrectPassphraseException); assertFalse(IncorrectPassphraseException);
assertFalse(InvalidSessionIDException);
} }
...@@ -448,6 +461,7 @@ public class PartitioningTests ...@@ -448,6 +461,7 @@ public class PartitioningTests
//urlUsername != null && urlPassword !=null //urlUsername != null && urlPassword !=null
@Test public void checkRemove() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { @Test public void checkRemove() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException {
boolean InvalidSessionIDException = false;
boolean NoSuchUserException = false; boolean NoSuchUserException = false;
Integer sessionID ; Integer sessionID ;
String Username = "AlexTina"; String Username = "AlexTina";
...@@ -464,11 +478,16 @@ public class PartitioningTests ...@@ -464,11 +478,16 @@ public class PartitioningTests
catch (NoSuchURLException e){ catch (NoSuchURLException e){
NoSuchUserException = true; NoSuchUserException = true;
} }
catch(InvalidSessionIDException e) {
InvalidSessionIDException = true;
}
assertFalse(NoSuchUserException); assertFalse(NoSuchUserException);
assertFalse(InvalidSessionIDException);
} }
//urlUsername = null || urlPassword !=null //urlUsername = null || urlPassword !=null
@Test public void checkRemove2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { @Test public void checkRemove2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException {
boolean InvalidSessionIDException = false;
boolean NoSuchUserException = false; boolean NoSuchUserException = false;
Integer sessionID ; Integer sessionID ;
String Username = "AlexTina"; String Username = "AlexTina";
...@@ -485,10 +504,16 @@ public class PartitioningTests ...@@ -485,10 +504,16 @@ public class PartitioningTests
catch (NoSuchURLException e){ catch (NoSuchURLException e){
NoSuchUserException = true; NoSuchUserException = true;
} }
catch(InvalidSessionIDException e) {
InvalidSessionIDException = true;
}
assertFalse(InvalidSessionIDException);
assertTrue(NoSuchUserException); assertTrue(NoSuchUserException);
} }
//urlUsername != null || urlPassword =null //urlUsername != null || urlPassword =null
@Test public void checkRemove3() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { @Test public void checkRemove3() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException {
boolean InvalidSessionIDException = false;
boolean NoSuchUserException = false; boolean NoSuchUserException = false;
Integer sessionID ; Integer sessionID ;
String Username = "AlexTina"; String Username = "AlexTina";
...@@ -505,10 +530,16 @@ public class PartitioningTests ...@@ -505,10 +530,16 @@ public class PartitioningTests
catch (NoSuchURLException e){ catch (NoSuchURLException e){
NoSuchUserException = true; NoSuchUserException = true;
} }
catch(InvalidSessionIDException e) {
InvalidSessionIDException = true;
}
assertFalse(InvalidSessionIDException);
assertTrue(NoSuchUserException); assertTrue(NoSuchUserException);
} }
//urlUsername != null || urlPassword !=null //urlUsername != null || urlPassword !=null
@Test public void checkRemove4() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { @Test public void checkRemove4() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException {
boolean InvalidSessionIDException = false;
boolean NoSuchUserException = false; boolean NoSuchUserException = false;
Integer sessionID ; Integer sessionID ;
String Username = "AlexTina"; String Username = "AlexTina";
...@@ -525,6 +556,10 @@ public class PartitioningTests ...@@ -525,6 +556,10 @@ public class PartitioningTests
catch (NoSuchURLException e){ catch (NoSuchURLException e){
NoSuchUserException = true; NoSuchUserException = true;
} }
catch(InvalidSessionIDException e) {
InvalidSessionIDException = true;
}
assertFalse(InvalidSessionIDException);
assertTrue(NoSuchUserException); assertTrue(NoSuchUserException);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment