1 package be.dvw.administration.test; 2 3 import junit.framework.TestCase; 4 import be.dvw.administration.mvc.navigation.LeftMenu; 5 import be.dvw.administration.mvc.navigation.LeftMenuXSLTImpl; 6 import org.dom4j.DocumentException; 7 import org.dom4j.Document; 8 import org.dom4j.io.OutputFormat; 9 import org.dom4j.io.XMLWriter; 10 11 import javax.xml.transform.TransformerException; 12 import java.io.IOException; 13 import java.io.UnsupportedEncodingException; 14 15 /*** 16 * Created by IntelliJ IDEA. 17 * User: Toon.Timbermont 18 * Date: Mar 25, 2005 19 * Time: 12:45:46 PM 20 * To change this template use File | Settings | File Templates. 21 */ 22 public class TestNavigation extends TestCase { 23 24 public void testCreateHomeMenu() throws DocumentException, IOException, TransformerException { 25 LeftMenu menu = new LeftMenuXSLTImpl("/home"); 26 write(menu.getCurrentMenu()); 27 assertNotNull(menu); 28 } 29 30 public void testCreateLevel1Menu() throws DocumentException, IOException, TransformerException { 31 LeftMenu menu = new LeftMenuXSLTImpl("/ledenbeheer"); 32 write(menu.getCurrentMenu()); 33 assertNotNull(menu); 34 } 35 36 public void testCreateLevel2Menu() throws DocumentException, IOException, TransformerException { 37 LeftMenu menu = new LeftMenuXSLTImpl("/ledenbeheer/betalend"); 38 write(menu.getCurrentMenu()); 39 assertNotNull(menu); 40 } 41 42 public void testCreateLevel3Menu() throws DocumentException, IOException, TransformerException { 43 LeftMenu menu = new LeftMenuXSLTImpl("/ledenbeheer/betalend/werving"); 44 write(menu.getCurrentMenu()); 45 assertNotNull(menu); 46 } 47 48 49 private void write(Document menu) throws IOException { 50 OutputFormat format = OutputFormat.createPrettyPrint(); 51 XMLWriter writer; 52 writer = new XMLWriter( System.out , format ); 53 writer.write( menu ); 54 } 55 56 57 }