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   82   6   1
0   24   1   6
6     1  
1    
7,7% of code in this file is excluded from these metrics.
 
  ClassInstantiatorFactory       Line # 24 6 7,7% 6 0 100% 1.0
 
  (178)
 
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;
18   
19    /**
20    * Factory returning a {@link IClassInstantiator}for the current JVM
21    *
22    * @author Henri Tremblay
23    */
 
24    public final class ClassInstantiatorFactory {
25   
26    private static IClassInstantiator instantiator = new ObjenesisClassInstantiator();
27   
28    // ///CLOVER:OFF
 
29    toggle private ClassInstantiatorFactory() {
30    }
31   
32    // ///CLOVER:ON
33   
34    /**
35    * Returns the current JVM as specified in the System properties
36    *
37    * @return current JVM
38    */
 
39  2 toggle public static String getJVM() {
40  2 return System.getProperty("java.vm.vendor");
41    }
42   
43    /**
44    * Returns the current JVM specification version (1.5, 1.4, 1.3)
45    *
46    * @return current JVM specification version
47    */
 
48  4 toggle public static String getJVMSpecificationVersion() {
49  4 return System.getProperty("java.specification.version");
50    }
51   
 
52  4 toggle public static boolean is1_3Specifications() {
53  4 return getJVMSpecificationVersion().equals("1.3");
54    }
55   
56    /**
57    * Returns a class instantiator suitable for the current JVM
58    *
59    * @return a class instantiator usable on the current JVM
60    */
 
61  222 toggle public static IClassInstantiator getInstantiator() {
62  222 return instantiator;
63    }
64   
65    /**
66    * Allow to override the default instantiator. Useful when the default one
67    * isn't able to create mocks in a given environment.
68    *
69    * @param i
70    * New instantiator
71    */
 
72  6 toggle public static void setInstantiator(final IClassInstantiator i) {
73  6 instantiator = i;
74    }
75   
76    /**
77    * Set back the default instantiator
78    */
 
79  4 toggle public static void setDefaultInstantiator() {
80  4 instantiator = new ObjenesisClassInstantiator();
81    }
82    }