001 package org.picocontainer.classname;
002
003 import static org.junit.Assert.assertEquals;
004 import static org.junit.Assert.assertNotNull;
005
006 import java.io.FilePermission;
007 import java.net.URL;
008
009 import org.junit.Test;
010 import org.picocontainer.classname.ClassPathElement;
011
012 /**
013 *
014 * @author Mauro Talevi
015 */
016 public class ClassPathElementTestCase {
017
018 @Test public void testGetUrl() throws Exception{
019 URL url = new URL("file:///usr/lib");
020 ClassPathElement element = new ClassPathElement(url);
021 assertEquals(url, element.getUrl());
022 }
023
024 @Test public void testGrantPermission() throws Exception{
025 ClassPathElement element = new ClassPathElement(new URL("file:///usr/lib"));
026 element.grantPermission(new FilePermission("/usr/lib", "read"));
027 assertNotNull(element.getPermissionCollection());
028 }
029 }