1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.platform.wiki.creationjob

File WikiCreationExceptionTest.java

 

Code metrics

0
24
1
1
69
35
1
0.04
24
1
1

Classes

Class Line # Actions
WikiCreationExceptionTest 30 24 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 org.xwiki.platform.wiki.creationjob;
21   
22    import org.junit.Test;
23   
24    import static org.junit.Assert.assertEquals;
25    import static org.junit.Assert.assertNotEquals;
26   
27    /**
28    * @version $Id: 0986475d927950bcf5d9b8a46446d30473999f0d $
29    */
 
30    public class WikiCreationExceptionTest
31    {
 
32  1 toggle @Test
33    public void equalsAndHashcode() throws Exception
34    {
35  1 Throwable throwable = new Throwable();
36   
37  1 Exception e1 = new WikiCreationException("message", throwable);
38  1 Exception e2 = new WikiCreationException("message", throwable);
39  1 Exception e3 = new WikiCreationException("message", throwable);
40  1 Exception e4 = new WikiCreationException("message2", throwable);
41  1 Exception e5 = new WikiCreationException("message", new Throwable());
42  1 Exception e6 = new Exception();
43   
44    // Reflective
45  1 assertEquals(e1, e1);
46   
47    // Symetric
48  1 assertEquals(e1, e2);
49  1 assertEquals(e2, e1);
50   
51    // Transitivity
52  1 assertEquals(e1, e2);
53  1 assertEquals(e1.hashCode(), e2.hashCode());
54  1 assertEquals(e2, e3);
55  1 assertEquals(e2.hashCode(), e3.hashCode());
56  1 assertEquals(e1, e3);
57  1 assertEquals(e1.hashCode(), e3.hashCode());
58   
59    // Other
60  1 assertNotEquals(e4, e1);
61  1 assertNotEquals(e4.hashCode(), e1.hashCode());
62  1 assertNotEquals(e1, e5);
63  1 assertNotEquals(e5, e1);
64  1 assertNotEquals(e1.hashCode(), e5.hashCode());
65  1 assertNotEquals(e6, e1);
66  1 assertNotEquals(e1, e6);
67  1 assertNotEquals(e1.hashCode(), e6.hashCode());
68    }
69    }