Project

General

Profile

Download (883 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
	public Boolean apply(WebDriver driver) {
33
		Boolean allTrue = true;
34
		for(Function<WebDriver, Boolean> f : functions){
35
			allTrue &= f.apply(driver);
36
		}
37
		return allTrue;
38
	}
39

    
40
}
(1-1/5)