| 
				
			 | 
			
			
				@@ -9,10 +9,6 @@ import com.reactnativenavigation.mocks.SimpleViewController; 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				9
			 | 
			
			
				 import org.junit.Test; 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				10
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				11
			 | 
			
				11
			 | 
			
			
				 import static org.assertj.core.api.Java6Assertions.assertThat; 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				
			 | 
			
			
				-import static org.mockito.Mockito.mock; 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				
			 | 
			
			
				-import static org.mockito.Mockito.times; 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				
			 | 
			
			
				-import static org.mockito.Mockito.verify; 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				
			 | 
			
			
				-import static org.mockito.Mockito.verifyZeroInteractions; 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				12
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				17
			 | 
			
				13
			 | 
			
			
				 public class ViewControllerTest extends BaseTest { 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				14
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -60,59 +56,4 @@ public class ViewControllerTest extends BaseTest { 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				56
			 | 
			
			
				 	public void handleBackDefaultFalse() throws Exception { 
			 | 
		
	
		
			
			| 
				61
			 | 
			
				57
			 | 
			
			
				 		assertThat(uut.handleBack()).isFalse(); 
			 | 
		
	
		
			
			| 
				62
			 | 
			
				58
			 | 
			
			
				 	} 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				64
			 | 
			
				
			 | 
			
			
				-	public static class LifecycleTest extends BaseTest { 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				
			 | 
			
			
				-		private ViewController controller; 
			 | 
		
	
		
			
			| 
				66
			 | 
			
				
			 | 
			
			
				-		private ViewController.LifecycleListener uut; 
			 | 
		
	
		
			
			| 
				67
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				
			 | 
			
			
				-		@Override 
			 | 
		
	
		
			
			| 
				69
			 | 
			
				
			 | 
			
			
				-		public void beforeEach() { 
			 | 
		
	
		
			
			| 
				70
			 | 
			
				
			 | 
			
			
				-			super.beforeEach(); 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				
			 | 
			
			
				-			Activity activity = newActivity(); 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				
			 | 
			
			
				-			controller = new SimpleViewController(activity, "controller"); 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				
			 | 
			
			
				-			uut = mock(ViewController.LifecycleListener.class); 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				
			 | 
			
			
				-			controller.setLifecycleListener(uut); 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				
			 | 
			
			
				-		} 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				
			 | 
			
			
				-		@Test 
			 | 
		
	
		
			
			| 
				78
			 | 
			
				
			 | 
			
			
				-		public void onCreateView_CalledAsSoonAsPossible() throws Exception { 
			 | 
		
	
		
			
			| 
				79
			 | 
			
				
			 | 
			
			
				-			verifyZeroInteractions(uut); 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				
			 | 
			
			
				-			controller.getView(); 
			 | 
		
	
		
			
			| 
				81
			 | 
			
				
			 | 
			
			
				-			verify(uut, times(1)).onCreate(); 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				
			 | 
			
			
				-		} 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				
			 | 
			
			
				-		@Test 
			 | 
		
	
		
			
			| 
				85
			 | 
			
				
			 | 
			
			
				-		public void onStart_CalledWhenVisible() throws Exception { 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				
			 | 
			
			
				-			verifyZeroInteractions(uut); 
			 | 
		
	
		
			
			| 
				87
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				88
			 | 
			
				
			 | 
			
			
				-			verify(uut, times(1)).onStart(); 
			 | 
		
	
		
			
			| 
				89
			 | 
			
				
			 | 
			
			
				-		} 
			 | 
		
	
		
			
			| 
				90
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				91
			 | 
			
				
			 | 
			
			
				-		@Test 
			 | 
		
	
		
			
			| 
				92
			 | 
			
				
			 | 
			
			
				-		public void onStop_CalledWhenInvisible() throws Exception { 
			 | 
		
	
		
			
			| 
				93
			 | 
			
				
			 | 
			
			
				-			verifyZeroInteractions(uut); 
			 | 
		
	
		
			
			| 
				94
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				95
			 | 
			
				
			 | 
			
			
				-			controller.getView().setVisibility(View.GONE); 
			 | 
		
	
		
			
			| 
				96
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				97
			 | 
			
				
			 | 
			
			
				-			verify(uut, times(1)).onStop(); 
			 | 
		
	
		
			
			| 
				98
			 | 
			
				
			 | 
			
			
				-		} 
			 | 
		
	
		
			
			| 
				99
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				100
			 | 
			
				
			 | 
			
			
				-		@Test 
			 | 
		
	
		
			
			| 
				101
			 | 
			
				
			 | 
			
			
				-		public void onStart_OnStop_Cycle() throws Exception { 
			 | 
		
	
		
			
			| 
				102
			 | 
			
				
			 | 
			
			
				-			verifyZeroInteractions(uut); 
			 | 
		
	
		
			
			| 
				103
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				104
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				105
			 | 
			
				
			 | 
			
			
				-			verify(uut, times(1)).onStart(); 
			 | 
		
	
		
			
			| 
				106
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				107
			 | 
			
				
			 | 
			
			
				-			controller.getView().setVisibility(View.INVISIBLE); 
			 | 
		
	
		
			
			| 
				108
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				109
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				110
			 | 
			
				
			 | 
			
			
				-			verify(uut, times(1)).onStop(); 
			 | 
		
	
		
			
			| 
				111
			 | 
			
				
			 | 
			
			
				-			controller.getView().setVisibility(View.VISIBLE); 
			 | 
		
	
		
			
			| 
				112
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				113
			 | 
			
				
			 | 
			
			
				-			controller.getView().getViewTreeObserver().dispatchOnGlobalLayout(); 
			 | 
		
	
		
			
			| 
				114
			 | 
			
				
			 | 
			
			
				-			verify(uut, times(1)).onStart(); 
			 | 
		
	
		
			
			| 
				115
			 | 
			
				
			 | 
			
			
				-		} 
			 | 
		
	
		
			
			| 
				116
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				117
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				118
			 | 
			
				59
			 | 
			
			
				 } 
			 |