SeleniumNavigationSteps extends BaseServiceHub { @When("^I refresh the page$") public void pageRefresh() { getWebDriver().navigate().refresh(); }  @Given("I am on the homepage") void I_am_on_the_homepage(); @Given("I am looking at the homepage") @Deprecated void I_am_looking_at_the_homepage(); @Given("I am on webpage \"(.*)\"") void I_am_on_webpage_x(String url); @Given("^I am on the \"(.*)\" page$") void I_am_on_the_x_page(String pageName); @When("I navigate to the homepage") void I_navigate_to_the_homepage(); @When("^I click on the link with id \"(.*)\"$") void I_click_on_the_link_with_id(String linkId); @When("^I click the link with \"(.*)\" \"(.*)\"$") void I_click_the_link_with(String attributeName, String attributeValue); @When("^I click the \"(.*)\" button") void I_click_the_x_button(String textOnButton); @When("^I refresh the page$") void pageRefresh(); @Then("I am shown the homepage") void I_am_shown_the_homepage(); @Then("^the page title is \"([^\"]*)\"$") void the_page_title_is_x(String expectedPageTitle); @Then("^the \"([^\"])*\" page is shown$") void the_x_page_is_shown(String pageName);  }
@Test public void testPageRefresh() { final WebDriver mockDriver = mock(WebDriver.class); Navigation navigation = mock(Navigation.class); when(mockDriver.navigate()).thenReturn(navigation); MockSeleniumNavigationStepDefinitions navigationSteps = new MockSeleniumNavigationStepDefinitions(mockDriver); navigationSteps.pageRefresh(); verify(navigation, times(1)).refresh(); }