|
|
@@ -0,0 +1,38 @@
|
|
|
+package kr.co.zumo.app.lifeplus.view.model;
|
|
|
+
|
|
|
+import org.junit.Test;
|
|
|
+
|
|
|
+import kr.co.zumo.app.lifeplus.supervisor.ScreenChanger;
|
|
|
+
|
|
|
+import static org.mockito.ArgumentMatchers.eq;
|
|
|
+import static org.mockito.Mockito.spy;
|
|
|
+import static org.mockito.Mockito.verify;
|
|
|
+import static org.powermock.api.mockito.PowerMockito.mock;
|
|
|
+
|
|
|
+public class ViewModelTest {
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void onEvent() {
|
|
|
+ ViewModel model = spy(new MainViewModel(mock(ScreenChanger.class)));
|
|
|
+
|
|
|
+ model.onEvent(Event.BACK);
|
|
|
+ verify(model).onEvent(eq(Event.BACK), eq(ViewModel.INT_NONE), eq(ViewModel.STRING_NONE));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void onEvent1() {
|
|
|
+
|
|
|
+ ViewModel model = spy(new MainViewModel(mock(ScreenChanger.class)));
|
|
|
+
|
|
|
+ model.onEvent(Event.CLICK, 1234);
|
|
|
+ verify(model).onEvent(eq(Event.CLICK), eq(1234), eq(ViewModel.STRING_NONE));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void onEvent2() {
|
|
|
+ ViewModel model = spy(new MainViewModel(mock(ScreenChanger.class)));
|
|
|
+
|
|
|
+ model.onEvent(Event.LOGIN, "hello");
|
|
|
+ verify(model).onEvent(eq(Event.LOGIN), eq(ViewModel.INT_NONE), eq("hello"));
|
|
|
+ }
|
|
|
+}
|