Project

General

Profile

Download (981 Bytes) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.dataportal.selenium;
5

    
6
import java.util.ArrayList;
7
import java.util.Arrays;
8
import java.util.List;
9

    
10
import org.openqa.selenium.WebDriver;
11

    
12
import com.google.common.base.Function;
13

    
14
/**
15
 * @author andreas
16
 *
17
 */
18
public class AllTrue implements Function<WebDriver, Boolean> {
19

    
20
    List<Function<WebDriver, Boolean>> functions = new ArrayList<Function<WebDriver, Boolean>>();
21

    
22
    public AllTrue(Function<WebDriver, Boolean> ... functions) {
23
        if(functions == null){
24
            throw new NullPointerException("Constructor parameter mus not be null");
25
        }
26
        this.functions = Arrays.asList(functions);
27
    }
28

    
29
    /* (non-Javadoc)
30
     * @see com.google.common.base.Function#apply(java.lang.Object)
31
     */
32
    @Override
33
    public Boolean apply(WebDriver driver) {
34
        Boolean allTrue = true;
35
        for(Function<WebDriver, Boolean> f : functions){
36
            allTrue &= f.apply(driver);
37
        }
38
        return allTrue;
39
    }
40

    
41
}
(1-1/7)