KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > bugs > bug228 > TestCase


1 package org.jacorb.test.bugs.bug228;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2003 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 import junit.framework.*;
24
25 import org.omg.CORBA.*;
26
27 /**
28  * Test for bug 228, checks whether factory methods do end up in the Helper
29  * class of a value type. Also tests whether the ORB automatically finds
30  * the DefaultFactory.
31  *
32  * @author <a HREF="mailto:spiegel@gnu.org">Andre Spiegel</a>
33  * @version $Id: TestCase.java,v 1.3 2003/10/27 12:15:38 andre.spiegel Exp $
34  */

35 public class TestCase extends junit.framework.TestCase
36 {
37     public TestCase(String JavaDoc name)
38     {
39         super(name);
40     }
41
42     public static Test suite()
43     {
44         TestSuite suite = new TestSuite ("bug 228 valuetype factories in helper");
45         suite.addTest (new TestCase ("testFactories"));
46         return suite;
47     }
48
49     public void testFactories()
50     {
51         ORB orb = org.omg.CORBA.ORB.init (new String JavaDoc[]{}, null);
52         
53         Sample s = SampleHelper.init_1 (orb);
54         assertNotNull(s);
55         
56         s = SampleHelper.init_2 (orb, 1, 2.0, "blabla");
57         assertNotNull(s);
58         assertEquals (1, s.alpha);
59         assertEquals (2.0, s.beta, 0.0);
60         assertEquals ("blabla", s.gamma);
61     }
62
63     public static void main(String JavaDoc[] args)
64     {
65         junit.textui.TestRunner.run(TestCase.class);
66     }
67
68 }
69
Popular Tags