1 7 8 package org.jdesktop.swing.data; 9 10 import java.net.MalformedURLException ; 11 import java.net.URL ; 12 13 import junit.framework.Test; 14 import junit.framework.TestCase; 15 import junit.framework.TestSuite; 16 17 20 public class LinkUnitTest extends TestCase { 21 22 private static String testText = "This is a foo"; 23 private static String testTarget = "_blank"; 24 private static String testTemplate = "http://bugz.sfbay/cgi-bin/showbug?cat=@{1}&subcat=@{2}"; 25 private static String [] testArgs = { "java", "classes_beans" }; 26 private static String testURLStr = "http://bugz.sfbay/cgi-bin/showbug?cat=java&subcat=classes_beans"; 28 29 private static URL testURL = null; 30 31 public LinkUnitTest() { 32 super("com.sun.jdnc.Link unit test"); 33 } 34 35 protected void setUp() { 36 try { 37 testURL = new URL (testURLStr); 38 } catch (MalformedURLException ex) { 39 throw new RuntimeException (ex); 40 } 41 } 42 43 46 public void testCtor1() { 47 Link link = new Link(testText, testTarget, testURL); 48 49 assertEquals(testText, link.getText()); 50 assertEquals(testTarget, link.getTarget()); 51 assertEquals(testURL, link.getURL()); 52 } 53 54 58 public void testCtor2() { 59 Link link = new Link(testText, testTarget, testTemplate, testArgs); 60 61 assertEquals(testText, link.getText()); 62 assertEquals(testTarget, link.getTarget()); 63 assertEquals(testURL, link.getURL()); 64 } 65 } 66 | Popular Tags |