/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 *
 */
package com.xpn.xwiki.objects;

import org.junit.Assert;
import org.junit.Test;
import org.xwiki.model.reference.DocumentReference;

import com.xpn.xwiki.test.AbstractBridgedComponentTestCase;

/**
 * Unit tests for the {@link BaseElement} class.
 * 
 * @version $Id$
 */
public class BaseElementTest extends AbstractBridgedComponentTestCase
{
    @Test
    public void testSetWiki() throws Exception
    {
        TestBaseElement baseElement = new TestBaseElement();
        
        baseElement.setWiki("wiki");
        
        Assert.assertEquals("wiki", baseElement.getWiki());
        
        baseElement.setName("space.page");
        
        Assert.assertEquals("space.page", baseElement.getName());
        Assert.assertEquals("wiki", baseElement.getDocumentReference().getWikiReference().getName());
        Assert.assertEquals("space", baseElement.getDocumentReference().getLastSpaceReference().getName());
        Assert.assertEquals("page", baseElement.getDocumentReference().getName());
        
        baseElement.setDocumentReference(new DocumentReference("otherwiki", "otherspace", "otherpage"));
        Assert.assertEquals("otherspace.otherpage", baseElement.getName());
        Assert.assertEquals("otherwiki", baseElement.getDocumentReference().getWikiReference().getName());
        Assert.assertEquals("otherspace", baseElement.getDocumentReference().getLastSpaceReference().getName());
        Assert.assertEquals("otherpage", baseElement.getDocumentReference().getName());
    }
}

class TestBaseElement extends BaseElement
{}
@@ -1305,20 +1305,16 @@
         
-Test
 BaseElem
@@ -1335,20 +1335,16 @@
 t = new 
-Test
 BaseElem
@@ -1348,16 +1348,18 @@
 lement()
+%7B%7D
 ;%0A      
@@ -2397,49 +2397,4 @@
 %7D%0A%7D%0A
-%0Aclass TestBaseElement extends BaseElement%0A%7B%7D

Improve test