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
11d82c6e
Commit
11d82c6e
authored
5 years ago
by
CONGRANLI
Browse files
Options
Downloads
Patches
Plain Diff
recover
parent
f3dfabce
No related branches found
No related tags found
No related merge requests found
Pipeline
#5733
passed
5 years ago
Stage: check_elig
Stage: validate_tests
Stage: validate_progs
Stage: submit
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/Boundary/swen90006/passbook/BoundaryTests.java
+5
-0
5 additions, 0 deletions
tests/Boundary/swen90006/passbook/BoundaryTests.java
tests/Partitioning/swen90006/passbook/PartitioningTests.java
+173
-12
173 additions, 12 deletions
tests/Partitioning/swen90006/passbook/PartitioningTests.java
with
178 additions
and
12 deletions
tests/Boundary/swen90006/passbook/BoundaryTests.java
+
5
−
0
View file @
11d82c6e
...
...
@@ -41,6 +41,11 @@ public class BoundaryTests
assertFalse
(
WeakPassphraseException
);
}
@Test
public
void
ASCII
()
{
boolean
WeakPassphraseException
=
false
;
}
}
This diff is collapsed.
Click to expand it.
tests/Partitioning/swen90006/passbook/PartitioningTests.java
+
173
−
12
View file @
11d82c6e
...
...
@@ -76,7 +76,7 @@ public class PartitioningTests
@Test
public
void
WeakPassphraseException
()
throws
DuplicateUserException
{
boolean
WeakPassphraseException
=
false
;
String
passbookUsername
=
"AlexTina"
;
String
passbookphrase
=
"Ab23
333
"
;
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
}
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