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
22   64   30   7,33
18   38   1,36   3
3     10  
1    
 
  ArrayEquals       Line # 26 22 0% 30 0 100% 1.0
 
  (8)
 
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.util.Arrays;
20   
21    import org.easymock.internal.ArgumentToString;
22   
23    /**
24    * @author OFFIS, Tammo Freese
25    */
 
26    public class ArrayEquals extends Equals {
27   
28    private static final long serialVersionUID = 1L;
29   
 
30  28 toggle public ArrayEquals(final Object expected) {
31  28 super(expected);
32    }
33   
 
34  28 toggle @Override
35    public boolean matches(final Object actual) {
36  28 final Object expected = getExpected();
37  28 if (expected instanceof boolean[] && (actual == null || actual instanceof boolean[])) {
38  2 return Arrays.equals((boolean[]) expected, (boolean[]) actual);
39  26 } else if (expected instanceof byte[] && (actual == null || actual instanceof byte[])) {
40  2 return Arrays.equals((byte[]) expected, (byte[]) actual);
41  24 } else if (expected instanceof char[] && (actual == null || actual instanceof char[])) {
42  2 return Arrays.equals((char[]) expected, (char[]) actual);
43  22 } else if (expected instanceof double[] && (actual == null || actual instanceof double[])) {
44  2 return Arrays.equals((double[]) expected, (double[]) actual);
45  20 } else if (expected instanceof float[] && (actual == null || actual instanceof float[])) {
46  2 return Arrays.equals((float[]) expected, (float[]) actual);
47  18 } else if (expected instanceof int[] && (actual == null || actual instanceof int[])) {
48  2 return Arrays.equals((int[]) expected, (int[]) actual);
49  16 } else if (expected instanceof long[] && (actual == null || actual instanceof long[])) {
50  2 return Arrays.equals((long[]) expected, (long[]) actual);
51  14 } else if (expected instanceof short[] && (actual == null || actual instanceof short[])) {
52  2 return Arrays.equals((short[]) expected, (short[]) actual);
53  12 } else if (expected instanceof Object[] && (actual == null || actual instanceof Object[])) {
54  10 return Arrays.equals((Object[]) expected, (Object[]) actual);
55    } else {
56  2 return super.matches(actual);
57    }
58    }
59   
 
60  4 toggle @Override
61    public void appendTo(final StringBuffer buffer) {
62  4 ArgumentToString.appendArgument(getExpected(), buffer);
63    }
64    }