Package org.rendersnake.test

Source Code of org.rendersnake.test.AttributesTest

package org.rendersnake.test;

import java.io.IOException;

import junit.framework.TestCase;

import org.rendersnake.HtmlAttributes;

public class AttributesTest extends TestCase {

    private HtmlAttributes attrs;

    public void setUp() {
        attrs = new HtmlAttributes();
    }

    public void testCanBeOnlyOne() throws IOException {
        attrs.id("id1");
        HtmlAttributes other = new HtmlAttributes();
        other.id("id2");
        System.out.println(attrs);
        System.out.println(other);
    }
   
   
    public void testEmpty() {
        assertEquals("", attrs.toHtml());
    }

    public void testCreateOne() throws IOException {
        assertEquals(" one=\"een\"", new HtmlAttributes("one", "een").toHtml());
    }

    public void testAddNull() throws IOException {
        assertEquals("", attrs.add("null", null).toHtml());
    }

    public void testAddNullKey() throws IOException {
        assertEquals("", attrs.add(null, null).toHtml());
    }

    public void testAddOne() throws IOException {
        assertEquals(" one=\"one\"", attrs.add("one", "one").toHtml());
    }

    public void testAddNullEscape() throws IOException {
        assertEquals("", attrs.add("null", null, true).toHtml());
    }

    public void testAddNullNoEscape() throws IOException {
        assertEquals("", attrs.add("null", null, false).toHtml());
    }

    public void testToString() {
        assertNotNull(attrs.toString());
    }
   
    public void testVariable() throws IOException {
        assertNotNull(" name=\"var_rs_\" value=\"val\"",attrs.variable("var", "val").toHtml());
    }
   
    public void testXmlLang() throws IOException {
        assertNotNull(" xml:lang=\"lang\"",attrs.xml_lang("lang").toHtml());
    }
      
}
TOP

Related Classes of org.rendersnake.test.AttributesTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.