@@ -36,7 +36,7 @@ public void construction() {
36
36
}
37
37
38
38
@ Test
39
- public void parentChildRelation () {
39
+ public void addChild () {
40
40
Account parentAccount = Account .of ("" );
41
41
Account childAccount = Account .of ("" );
42
42
@@ -45,8 +45,17 @@ public void parentChildRelation() {
45
45
Assertions .assertTrue (added );
46
46
Assertions .assertEquals (1 , parentAccount .getChildren ().size ());
47
47
Assertions .assertEquals (childAccount , parentAccount .getChildren ().get (0 ));
48
+
49
+ // cannot add the same account twice
50
+ Assertions .assertFalse (parentAccount .addChild (childAccount ));
51
+ Assertions .assertEquals (1 , parentAccount .getChildren ().size ());
52
+
53
+ // cannot add null child
54
+ Assertions .assertThrows (IllegalArgumentException .class , () -> parentAccount .addChild (null ));
48
55
}
49
56
57
+
58
+
50
59
@ Test
51
60
public void equality () {
52
61
@@ -77,6 +86,7 @@ public void equality() {
77
86
78
87
@ Test
79
88
public void balance () {
89
+ // todo move balance api into a separate class BalanceCalculator (maybe related to an account)
80
90
Account acc = Account .of ("acc" );
81
91
82
92
LocalDate date = LocalDate .now ();
@@ -91,7 +101,12 @@ public void balance() {
91
101
}
92
102
93
103
@ Test
94
- public void addOperation () {
104
+ public void addOperationTest () {
105
+
106
+ }
107
+
108
+ @ Test
109
+ public void getOperationsTest () {
95
110
96
111
}
97
112
0 commit comments