Clover Coverage Report - EasyMock 3.0
Coverage timestamp: sam. mai 8 2010 14:37:27 CEST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
6   60   5   1,2
0   27   0,83   5
5     1  
1    
 
  Captures       Line # 31 6 0% 5 0 100% 1.0
 
  (30)
 
1    /**
2    * Copyright 2001-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16   
17    package org.easymock.internal.matchers;
18   
19    import java.io.Serializable;
20   
21    import org.easymock.Capture;
22    import org.easymock.IArgumentMatcher;
23    import org.easymock.internal.LastControl;
24   
25    /**
26    * @param <T>
27    * Type of the value captured
28    *
29    * @author Henri Tremblay
30    */
 
31    public class Captures<T> implements IArgumentMatcher, Serializable {
32   
33    private static final long serialVersionUID = -5048595127450771363L;
34   
35    private final Capture<T> capture;
36   
37    private T potentialValue;
38   
 
39  94 toggle public Captures(final Capture<T> captured) {
40  94 this.capture = captured;
41    }
42   
 
43  6 toggle public void appendTo(final StringBuffer buffer) {
44  6 buffer.append("capture(").append(capture).append(")");
45    }
46   
 
47  204 toggle public void setPotentialValue(final T potentialValue) {
48  204 this.potentialValue = potentialValue;
49    }
50   
 
51  104 toggle @SuppressWarnings("unchecked")
52    public boolean matches(final Object actual) {
53  104 LastControl.getCurrentInvocation().addCapture((Captures<Object>) this, actual);
54  104 return true;
55    }
56   
 
57  104 toggle public void validateCapture() {
58  104 capture.setValue(potentialValue);
59    }
60    }