|
@@ -0,0 +1,42 @@
|
|
1
|
+package com.reactnativenavigation.viewcontrollers;
|
|
2
|
+
|
|
3
|
+import android.app.Activity;
|
|
4
|
+
|
|
5
|
+import com.reactnativenavigation.BaseTest;
|
|
6
|
+import com.reactnativenavigation.mocks.TitleBarReactViewCreatorMock;
|
|
7
|
+import com.reactnativenavigation.parse.Component;
|
|
8
|
+import com.reactnativenavigation.parse.params.Text;
|
|
9
|
+
|
|
10
|
+import org.junit.Test;
|
|
11
|
+
|
|
12
|
+import static org.mockito.Mockito.spy;
|
|
13
|
+import static org.mockito.Mockito.verify;
|
|
14
|
+
|
|
15
|
+public class TitleBarReactViewControllerTest extends BaseTest {
|
|
16
|
+
|
|
17
|
+ private TitleBarReactViewController uut;
|
|
18
|
+ private TitleBarReactViewCreatorMock viewCreator;
|
|
19
|
+ private Activity activity;
|
|
20
|
+ private Component component;
|
|
21
|
+
|
|
22
|
+ @Override
|
|
23
|
+ public void beforeEach() {
|
|
24
|
+ viewCreator = spy(new TitleBarReactViewCreatorMock());
|
|
25
|
+ activity = newActivity();
|
|
26
|
+ uut = new TitleBarReactViewController(activity, viewCreator);
|
|
27
|
+ createComponent();
|
|
28
|
+ uut.setComponent(component);
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+ @Test
|
|
32
|
+ public void createView() {
|
|
33
|
+ uut.createView();
|
|
34
|
+ verify(viewCreator).create(activity, component.componentId.get(), component.name.get());
|
|
35
|
+ }
|
|
36
|
+
|
|
37
|
+ private void createComponent() {
|
|
38
|
+ component = new Component();
|
|
39
|
+ component.componentId = new Text("compId");
|
|
40
|
+ component.name = new Text("compName");
|
|
41
|
+ }
|
|
42
|
+}
|