KickJava   Java API By Example, From Geeks To Geeks.

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


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.2 $
29  */

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

36     public ArtifactURLTest( String JavaDoc name )
37     {
38         super( name );
39     }
40     
41     public void testArtifactURLGroup() throws Exception JavaDoc
42     {
43         Artifact artifact =
44           Artifact.createArtifact( "artifact:peter/rabbit" );
45         assertTrue( "peter".equals( artifact.getGroup() ) );
46     }
47
48     public void testArtifactURLCompositeGroup() throws Exception JavaDoc
49     {
50         Artifact artifact =
51           Artifact.createArtifact( "artifact:the/peter/rabbit" );
52         assertTrue( "the/peter".equals( artifact.getGroup() ) );
53     }
54
55     public void testArtifactURLName() throws Exception JavaDoc
56     {
57         Artifact artifact =
58           Artifact.createArtifact( "artifact:peter/rabbit" );
59         assertTrue( "rabbit".equals( artifact.getName() ) );
60     }
61
62     public void testArtifactURLType() throws Exception JavaDoc
63     {
64         Artifact artifact =
65           Artifact.createArtifact( "artifact:peter/rabbit" );
66         assertTrue( "jar".equals( artifact.getType() ) );
67     }
68
69     public void testArtifactURLNullVersion() throws Exception JavaDoc
70     {
71         Artifact artifact =
72           Artifact.createArtifact( "artifact:peter/rabbit" );
73         assertNull( artifact.getVersion() );
74     }
75
76     public void testArtifactRefVersionURL() throws Exception JavaDoc
77     {
78         Artifact artifact =
79           Artifact.createArtifact( "artifact:peter/rabbit#1.1" );
80         assertTrue( "1.1".equals( artifact.getVersion() ) );
81     }
82
83 }
84
Popular Tags