KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > easymock > classextension > tests > ClassInstantiatorFactoryTest


1 /*
2  * Copyright (c) 2003-2004 OFFIS. This program is made available under the terms of
3  * the MIT License.
4  */

5 package org.easymock.classextension.tests;
6
7 import junit.framework.TestCase;
8
9 import org.easymock.classextension.internal.ClassInstantiatorFactory;
10 import org.easymock.classextension.internal.DefaultClassInstantiator;
11 import org.easymock.classextension.internal.IClassInstantiator;
12 import org.easymock.classextension.internal.SunClassInstantiator;
13
14 /**
15  * @author Henri Tremblay
16  */

17 public class ClassInstantiatorFactoryTest extends TestCase {
18
19     public void testGetInstantiator_Sun1415() {
20         IClassInstantiator instantiator = ClassInstantiatorFactory
21                 .getInstantiator();
22         assertTrue(instantiator instanceof SunClassInstantiator);
23     }
24
25     public void testGetInstantiator_OtherJVM() {
26         System.setProperty("java.vm.specification.vendor", "SomeJVM");
27         IClassInstantiator instantiator = ClassInstantiatorFactory
28                 .getInstantiator();
29         assertTrue(instantiator instanceof DefaultClassInstantiator);
30     }
31
32     public void testGetInstantiator_Version13() {
33         System.setProperty("java.specification.version", "1.3");
34         IClassInstantiator instantiator = ClassInstantiatorFactory
35                 .getInstantiator();
36         assertTrue(instantiator instanceof DefaultClassInstantiator);
37     }
38 }
39
Popular Tags