Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SWEN90006-A1-2019
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Li Congran
SWEN90006-A1-2019
Commits
17f87efd
Commit
17f87efd
authored
5 years ago
by
CONGRANLI
Browse files
Options
Downloads
Patches
Plain Diff
add a new partation
parent
d925faa1
No related branches found
No related tags found
No related merge requests found
Pipeline
#5604
passed
5 years ago
Stage: check_elig
Stage: validate_tests
Stage: validate_progs
Stage: submit
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/Partitioning/swen90006/passbook/PartitioningTests.java
+37
-9
37 additions, 9 deletions
tests/Partitioning/swen90006/passbook/PartitioningTests.java
with
37 additions
and
9 deletions
tests/Partitioning/swen90006/passbook/PartitioningTests.java
+
37
−
9
View file @
17f87efd
...
...
@@ -293,6 +293,43 @@ public class PartitioningTests
}
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
@Test
public
void
IncorrectPassphraseException
()
throws
WeakPassphraseException
,
DuplicateUserException
,
AlreadyLoggedInException
,
IncorrectPassphraseException
,
NoSuchUserException
{
...
...
@@ -657,15 +694,6 @@ public class PartitioningTests
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
@Test
(
expected
=
java
.
io
.
IOException
.
class
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment