KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > loom > classman > metadata > test > MetaDataTestCase


1 /*
2  * Copyright (C) The Spice Group. All rights reserved.
3  *
4  * This software is published under the terms of the Spice
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.loom.classman.metadata.test;
9
10 import junit.framework.TestCase;
11
12 import org.codehaus.loom.classman.metadata.ClassLoaderMetaData;
13 import org.codehaus.loom.classman.metadata.ClassLoaderSetMetaData;
14 import org.codehaus.loom.classman.metadata.FileSetMetaData;
15 import org.codehaus.loom.classman.metadata.JoinMetaData;
16
17 /**
18  * Unit test for join classloader.
19  *
20  * @author Peter Donald
21  * @version $Revision: 1.1 $ $Date: 2004/04/19 22:19:26 $
22  */

23 public class MetaDataTestCase
24     extends TestCase
25 {
26     public void testCtorNullsInClassLoaderSet()
27         throws Exception JavaDoc
28     {
29         try
30         {
31             new ClassLoaderSetMetaData( null,
32                                         new String JavaDoc[ 0 ],
33                                         new ClassLoaderMetaData[ 0 ],
34                                         new JoinMetaData[ 0 ] );
35             fail( "Expected a NPE" );
36         }
37         catch( NullPointerException JavaDoc e )
38         {
39             assertEquals( "NPE type", "aDefault", e.getMessage() );
40         }
41
42         try
43         {
44             new ClassLoaderSetMetaData( "",
45                                         null,
46                                         new ClassLoaderMetaData[ 0 ],
47                                         new JoinMetaData[ 0 ] );
48             fail( "Expected a NPE" );
49         }
50         catch( NullPointerException JavaDoc e )
51         {
52             assertEquals( "NPE type", "predefined", e.getMessage() );
53         }
54
55         try
56         {
57             new ClassLoaderSetMetaData( "",
58                                         new String JavaDoc[ 0 ],
59                                         new ClassLoaderMetaData[ 0 ],
60                                         null );
61             fail( "Expected a NPE" );
62         }
63         catch( NullPointerException JavaDoc e )
64         {
65             assertEquals( "NPE type", "joins", e.getMessage() );
66         }
67
68         try
69         {
70             new ClassLoaderSetMetaData( "",
71                                         new String JavaDoc[ 0 ],
72                                         null,
73                                         new JoinMetaData[ 0 ] );
74             fail( "Expected a NPE" );
75         }
76         catch( NullPointerException JavaDoc e )
77         {
78             assertEquals( "NPE type", "classLoaders", e.getMessage() );
79         }
80     }
81
82     public void testCtorNullsInFileSet()
83         throws Exception JavaDoc
84     {
85         try
86         {
87             new FileSetMetaData( null,
88                                  new String JavaDoc[ 0 ],
89                                  new String JavaDoc[ 0 ] );
90             fail( "Expected a NPE" );
91         }
92         catch( NullPointerException JavaDoc e )
93         {
94             assertEquals( "NPE type", "baseDirectory", e.getMessage() );
95         }
96
97         try
98         {
99             new FileSetMetaData( ".",
100                                  null,
101                                  new String JavaDoc[ 0 ] );
102             fail( "Expected a NPE" );
103         }
104         catch( NullPointerException JavaDoc e )
105         {
106             assertEquals( "NPE type", "includes", e.getMessage() );
107         }
108
109         try
110         {
111             new FileSetMetaData( ".",
112                                  new String JavaDoc[ 0 ],
113                                  null );
114             fail( "Expected a NPE" );
115         }
116         catch( NullPointerException JavaDoc e )
117         {
118             assertEquals( "NPE type", "excludes", e.getMessage() );
119         }
120     }
121 }
122
Popular Tags