Skip to content
Snippets Groups Projects
Commit 139b8121 authored by CONGRANLI's avatar CONGRANLI
Browse files

BIG CHANGE

parent d8bd33bd
No related branches found
No related tags found
No related merge requests found
Pipeline #5854 passed
...@@ -51,23 +51,6 @@ public class PartitioningTests ...@@ -51,23 +51,6 @@ 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 //WeakPassphraseException Test cases
...@@ -86,7 +69,7 @@ public class PartitioningTests ...@@ -86,7 +69,7 @@ public class PartitioningTests
assertTrue(WeakPassphraseException); assertTrue(WeakPassphraseException);
} }
//Passphrase = 8 /* //Passphrase = 8
@Test public void WeakPassphraseException2() throws DuplicateUserException{ @Test public void WeakPassphraseException2() throws DuplicateUserException{
boolean WeakPassphraseException = false; boolean WeakPassphraseException = false;
String passbookUsername = "AlexTina"; String passbookUsername = "AlexTina";
...@@ -113,6 +96,8 @@ public class PartitioningTests ...@@ -113,6 +96,8 @@ public class PartitioningTests
} }
assertFalse(WeakPassphraseException); assertFalse(WeakPassphraseException);
} }
*/
// passphrase.length = 8 && passphrase only contain one kind factory in Lower, Upper and Number // passphrase.length = 8 && passphrase only contain one kind factory in Lower, Upper and Number
...@@ -245,20 +230,6 @@ public class PartitioningTests ...@@ -245,20 +230,6 @@ public class PartitioningTests
//------------------------------loginUser Test Cases------------------------------------- //------------------------------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 // user is not in passbook
@Test public void NoSuchUserException2() throws NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException { @Test public void NoSuchUserException2() throws NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException {
...@@ -296,7 +267,7 @@ public class PartitioningTests ...@@ -296,7 +267,7 @@ public class PartitioningTests
assertTrue(AlreadyLoggedInException); assertTrue(AlreadyLoggedInException);
} }
//user has not login /* //user has not login
@Test public void AlreadyLoggedInException2() throws NoSuchUserException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException { @Test public void AlreadyLoggedInException2() throws NoSuchUserException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException {
boolean AlreadyLoggedInException = false; boolean AlreadyLoggedInException = false;
String passbookUsername = "AlexTina"; String passbookUsername = "AlexTina";
...@@ -315,7 +286,7 @@ public class PartitioningTests ...@@ -315,7 +286,7 @@ public class PartitioningTests
} }
assertFalse(AlreadyLoggedInException); assertFalse(AlreadyLoggedInException);
} }
*/
//passphrase is not equale to the saved one //passphrase is not equale to the saved one
@Test public void IncorrectPassphraseException() throws WeakPassphraseException, DuplicateUserException, AlreadyLoggedInException, IncorrectPassphraseException, NoSuchUserException { @Test public void IncorrectPassphraseException() throws WeakPassphraseException, DuplicateUserException, AlreadyLoggedInException, IncorrectPassphraseException, NoSuchUserException {
boolean IncorrectPassphraseException = false; boolean IncorrectPassphraseException = false;
...@@ -355,25 +326,6 @@ public class PartitioningTests ...@@ -355,25 +326,6 @@ public class PartitioningTests
//InvalidSessionIDException //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 // sessionID not exist
@Test public void InvalidSessionIDException2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, InvalidSessionIDException { @Test public void InvalidSessionIDException2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, InvalidSessionIDException {
boolean InvalidSessionIDException = false; boolean InvalidSessionIDException = false;
...@@ -397,6 +349,7 @@ public class PartitioningTests ...@@ -397,6 +349,7 @@ public class PartitioningTests
//MalformedURLException //MalformedURLException
/*
//Protocol = [http,https] //Protocol = [http,https]
@Test public void MalformedURLException() throws MalformedURLException, WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException { @Test public void MalformedURLException() throws MalformedURLException, WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException {
...@@ -416,7 +369,7 @@ public class PartitioningTests ...@@ -416,7 +369,7 @@ public class PartitioningTests
} }
assertFalse(MalformedURLException); assertFalse(MalformedURLException);
} }
*/
//Protocol != [http,https] //Protocol != [http,https]
@Test public void MalformedURLException2() throws MalformedURLException, WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException { @Test public void MalformedURLException2() throws MalformedURLException, WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException {
...@@ -524,7 +477,7 @@ public class PartitioningTests ...@@ -524,7 +477,7 @@ public class PartitioningTests
//------------------------------retrieveDetails Test Cases------------------------------------- //------------------------------retrieveDetails Test Cases-------------------------------------
//InvalidSessionIDException //InvalidSessionIDException
// sessionID exist /* // sessionID exist
@Test public void InvalidSessionIDExceptionRE() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, NoSuchURLException { @Test public void InvalidSessionIDExceptionRE() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, NoSuchURLException {
boolean InvalidSessionIDException = false; boolean InvalidSessionIDException = false;
Integer sessionID ; Integer sessionID ;
...@@ -545,6 +498,8 @@ public class PartitioningTests ...@@ -545,6 +498,8 @@ public class PartitioningTests
assertFalse(InvalidSessionIDException); assertFalse(InvalidSessionIDException);
} }
*/
// sessionID not exist // sessionID not exist
@Test public void InvalidSessionIDExceptionRE2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, NoSuchURLException { @Test public void InvalidSessionIDExceptionRE2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, MalformedURLException, NoSuchURLException {
boolean InvalidSessionIDException = false; boolean InvalidSessionIDException = false;
...@@ -565,9 +520,28 @@ public class PartitioningTests ...@@ -565,9 +520,28 @@ public class PartitioningTests
} }
assertTrue(InvalidSessionIDException); 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 // NoSuchURLException
// pt!=null /* // pt!=null
@Test public void NoSuchURLException() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { @Test public void NoSuchURLException() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException {
boolean NoSuchURLException = false; boolean NoSuchURLException = false;
Integer sessionID ; Integer sessionID ;
...@@ -587,6 +561,7 @@ public class PartitioningTests ...@@ -587,6 +561,7 @@ public class PartitioningTests
} }
assertFalse(NoSuchURLException); assertFalse(NoSuchURLException);
} }
*/
//pt==null //pt==null
@Test public void NoSuchURLException2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException { @Test public void NoSuchURLException2() throws WeakPassphraseException, DuplicateUserException, NoSuchUserException, AlreadyLoggedInException, IncorrectPassphraseException, InvalidSessionIDException, MalformedURLException, NoSuchURLException {
boolean NoSuchURLException = false; boolean NoSuchURLException = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment