Package org.seleniumhq.selenium.fluent.elements

Source Code of org.seleniumhq.selenium.fluent.elements.title

package org.seleniumhq.selenium.fluent.elements;

import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.seleniumhq.selenium.fluent.BaseTest;
import org.seleniumhq.selenium.fluent.FluentWebDriver;
import org.seleniumhq.selenium.fluent.TestableString;

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

public class title extends BaseTest {

    @Test
    public void title_functionality() {

        wd = mock(WebDriver.class);
        fwd = new FluentWebDriver(wd);

        TestableString ts = fwd.title();

        assertThat(ts, notNullValue());
        verifyNoMoreInteractions(wd);
        // invocation of getTitle is lazy.
        when(wd.getTitle()).thenReturn("foo");
        String actual = ts.toString();
        assertThat(actual, equalTo("foo"));
        verify(wd).getTitle();
        verifyNoMoreInteractions(wd);
    }



}
TOP

Related Classes of org.seleniumhq.selenium.fluent.elements.title

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.