AxeScanner { public AxeResult scanWithAxe(AccessibilityNodeInfo rootNode, Bitmap screenshot) throws ViewChangedException { final Axe axe = axeRunnerFactory.createAxeRunner(); final AxeContext axeContext = axeContextFactory.createAxeContext(rootNode, screenshot); return axe.run(axeContext); } AxeScanner(AxeRunnerFactory axeRunnerFactory, AxeContextFactory axeContextFactory); AxeResult scanWithAxe(AccessibilityNodeInfo rootNode, Bitmap screenshot);  }
@Test public void scanWithAxeReturnsCorrectResult() throws ViewChangedException { when(axeRunnerFactoryMock.createAxeRunner()).thenReturn(axeMock); when(axeContextFactoryMock.createAxeContext(accessibilityNodeInfoMock, screenshotMock)) .thenReturn(axeContextMock); when(axeMock.run(axeContextMock)).thenReturn(axeResultMock); Assert.assertEquals( testSubject.scanWithAxe(accessibilityNodeInfoMock, screenshotMock), axeResultMock); }