/* $Id: NodeBoTest.java,v 1.2 2005/12/19 19:56:28 m31 Exp $
 *
 * This file is part of the project "Hilbert II" - http://www.qedeq.org
 *
 * Copyright 2000-2005,  Michael Meyling <mime@qedeq.org>.
 *
 * "Hilbert II" is free software; you can redistribute
 * it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */

package org.qedeq.kernel.bo.module;


/**
 * Test class {@link org.qedeq.kernel.bo.module.NodeBo}.
 *
 * @version $Revision: 1.2 $
 * @author    Michael Meyling
 */
public class NodeBoTest extends AbstractBoModuleTest {

    /** This object is tested. */
    private NodeBo node;

    protected void setUp() throws Exception {
        super.setUp();
        node = new NodeBo();
    }

    protected void tearDown() throws Exception {
        super.tearDown();
        node = null;
    }

    protected Class getTestedClass() {
        return NodeBo.class;
    }

    /**
     * Test {@link NodeBo#getId()} and {@link NodeBo#setId(String)}.
     */
    public void testSetGetLabel() {
        assertNull(node.getId());
        final String value = "mulumis";
        node.setId(value);
        assertEquals(value, node.getId());
    }

    /**
     * Test {@link NodeBo#getLevel()} and {@link NodeBo#setLevel(String)}.
     */
    public void testSetGetLevel() {
        assertNull(node.getLevel());
        final String value = "muasdfj7";
        node.setLevel(value);
        assertEquals(value, node.getLevel());
    }

    /**
     * Test {@link NodeBo#getName()} and {@link NodeBo#setName(org.qedeq.kernel.base.module.LatexList)}.
     * @throws Exception
     * TODO exception test 
     */
    public void testSetGetName() throws Exception, DuplicateLanguageEntryException {
        assertNull(node.getName());
        final LatexListBo value = new LatexListBo();
        value.add(new LatexBo("dsfj", "8asdf67"));
        value.add(new LatexBo("dusi", "jasjfdsjf"));
        node.setName(value);
        assertEquals(value, node.getName());
    }

    /**
     * Test {@link NodeBo#getPrecedingText()} and
     * {@link NodeBo#setPrecedingText(org.qedeq.kernel.base.module.LatexList)}.
     * @throws Exception
     * TODO exception test 
     */
    public void testSetGetPrecedingText() throws Exception {
        assertNull(node.getPrecedingText());
        final LatexListBo value = new LatexListBo();
        value.add(new LatexBo("tdsfj", "a8asdf67"));
        value.add(new LatexBo("tdusi", "ajasjfdsjf"));
        node.setPrecedingText(value);
        assertEquals(value, node.getPrecedingText());
    }

    /**
     * Test {@link NodeBo#getNodeType()} and {@link NodeBo#setNodeType(org.qedeq.kernel.base.module.NodeType)}.
     * @throws Exception
     * TODO exception test 
     */
    public void testSetGetNodeType() throws Exception {
        assertNull(node.getNodeType());
        final DefinitionBo value = new DefinitionBo();
        node.setNodeType(value);
        assertEquals(value, node.getNodeType());
    }

    /**
     * Test {@link NodeBo#getSucceedingText()} and
     * {@link NodeBo#setSucceedingText(org.qedeq.kernel.base.module.LatexList)}.
     * @throws Exception
     * TODO exception test 
     */
    public void testSetGetSucceedingText() throws Exception {
        assertNull(node.getSucceedingText());
        final LatexListBo value = new LatexListBo();
        value.add(new LatexBo("ftdsfj", "a8asddf67"));
        value.add(new LatexBo("ftdusi", "adjasjfdsjf"));
        node.setSucceedingText(value);
        assertEquals(value, node.getSucceedingText());
    }

    /**
     * Test {@link NodeBo#equals(Object)}.
     */
    public void testEquals() {
        final NodeBo node2 = new NodeBo();
        assertTrue(node.equals(node2));
        assertTrue(node2.equals(node));
        node.setId("Hei");
        assertFalse(node.equals(node2));
        assertFalse(node2.equals(node));
    }

    /**
     * Test {@link NodeBo#toString()}.
     *
     */
    public void testToString() {
        assertNotNull(node.toString());
        final NodeBo node2 = new NodeBo();
        assertEquals(node.toString(), node2.toString());
        node.setId("Hei");
    }

}
