Skip to content

Commit

Permalink
Multi Currency Money [springframeworkguru#20. Privacy. Currenthly the…
Browse files Browse the repository at this point in the history
… 'amount' property is public, only expose what you need]
  • Loading branch information
gechulim committed May 5, 2023
1 parent 4ba1ffa commit 928b2d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/test/java/guru/springframework/Dollar.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package guru.springframework;

public class Dollar {
int amount;
private int amount;
public Dollar(int amount) {
this.amount = amount;
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/guru/springframework/MoneyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public class MoneyTest {
void testMultiplication() {
Dollar five = new Dollar(5);
Dollar product = five.times(2);
assertEquals(10, product.amount);
product =five.times(3);
assertEquals(15, product.amount);
assertEquals(new Dollar(10), product);
product = five.times(3);
assertEquals(new Dollar(15), product);
}

@Test
Expand Down

0 comments on commit 928b2d3

Please sign in to comment.