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
6   60   5   1.5
2   16   0.83   4
4     1.25  
1    
 
  Timeout       Line # 26 6 0% 5 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Oct 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.timing;
17   
18    import java.util.concurrent.TimeUnit;
19   
20    /**
21    * Understands a timeout.
22    *
23    * @author Yvonne Wang
24    * @author Alex Ruiz
25    */
 
26    public final class Timeout {
27   
28    private final long duration;
29   
30    /**
31    * Creates a new <code>{@link Timeout}</code>.
32    * @param duration the duration of the timeout in milliseconds.
33    * @return the created <code>Timeout</code>.
34    */
 
35  80 toggle public static Timeout timeout(long duration) {
36  80 return new Timeout(duration);
37    }
38   
39    /**
40    * Creates a new <code>{@link Timeout}</code>.
41    * @param duration the duration of the timeout.
42    * @param timeUnit the unit of time of the timeout.
43    * @return the created <code>Timeout</code>.
44    * @throws NullPointerException if the given time unit is <code>null</code>.
45    */
 
46  34 toggle public static Timeout timeout(long duration, TimeUnit timeUnit) {
47  1 if (timeUnit == null) throw new NullPointerException("Time unit should not be null");
48  33 return new Timeout(timeUnit.toMillis(duration));
49    }
50   
 
51  113 toggle private Timeout(long duration) {
52  113 this.duration = duration;
53    }
54   
55    /**
56    * Returns the duration of the timeout in milliseconds.
57    * @return the duration of the timeout in milliseconds.
58    */
 
59  67 toggle public long duration() { return duration; }
60    }