KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > repository > ArtifactTest


1 /*
2  * Copyright 2004 Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.avalon.repository;
19
20
21 import junit.framework.TestCase;
22
23
24 /**
25  * Create of a new Artifact test case.
26  *
27  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
28  * @version $Revision: 1.4 $
29  */

30 public class ArtifactTest extends TestCase
31 {
32     /**
33      * Constructor for ArtifactReferenceTest.
34      * @param name the test name
35      */

36     public ArtifactTest( String JavaDoc name )
37     {
38         super( name );
39     }
40     
41
42     public void testStaticOne() throws Exception JavaDoc
43     {
44         try
45         {
46             Artifact.createArtifact( null, null, null );
47             fail( "No null pointer exception (case 1)" );
48         }
49         catch( Throwable JavaDoc e )
50         {
51             assertTrue( true );
52         }
53     }
54
55     public void testStaticTwo() throws Exception JavaDoc
56     {
57         try
58         {
59             Artifact.createArtifact( null, "xxx", null );
60             fail( "No null pointer exception (case 2)" );
61         }
62         catch( Throwable JavaDoc e )
63         {
64             assertTrue( true );
65         }
66     }
67
68     public void testURLGeneralIntegrity() throws Exception JavaDoc
69     {
70         Artifact artifact = Artifact.createArtifact( "xxx", "yyy", "zzz" );
71         assertNotNull( artifact );
72         assertEquals(
73           "url",
74           artifact.getURL( "http://www.dpml.net" ),
75             "http://www.dpml.net/xxx/jars/yyy-zzz.jar" );
76     }
77
78     public void testURLFromEmptyRepository() throws Exception JavaDoc
79     {
80         Artifact artifact = Artifact.createArtifact( "xxx", "yyy", "zzz" );
81         assertNotNull( artifact );
82         assertEquals(
83           "url-from-empty",
84           artifact.getURL(),
85           "/xxx/jars/yyy-zzz.jar" );
86     }
87 }
88
Popular Tags