Skip to content

Commit a592a4a

Browse files
springframeworkguru#17 - adding Dollar and test
1 parent 50b78d9 commit a592a4a

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package guru.springframework;
2+
3+
/**
4+
* @author Patrick Corbett
5+
*/
6+
public class Dollar {
7+
8+
int amount;
9+
10+
public Dollar(int pAmount) {
11+
amount = pAmount;
12+
}
13+
14+
void times(int pMultiplier) {
15+
amount *= pMultiplier;
16+
}
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package guru.springframework;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
6+
/**
7+
* @author Patrick Corbett
8+
*/
9+
class MoneyTest {
10+
11+
@Test
12+
void testMultiplication() {
13+
Dollar five = new Dollar(5);
14+
five.times(2);
15+
Assertions.assertEquals(10, five.amount);
16+
}
17+
18+
}

0 commit comments

Comments
 (0)