|
@@ -16,6 +16,9 @@ import java.util.Collection;
|
16
|
16
|
import java.util.List;
|
17
|
17
|
|
18
|
18
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
|
19
|
+import static org.mockito.Mockito.spy;
|
|
20
|
+import static org.mockito.Mockito.times;
|
|
21
|
+import static org.mockito.Mockito.verify;
|
19
|
22
|
|
20
|
23
|
public class ParentControllerTest extends BaseTest {
|
21
|
24
|
|
|
@@ -76,4 +79,25 @@ public class ParentControllerTest extends BaseTest {
|
76
|
79
|
|
77
|
80
|
assertThat(uut.findControllerById("child2")).isEqualTo(child2);
|
78
|
81
|
}
|
|
82
|
+
|
|
83
|
+ @Test
|
|
84
|
+ public void lifecycleMethodsPassDownToChildren_onAppear() throws Exception {
|
|
85
|
+ ViewController child1 = spy(new SimpleViewController(activity, "child1"));
|
|
86
|
+ children.add(child1);
|
|
87
|
+
|
|
88
|
+ verify(child1, times(0)).onAppear();
|
|
89
|
+ uut.onAppear();
|
|
90
|
+ verify(child1, times(1)).onAppear();
|
|
91
|
+ }
|
|
92
|
+
|
|
93
|
+ @Test
|
|
94
|
+ public void lifecycleMethodsPassDownToChildren_onDisappear() throws Exception {
|
|
95
|
+ ViewController child1 = spy(new SimpleViewController(activity, "child1"));
|
|
96
|
+ children.add(child1);
|
|
97
|
+
|
|
98
|
+ verify(child1, times(0)).onDisappear();
|
|
99
|
+ uut.onDisappear();
|
|
100
|
+ verify(child1, times(1)).onDisappear();
|
|
101
|
+ }
|
|
102
|
+
|
79
|
103
|
}
|