Skip to content

Commit

Permalink
Clean up display string
Browse files Browse the repository at this point in the history
Moving the classes into packages inadvertently updated display strings.
  • Loading branch information
jramnani committed Feb 23, 2017
1 parent 8a9b2d0 commit 4e54414
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public String statement() {
double totalAmount = 0;
int frequentRenterPoints = 0;
Enumeration rentals = this.rentals.elements();
String result = "com.example.videostore.Rental Record for " + getName() + "\n";
String result = "Rental Record for " + getName() + "\n";

while (rentals.hasMoreElements()) {
double thisAmount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ protected void setUp() {

public void testSingleNewReleaseStatement() {
customer.addRental(new Rental(new Movie("The Cell", Movie.NEW_RELEASE), 3));
assertEquals("com.example.videostore.Rental Record for Fred\n\tThe Cell\t9.0\nYou owed 9.0\nYou earned 2 frequent renter points\n", customer.statement());
assertEquals("Rental Record for Fred\n\tThe Cell\t9.0\nYou owed 9.0\nYou earned 2 frequent renter points\n", customer.statement());
}

public void testDualNewReleaseStatement() {
customer.addRental(new Rental(new Movie("The Cell", Movie.NEW_RELEASE), 3));
customer.addRental(new Rental(new Movie("The Tigger com.example.videostore.Movie", Movie.NEW_RELEASE), 3));
assertEquals("com.example.videostore.Rental Record for Fred\n\tThe Cell\t9.0\n\tThe Tigger com.example.videostore.Movie\t9.0\nYou owed 18.0\nYou earned 4 frequent renter points\n", customer.statement());
assertEquals("Rental Record for Fred\n\tThe Cell\t9.0\n\tThe Tigger com.example.videostore.Movie\t9.0\nYou owed 18.0\nYou earned 4 frequent renter points\n", customer.statement());
}

public void testSingleChildrensStatement() {
customer.addRental(new Rental(new Movie("The Tigger com.example.videostore.Movie", Movie.CHILDRENS), 3));
assertEquals("com.example.videostore.Rental Record for Fred\n\tThe Tigger com.example.videostore.Movie\t1.5\nYou owed 1.5\nYou earned 1 frequent renter points\n", customer.statement());
assertEquals("Rental Record for Fred\n\tThe Tigger com.example.videostore.Movie\t1.5\nYou owed 1.5\nYou earned 1 frequent renter points\n", customer.statement());
}

public void testMultipleRegularStatement() {
customer.addRental(new Rental(new Movie("Plan 9 from Outer Space", Movie.REGULAR), 1));
customer.addRental(new Rental(new Movie("8 1/2", Movie.REGULAR), 2));
customer.addRental(new Rental(new Movie("Eraserhead", Movie.REGULAR), 3));

assertEquals("com.example.videostore.Rental Record for Fred\n\tPlan 9 from Outer Space\t2.0\n\t8 1/2\t2.0\n\tEraserhead\t3.5\nYou owed 7.5\nYou earned 3 frequent renter points\n", customer.statement());
assertEquals("Rental Record for Fred\n\tPlan 9 from Outer Space\t2.0\n\t8 1/2\t2.0\n\tEraserhead\t3.5\nYou owed 7.5\nYou earned 3 frequent renter points\n", customer.statement());
}

private Customer customer;
Expand Down

0 comments on commit 4e54414

Please sign in to comment.