Skip to content
Snippets Groups Projects
Commit 11d82c6e authored by CONGRANLI's avatar CONGRANLI
Browse files

recover

parent f3dfabce
No related branches found
No related tags found
No related merge requests found
Pipeline #5733 passed
......@@ -41,6 +41,11 @@ public class BoundaryTests
assertFalse(WeakPassphraseException);
}
@Test public void ASCII() {
boolean WeakPassphraseException = false;
}
}
......@@ -76,7 +76,7 @@ public class PartitioningTests
@Test public void WeakPassphraseException() throws DuplicateUserException{
boolean WeakPassphraseException = false;
String passbookUsername = "AlexTina";
String passbookphrase = "Ab23333";
String passbookphrase = "Ab23";
try{
pb.addUser(passbookUsername,passbookphrase);
}
......@@ -114,9 +114,72 @@ 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 not fit the requirement
// passphrase.length > 8 && passphrase only contain one kind factory in Lower, Upper and Number
@Test public void Contains5() throws DuplicateUserException
{
......@@ -132,10 +195,41 @@ public class PartitioningTests
assertTrue(WeakPassphraseException);
}
// passphrase.length >= 8 && passphrase contain all kinds factory in Lower, Upper and Number
// 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
@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
{
boolean WeakPassphraseException = false;
String passbookUsername = "AlexTina";
......@@ -183,7 +277,22 @@ 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;
......@@ -255,7 +364,22 @@ 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-------------------------------------
......@@ -366,7 +490,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 ;
......@@ -386,7 +510,46 @@ 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
......@@ -522,6 +685,4 @@ public class PartitioningTests
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment