1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package com.xpn.xwiki.objects

File BaseElementTest.java

 

Code metrics

0
11
1
1
53
24
1
0.09
11
1
1

Classes

Class Line # Actions
BaseElementTest 32 11 0% 1 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package com.xpn.xwiki.objects;
21   
22    import org.junit.Assert;
23    import org.junit.Test;
24    import org.xwiki.model.reference.DocumentReference;
25    import com.xpn.xwiki.test.AbstractBridgedComponentTestCase;
26   
27    /**
28    * Unit tests for the {@link BaseElement} class.
29    *
30    * @version $Id: 4fac197f3787d2d968caa1e86d3acda407fa2692 $
31    */
 
32    public class BaseElementTest extends AbstractBridgedComponentTestCase
33    {
 
34  1 toggle @Test
35    public void testSetReferenceGetName() throws Exception
36    {
37  1 BaseElement baseElement = new BaseElement() {
38   
39    };
40   
41  1 baseElement.setDocumentReference(new DocumentReference("wiki", "space", "page"));
42  1 Assert.assertEquals("space.page", baseElement.getName());
43  1 Assert.assertEquals("wiki", baseElement.getDocumentReference().getWikiReference().getName());
44  1 Assert.assertEquals("space", baseElement.getDocumentReference().getLastSpaceReference().getName());
45  1 Assert.assertEquals("page", baseElement.getDocumentReference().getName());
46   
47  1 baseElement.setDocumentReference(new DocumentReference("otherwiki", "otherspace", "otherpage"));
48  1 Assert.assertEquals("otherspace.otherpage", baseElement.getName());
49  1 Assert.assertEquals("otherwiki", baseElement.getDocumentReference().getWikiReference().getName());
50  1 Assert.assertEquals("otherspace", baseElement.getDocumentReference().getLastSpaceReference().getName());
51  1 Assert.assertEquals("otherpage", baseElement.getDocumentReference().getName());
52    }
53    }