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
4   56   4   1
0   29   1   4
4     1  
1    
11.1% of code in this file is excluded from these metrics.
 
  JProgressBarWaitUntilValueIsEqualToExpectedTask       Line # 36 4 11.1% 4 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Dec 4, 2009
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5    * 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 is distributed on
10    * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11    * specific language governing permissions and limitations under the License.
12    *
13    * Copyright @2009-2010 the original author or authors.
14    */
15    package org.fest.swing.driver;
16   
17    import static org.fest.swing.driver.JProgressBarValueQuery.valueOf;
18    import static org.fest.swing.format.Formatting.format;
19    import static org.fest.swing.timing.Pause.pause;
20    import static org.fest.util.Strings.concat;
21   
22    import javax.swing.JProgressBar;
23   
24    import org.fest.assertions.Description;
25    import org.fest.swing.annotation.RunsInEDT;
26    import org.fest.swing.edt.GuiLazyLoadingDescription;
27    import org.fest.swing.timing.Condition;
28    import org.fest.swing.timing.Timeout;
29   
30    /**
31    * Understands an EDT-safe task that waits until the value of a <code>{@link JProgressBar}</code> is equal to the
32    * given expected value.
33    *
34    * @author Alex Ruiz
35    */
 
36    final class JProgressBarWaitUntilValueIsEqualToExpectedTask {
37   
 
38  4 toggle @RunsInEDT
39    static void waitUntilValueIsEqualToExpected(final JProgressBar progressBar, final int expected, final Timeout timeout) {
40  4 pause(new Condition(untilValueIsEqualTo(progressBar, expected)) {
 
41  3473 toggle public boolean test() {
42  3473 return valueOf(progressBar) == expected;
43    }
44    }, timeout);
45    }
46   
 
47  4 toggle private static Description untilValueIsEqualTo(final JProgressBar progressBar, final int expected) {
48  4 return new GuiLazyLoadingDescription() {
 
49  2 toggle protected String loadDescription() {
50  2 return concat("value of ", format(progressBar), " to be equal to ", expected);
51    }
52    };
53    }
54   
 
55    toggle private JProgressBarWaitUntilValueIsEqualToExpectedTask() {}
56    }