1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.rendering.macro.script

File IntegrationTests.java

 

Coverage histogram

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

Code metrics

0
9
2
1
63
32
2
0.22
4.5
2
1

Classes

Class Line # Actions
IntegrationTests 43 9 0% 2 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.rendering.macro.script;
21   
22    import java.util.Collections;
23   
24    import org.jmock.Expectations;
25    import org.jmock.Mockery;
26    import org.jmock.integration.junit4.JUnit4Mockery;
27    import org.junit.runner.RunWith;
28    import org.xwiki.observation.EventListener;
29    import org.xwiki.observation.event.Event;
30    import org.xwiki.rendering.test.integration.RenderingTestSuite;
31    import org.xwiki.rendering.transformation.MacroTransformationContext;
32    import org.xwiki.script.event.ScriptEvaluatingEvent;
33    import org.xwiki.test.jmock.MockingComponentManager;
34   
35    /**
36    * Run all tests found in {@code *.test} files located in the classpath. These {@code *.test} files must follow the
37    * conventions described in {@link org.xwiki.rendering.test.integration.TestDataParser}.
38    *
39    * @version $Id: 25002a705540b0ad9eb26dfc4bcdb8581204b121 $
40    * @since 3.0RC1
41    */
42    @RunWith(RenderingTestSuite.class)
 
43    public class IntegrationTests
44    {
 
45  8 toggle @RenderingTestSuite.Initialized
46    public void initialize(MockingComponentManager cm) throws Exception
47    {
48  8 Mockery mockery = new JUnit4Mockery();
49  8 new ScriptMockSetup(mockery, cm);
50   
51    // fake nested script validator never fails
52  8 final EventListener nestedValidator =
53    cm.registerMockComponent(mockery, EventListener.class, "nestedscriptmacrovalidator");
 
54  8 toggle mockery.checking(new Expectations() {{
55  8 atLeast(1).of(nestedValidator).onEvent(with(any(Event.class)), with(any(MacroTransformationContext.class)),
56    with(any(ScriptMacroParameters.class)));
57  8 allowing(nestedValidator).getName();
58  8 will(returnValue("nestedscriptmacrovalidator"));
59  8 allowing(nestedValidator).getEvents();
60  8 will(returnValue(Collections.singletonList((Event) new ScriptEvaluatingEvent())));
61    }});
62    }
63    }