Skip to content
Snippets Groups Projects
Commit 084e5fc9 authored by Jack Thomas's avatar Jack Thomas
Browse files

submission-3

parent 73b89129
No related branches found
No related tags found
No related merge requests found
......@@ -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()), // Player is charged rent.
() -> assertEquals((value*(rent/100)), owner.getPlayerBalance()) // Owner is paid rent.
() -> assertEquals(1000-(200*(rent/100)), player.getPlayerBalance()), // Then the player is charged the appropriate amount of rent,
() -> assertEquals(500+(200*(rent/100)), owner.getPlayerBalance()) // And the owner is paid the same amount of rent.
);
}
}
......@@ -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);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment