1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.test

File MockitoRepositoryUtilsRule.java

 

Coverage histogram

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

Code metrics

2
8
5
1
63
36
6
0.75
1.6
5
1.2

Classes

Class Line # Actions
MockitoRepositoryUtilsRule 27 8 0% 6 1
0.9333333493.3%
 

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.extension.test;
21   
22    import org.junit.rules.MethodRule;
23    import org.junit.runners.model.FrameworkMethod;
24    import org.junit.runners.model.Statement;
25    import org.xwiki.test.mockito.MockitoComponentManagerRule;
26   
 
27    public class MockitoRepositoryUtilsRule extends MockitoRepositoryUtils implements MethodRule
28    {
29    private final MethodRule parent;
30   
 
31  40 toggle public MockitoRepositoryUtilsRule()
32    {
33  40 this(new MockitoComponentManagerRule());
34    }
35   
 
36  130 toggle public MockitoRepositoryUtilsRule(MockitoComponentManagerRule componentManager)
37    {
38  130 this(componentManager, componentManager);
39    }
40   
 
41  160 toggle public MockitoRepositoryUtilsRule(MockitoComponentManagerRule componentManager, MethodRule parent)
42    {
43  160 super(componentManager);
44   
45  160 this.parent = parent;
46    }
47   
 
48  160 toggle @Override
49    public Statement apply(final Statement base, final FrameworkMethod method, final Object target)
50    {
51  160 final Statement statement = new Statement()
52    {
 
53  160 toggle @Override
54    public void evaluate() throws Throwable
55    {
56  160 setup();
57  160 base.evaluate();
58    }
59    };
60   
61  160 return this.parent != null ? this.parent.apply(statement, method, target) : statement;
62    }
63    }