1 17 18 package org.apache.avalon.repository; 19 20 21 import junit.framework.TestCase; 22 23 24 30 public class ArtifactTest extends TestCase 31 { 32 36 public ArtifactTest( String name ) 37 { 38 super( name ); 39 } 40 41 42 public void testStaticOne() throws Exception 43 { 44 try 45 { 46 Artifact.createArtifact( null, null, null ); 47 fail( "No null pointer exception (case 1)" ); 48 } 49 catch( Throwable e ) 50 { 51 assertTrue( true ); 52 } 53 } 54 55 public void testStaticTwo() throws Exception 56 { 57 try 58 { 59 Artifact.createArtifact( null, "xxx", null ); 60 fail( "No null pointer exception (case 2)" ); 61 } 62 catch( Throwable e ) 63 { 64 assertTrue( true ); 65 } 66 } 67 68 public void testURLGeneralIntegrity() throws Exception 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 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 |