1 19 20 package org.netbeans.modules.autoupdate; 21 22 import junit.framework.TestCase; 23 import junit.framework.*; 24 import java.net.MalformedURLException ; 25 import java.net.URL ; 26 import java.net.URLEncoder ; 27 import java.text.MessageFormat ; 28 import java.util.StringTokenizer ; 29 import java.io.IOException ; 30 import java.util.Collections ; 31 import java.util.MissingResourceException ; 32 import java.util.ResourceBundle ; 33 import org.openide.util.NbBundle; 34 import org.openide.filesystems.FileObject; 35 import org.openide.filesystems.FileStateInvalidException; 36 import org.openide.filesystems.FileSystem; 37 import org.openide.util.HelpCtx; 38 39 43 public class XMLAutoupdateTypeTest extends TestCase { 44 45 public XMLAutoupdateTypeTest (String testName) { 46 super (testName); 47 } 48 49 protected void setUp () throws Exception { 50 } 51 52 public static Test suite () { 53 TestSuite suite = new TestSuite(XMLAutoupdateTypeTest.class); 54 55 return suite; 56 } 57 58 public void testGetUrlSpec () { 59 XMLAutoupdateType instance = new XMLAutoupdateType(); 60 61 String expResult = instance.getDefaultURL (); 62 String result = instance.getUrlSpec(); 63 assertEquals(expResult, result); 64 } 65 66 public void testSetCorrectUrlSpec () { 67 String spec = "http://localhost/updates.xml"; 68 69 XMLAutoupdateType instance = new XMLAutoupdateType(); 70 instance.setUrlSpec(spec); 71 72 assertEquals (spec, instance.getUrlSpec ()); 73 } 74 75 public void testSetWrongUrlSpec () { 76 String spec = "dummy.xml"; 77 78 XMLAutoupdateType instance = new XMLAutoupdateType(); 79 80 String old = instance.getUrlSpec (); 81 82 try { 83 instance.setUrlSpec(spec); 84 fail ("IllegalArgumentException should be thrown."); 85 } catch (IllegalArgumentException iae) { 86 } 88 89 assertEquals (old, instance.getUrlSpec ()); 90 } 91 92 public void testGetURL () throws MalformedURLException { 93 XMLAutoupdateType instance = new XMLAutoupdateType(); 94 95 URL expResult = new URL (instance.getUrlSpec ()); 96 URL result = instance.getURL(); 97 assertEquals(expResult, result); 98 99 } 101 102 public void testSetURL () throws MalformedURLException { 103 URL url = new URL ("http://localhost/updates.xml"); 104 105 XMLAutoupdateType instance = new XMLAutoupdateType(); 106 instance.setURL(url); 107 108 assertEquals (url, instance.getURL ()); 109 } 110 111 } 112 | Popular Tags |