Clover Coverage Report - FEST Swing 1.2
Coverage timestamp: Tue Jun 1 2010 15:19:25 PDT
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
7   93   5   1.4
0   26   0.71   5
5     1  
1    
 
  WindowFinderTemplate       Line # 32 7 0% 5 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Jul 31, 2007
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10    * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11    * or implied. See the License for the specific language governing permissions and limitations under
12    * the License.
13    *
14    * Copyright @2007-2010 the original author or authors.
15    */
16    package org.fest.swing.finder;
17   
18    import java.awt.Window;
19    import java.util.concurrent.TimeUnit;
20   
21    import org.fest.swing.core.GenericTypeMatcher;
22    import org.fest.swing.core.Robot;
23    import org.fest.swing.fixture.WindowFixture;
24   
25    /**
26    * Understands a template for <code>{@link Window}</code> finders.
27    * @param <T> the type of window this finder can search.
28    *
29    * @author Yvonne Wang
30    * @author Alex Ruiz
31    */
 
32    public abstract class WindowFinderTemplate<T extends Window> extends ComponentFinderTemplate<T> {
33   
34    /**
35    * Creates a new </code>{@link WindowFinderTemplate}</code>.
36    * @param windowName the name of the {@code Window} to find.
37    * @param windowType the type of the {@code Window} to find.
38    */
 
39  14 toggle protected WindowFinderTemplate(String windowName, Class<? extends T> windowType) {
40  14 super(windowName, windowType);
41    }
42   
43    /**
44    * Creates a new </code>{@link WindowFinderTemplate}</code>.
45    * @param matcher specifies the search criteria to use when looking up a {@code Window}.
46    */
 
47  17 toggle protected WindowFinderTemplate(GenericTypeMatcher<? extends T> matcher) {
48  17 super(matcher);
49    }
50   
51    /**
52    * Creates a new </code>{@link WindowFinderTemplate}</code>.
53    * @param windowType the type of the {@code Window} to find.
54    */
 
55  14 toggle protected WindowFinderTemplate(Class<? extends T> windowType) {
56  14 super(windowType);
57    }
58   
59    /**
60    * Sets the timeout for this finder. The <code>{@link Window}</code> to find should be found within the given time
61    * period.
62    * @param timeout the number of milliseconds before stopping the search.
63    * @return this finder.
64    * @throws IllegalArgumentException if the timeout is a negative number.
65    */
 
66  19 toggle @Override protected WindowFinderTemplate<T> withTimeout(long timeout) {
67  19 super.withTimeout(timeout);
68  13 return this;
69    }
70   
71    /**
72    * Sets the timeout for this finder. The <code>{@link Window}</code> to find should be found within the given time
73    * period.
74    * @param timeout the period of time the search should be performed.
75    * @param unit the time unit for <code>timeout</code>.
76    * @return this finder.
77    * @throws NullPointerException if the time unit is <code>null</code>.
78    * @throws IllegalArgumentException if the timeout is a negative number.
79    */
 
80  12 toggle @Override protected WindowFinderTemplate<T> withTimeout(long timeout, TimeUnit unit) {
81  12 super.withTimeout(timeout, unit);
82  6 return this;
83    }
84   
85    /**
86    * Finds a window by name or type using the given robot.
87    * @param robot contains the underlying finding to delegate the search to.
88    * @return a fixture capable of managing the found window.
89    * @throws org.fest.swing.exception.WaitTimedOutError if a window with the given name or of the given type could not
90    * be found.
91    */
92    public abstract WindowFixture<T> using(Robot robot);
93    }