1. Project Clover database Sat Feb 2 2019 06:45:20 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
67
37
6
0.75
1.6
5
1.2

Classes

Class Line # Actions
MockitoRepositoryUtilsRule 28 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.MockitoComponentManager;
26    import org.xwiki.test.mockito.MockitoComponentManagerRule;
27   
 
28    public class MockitoRepositoryUtilsRule extends MockitoRepositoryUtils implements MethodRule
29    {
30    private final MethodRule parent;
31   
 
32  41 toggle public MockitoRepositoryUtilsRule()
33    {
34  41 this(new MockitoComponentManagerRule());
35    }
36   
 
37  138 toggle public MockitoRepositoryUtilsRule(MockitoComponentManagerRule componentManager)
38    {
39  138 this(componentManager, componentManager);
40    }
41   
42    /**
43    * @since 10.2
44    */
 
45  169 toggle public MockitoRepositoryUtilsRule(MockitoComponentManager componentManager, MethodRule parent)
46    {
47  169 super(componentManager);
48   
49  169 this.parent = parent;
50    }
51   
 
52  169 toggle @Override
53    public Statement apply(final Statement base, final FrameworkMethod method, final Object target)
54    {
55  169 final Statement statement = new Statement()
56    {
 
57  169 toggle @Override
58    public void evaluate() throws Throwable
59    {
60  169 setup();
61  169 base.evaluate();
62    }
63    };
64   
65  169 return this.parent != null ? this.parent.apply(statement, method, target) : statement;
66    }
67    }