CheckPageTitleAction extends WebSymbolAction { public String getTitle() { return title; } CheckPageTitleAction(); @Override ExecuteResult execute(WebSiteConnector connector); String getTitle(); @Transient @JsonIgnore String getTitleWithVariableValues(); void setTitle(String title); boolean isRegexp(); void setRegexp(boolean regexp);  }
@Test public void shouldReturnOKIfTitleWasFoundWithoutRegex() { WebSiteConnector webSiteConnector = mock(WebSiteConnector.class); WebDriver driver = mock(WebDriver.class); given((webSiteConnector.getDriver())).willReturn(driver); given(driver.getTitle()).willReturn("Awesome Title No. 0"); CounterStoreConnector counterStoreConnector = mock(CounterStoreConnector.class); ConnectorManager connectors = mock(ConnectorManager.class); given(connectors.getConnector(WebSiteConnector.class)).willReturn(webSiteConnector); given(connectors.getConnector(CounterStoreConnector.class)).willReturn(counterStoreConnector); assertTrue(checkNode.executeAction(connectors).isSuccess()); }
@Test public void shouldReturnFailedIfTitleWasNotFoundWithoutRegex() { ConnectorManager connectors = mock(ConnectorManager.class); WebSiteConnector webSiteConnector = mock(WebSiteConnector.class); given(connectors.getConnector(WebSiteConnector.class)).willReturn(webSiteConnector); WebDriver driver = mock(WebDriver.class); given((webSiteConnector.getDriver())).willReturn(driver); given(driver.getTitle()).willReturn("This is the wrong title"); CounterStoreConnector counterStoreConnector = mock(CounterStoreConnector.class); given(connectors.getConnector(CounterStoreConnector.class)).willReturn(counterStoreConnector); assertFalse(checkNode.executeAction(connectors).isSuccess()); }