Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Monopoly_22065407_2023
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Container registry
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jack Thomas
Monopoly_22065407_2023
Commits
084e5fc9
Commit
084e5fc9
authored
2 years ago
by
Jack Thomas
Browse files
Options
Downloads
Patches
Plain Diff
submission-3
parent
73b89129
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/java/com/cm6123/monopoly/FinesChecks.java
+9
-9
9 additions, 9 deletions
src/test/java/com/cm6123/monopoly/FinesChecks.java
src/test/java/com/cm6123/monopoly/PropertyChecks.java
+1
-1
1 addition, 1 deletion
src/test/java/com/cm6123/monopoly/PropertyChecks.java
with
10 additions
and
10 deletions
src/test/java/com/cm6123/monopoly/FinesChecks.java
+
9
−
9
View file @
084e5fc9
...
...
@@ -90,21 +90,21 @@ public class FinesChecks {
}
@ParameterizedTest
@ValueSource
(
doubles
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
})
@ValueSource
(
doubles
=
{
1
.5
,
2
.1
,
3
.9
,
4
.34
,
5.12
,
6
.9
,
7
.2
,
8.
8
,
9
.3
,
10
.5
})
public
void
rentIsAlwaysCorrectAmount
(
double
rent
)
throws
Exception
{
double
balance
=
1000.0
;
double
value
=
200.0
;
Players
player
=
new
Players
(
"Name"
,
balance
,
0
,
0
);
// Rent payer.
Players
owner
=
new
Players
(
"Owner"
,
0
,
0
,
1
);
// Landlord.
Property
property
=
new
Property
(
value
,
rent
,
0
,
owner
);
// Property being rented.
// Given a player has £1000...
Players
player
=
new
Players
(
"Name"
,
1000
,
0
,
0
);
// Rent payer.
// And a property owner has £500 and a property worth £200...
Players
owner
=
new
Players
(
"Owner"
,
500
,
0
,
1
);
// Landlord.
Property
property
=
new
Property
(
200
,
rent
,
0
,
owner
);
// Property being rented.
// When the player rents the owner's property,
fns
.
rentProperty
(
player
,
property
);
Assertions
.
assertAll
(
()
->
assertEquals
(
balance
-(
value
*(
rent
/
100
)),
player
.
getPlayerBalance
()),
//
P
layer is charged
rent.
()
->
assertEquals
(
(
value
*(
rent
/
100
)),
owner
.
getPlayerBalance
())
//
O
wner is paid rent.
()
->
assertEquals
(
1000
-(
200
*(
rent
/
100
)),
player
.
getPlayerBalance
()),
//
Then the p
layer is charged
the appropriate amount of rent,
()
->
assertEquals
(
500
+(
200
*(
rent
/
100
)),
owner
.
getPlayerBalance
())
//
And the o
wner is paid
the same amount of
rent.
);
}
}
This diff is collapsed.
Click to expand it.
src/test/java/com/cm6123/monopoly/PropertyChecks.java
+
1
−
1
View file @
084e5fc9
...
...
@@ -45,7 +45,7 @@ public class PropertyChecks {
// Checks every property's rent value.
for
(
Property
i:
prp
.
getProperties
()){
assertTrue
(
i
.
getRent
()
<
10
);
assertTrue
(
i
.
getRent
()
<
=
10
);
}
}
...
...
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