001package org.kuali.student.lum.ui.selenium;
002
003import org.openqa.selenium.WebDriver;
004import org.openqa.selenium.support.ui.ExpectedCondition;
005
006public class TitlePresentCondition implements ExpectedCondition<Boolean> {
007    String expectedTitle;
008
009    public TitlePresentCondition() {
010        this(null);
011    }
012
013    public TitlePresentCondition(String expectedTitle) {
014        super();
015        this.expectedTitle = expectedTitle;
016    }
017
018    @Override
019    public Boolean apply(WebDriver d) {
020        String title = d.getTitle();
021        if (title == null) {
022            return false;
023        }
024        if (expectedTitle == null) {
025            return false;
026        }
027        return title.trim().equalsIgnoreCase(expectedTitle.trim());
028    }
029
030    public String getExpectedTitle() {
031        return expectedTitle;
032    }
033
034    public void setExpectedTitle(String expectedTitle) {
035        this.expectedTitle = expectedTitle;
036    }
037
038}