1
2
3 package org.virtualmock;
4
5 import junit.framework.Test;
6 import junit.framework.TestCase;
7 import org.hansel.CoverageDecorator;
8 import org.virtualmock.util.Toolbox;
9
10
11 /***
12 * TestCase for VMFactory.
13 *
14 * @author Chad Woolley
15 * @version $Revision: 1.4 $
16 */
17 public class VMFactoryTest extends TestCase {
18 /***
19 * Hansel support
20 *
21 * @return the decorated Test
22 */
23 public static Test suite() {
24 CoverageDecorator cd =
25 new CoverageDecorator(VMFactoryTest.class,
26 new Class[] {VMFactory.class});
27 cd.setDisplayStatistics(true);
28
29 return cd;
30 }
31
32 /***
33 * Tests the createVM method.
34 */
35 public void testCanCreateVM() {
36 VM vm = VMFactory.createVM();
37 assertNotNull(vm);
38 }
39
40 /***
41 * Tests the createVM method when CallManager and RuleManager have already
42 * been initialized.
43 */
44 public void testCanCreateVMWithPreInitialization() {
45 Toolbox.getCallManager();
46
47 VM vm = VMFactory.createVM();
48 assertNotNull(vm);
49 }
50
51 /***
52 * Tests the default constructor (required by Hansel).
53 */
54 public void testConstructor() {
55 new VMFactory();
56 }
57 }