1 25 26 package org.snipsnap.test.snip; 27 28 import junit.framework.Test; 29 import junit.framework.TestSuite; 30 import org.snipsnap.snip.Snip; 31 import org.snipsnap.snip.SnipImpl; 32 import org.snipsnap.snip.SnipLink; 33 34 import java.io.IOException ; 35 import java.io.StringWriter ; 36 37 public class PermalinkTest extends SnipTestSupport { 38 protected StringWriter writer; 39 40 public PermalinkTest(String name) { 41 super(name); 42 } 43 44 protected void setUp() throws Exception { 45 writer = new StringWriter (); 46 super.setUp(); 47 } 48 49 public static Test suite() { 50 return new TestSuite(PermalinkTest.class); 51 } 52 53 public void testUrl() { 54 Snip snip = new SnipImpl("test", "test"); 55 String anchor = "anchor"; 56 try { 57 SnipLink.appendUrl(writer, snip.getName(), anchor); 58 } catch (IOException e) { 59 } 61 assertEquals("Url with Permalink is rendered correctly", 62 "space/test#anchor", writer.getBuffer().toString()); 63 } 64 } 65 | Popular Tags |