Skip to content

Commit

Permalink
Solve c.
Browse files Browse the repository at this point in the history
  • Loading branch information
codecop committed Feb 13, 2024
1 parent f01f6c9 commit 224de91
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
6 changes: 5 additions & 1 deletion Java/src/main/java/org/codecop/dependencies/c/Checkout.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ public Receipt createReceipt(Money amount) {
receipt.setTax(vat);
receipt.setTotal(amount.add(vat));

ReceiptRepository.store(receipt);
store(receipt);

return receipt;
}

protected void store(Receipt receipt) {
ReceiptRepository.store(receipt);
}
}
20 changes: 12 additions & 8 deletions Java/src/test/java/org/codecop/dependencies/c/CheckoutTest.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package org.codecop.dependencies.c;

import org.junit.Test;
import static org.junit.Assert.assertEquals;

import static org.junit.Assert.assertNotNull;
import org.junit.Test;

public class CheckoutTest {

@Test
public void test3() {
Checkout checkout = new Checkout();

checkout.createReceipt(new Money(12));

assertNotNull(checkout);
public void createReceipt() {
Checkout checkout = new Checkout() {
@Override
protected void store(Receipt receipt) {
}
};

Receipt receipt = checkout.createReceipt(new Money(12));

assertEquals(new Money("14.4"), receipt.getTotal());
}
}

0 comments on commit 224de91

Please sign in to comment.