Skip to content
Snippets Groups Projects
Commit 17f87efd authored by CONGRANLI's avatar CONGRANLI
Browse files

add a new partation

parent d925faa1
Branches
No related tags found
No related merge requests found
Pipeline #5604 passed
...@@ -293,6 +293,43 @@ public class PartitioningTests ...@@ -293,6 +293,43 @@ public class PartitioningTests
} }
assertTrue(NoSuchUserException); assertTrue(NoSuchUserException);
} }
// user has login
@Test public void AlreadyLoggedInException() throws NoSuchUserException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException {
boolean AlreadyLoggedInException = false;
String passbookUsername = "AlexTina";
String passbookphrase = "Abc234hg";
String passbookUsername2 = "AlexTina";
String passbookphrase2 = "Abc234hg";
try{
pb.addUser(passbookUsername,passbookphrase);
pb.loginUser(passbookUsername,passbookphrase);
pb.loginUser(passbookUsername2,passbookphrase2);
}
catch (AlreadyLoggedInException e){
AlreadyLoggedInException = true;
}
assertTrue(AlreadyLoggedInException);
}
//user has not login
@Test public void AlreadyLoggedInException2() throws NoSuchUserException, IncorrectPassphraseException, WeakPassphraseException, DuplicateUserException {
boolean AlreadyLoggedInException = false;
String passbookUsername = "AlexTina";
String passbookphrase = "Abc234hg";
try{
pb.addUser(passbookUsername,passbookphrase);
pb.loginUser(passbookUsername,passbookphrase);
}
catch (AlreadyLoggedInException e){
AlreadyLoggedInException = true;
}
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 {
...@@ -657,15 +694,6 @@ public class PartitioningTests ...@@ -657,15 +694,6 @@ public class PartitioningTests
assertEquals(expected, actual); assertEquals(expected, actual);
} }
@Test public void anotherTest()
throws DuplicateUserException, WeakPassphraseException
{
pb.addUser("passbookUsername", "properPassphrase1");
//the assertTrue method is used to check whether something holds.
assertTrue(pb.isUser("passbookUsername"));
assertFalse(pb.isUser("nonUser"));
}
//To test an exception, specify the expected exception after the @Test //To test an exception, specify the expected exception after the @Test
@Test(expected = java.io.IOException.class) @Test(expected = java.io.IOException.class)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment