1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.security.authorization

File RightSetTest.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
10
5
1
95
61
5
0.5
2
5
1

Classes

Class Line # Actions
RightSetTest 46 10 0% 5 0
1.0100%
 

Contributing tests

No tests hitting this source file were found.

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.security.authorization;
21   
22    import java.util.List;
23    import java.util.Set;
24    import java.util.TreeSet;
25   
26    import org.junit.runner.RunWith;
27    import org.junit.runners.AllTests;
28   
29    import com.google.common.collect.testing.SampleElements;
30    import com.google.common.collect.testing.SetTestSuiteBuilder;
31    import com.google.common.collect.testing.TestSetGenerator;
32    import com.google.common.collect.testing.features.CollectionFeature;
33    import com.google.common.collect.testing.features.CollectionSize;
34    import com.google.common.collect.testing.features.SetFeature;
35   
36    import junit.framework.Test;
37    import junit.framework.TestSuite;
38   
39    /**
40    * Test Set interface of RightSet using guava test library.
41    *
42    * @version $Id: 4f0ede9aef0da44d0fe18a714b4d215b8ca1d213 $
43    * @since 4.0M2
44    */
45    @RunWith(AllTests.class)
 
46    public class RightSetTest
47    {
 
48  2 toggle public static Test suite() {
49  2 TestSuite suite = new TestSuite();
50   
51  2 suite.addTest(SetTestSuiteBuilder.using(new TestSetGenerator<Right>() {
 
52  1110 toggle @Override
53    public SampleElements<Right> samples()
54    {
55  1110 return new SampleElements<Right>(
56    Right.VIEW,
57    Right.EDIT,
58    Right.DELETE,
59    Right.COMMENT,
60    Right.ADMIN
61    );
62    }
63   
 
64  780 toggle @Override
65    public Set<Right> create(Object... elements)
66    {
67  780 Set<Right> set = new RightSet();
68  780 for (Object e : elements) {
69  1068 set.add((Right) e);
70    }
71  780 return set;
72    }
73   
 
74  65 toggle @Override
75    public Right[] createArray(int length)
76    {
77  65 return new Right[length];
78    }
79   
 
80  56 toggle @Override
81    public Iterable<Right> order(List<Right> insertionOrder)
82    {
83  56 return new TreeSet<Right>(insertionOrder);
84    }
85    })
86    .named("RightSet")
87    .withFeatures(SetFeature.GENERAL_PURPOSE,
88    CollectionSize.ANY,
89    CollectionFeature.ALLOWS_NULL_QUERIES,
90    CollectionFeature.KNOWN_ORDER)
91    .suppressing(com.google.common.collect.testing.testers.SetHashCodeTester.getHashCodeMethods())
92    .createTestSuite());
93  2 return suite;
94    }
95    }