1313import com .reactnativenavigation .views .touch .OverlayTouchDelegate ;
1414
1515import org .junit .Test ;
16- import org .mockito .invocation .InvocationOnMock ;
1716import org .mockito .stubbing .Answer ;
1817
1918import static org .assertj .core .api .Java6Assertions .assertThat ;
@@ -36,12 +35,12 @@ public class OverlayTouchDelegateTest extends BaseTest {
3635
3736 @ Override
3837 public void beforeEach () {
39- mockHierarchy ();
38+ reactView = mock (ReactView .class );
39+ component = mock (ComponentLayout .class );
4040 uut = spy (new OverlayTouchDelegate (component , reactView ));
4141 }
4242
43- private void mockHierarchy () {
44- reactView = mock (ReactView .class );
43+ private void mockHierarchyWithDebuggingOverlay () {
4544 // Mock the hierarchy: ReactView -> ReactSurfaceView -> ReactViewGroup(s)
4645 ViewGroup reactSurfaceView = mock (ViewGroup .class );
4746 ViewGroup debuggingOverlayContainer = mock (ViewGroup .class );
@@ -81,12 +80,11 @@ private void mockHierarchy() {
8180 rect .set (new Rect (0 , 0 , 100 , 100 ));
8281 return null ;
8382 }).when (debuggingOverlayContainer ).getHitRect (any (Rect .class ));
84-
85- component = mock (ComponentLayout .class );
8683 }
8784
8885 @ Test
8986 public void downEventIsHandled () {
87+ mockHierarchyWithDebuggingOverlay ();
9088 uut .setInterceptTouchOutside (new Bool (true ));
9189 uut .onInterceptTouchEvent (downEvent );
9290 verify (uut , times (1 )).handleDown (downEvent );
0 commit comments