Coverage report

| %line | %branch
--- | --- | ---

org.apache.commons.jelly.test.BaseJellyTest

96%

100%

1

     /*

2

      * Copyright 2002,2004 The Apache Software Foundation.

3

      *

4

      * Licensed under the Apache License, Version 2.0 (the "License");

5

      * you may not use this file except in compliance with the License.

6

      * You may obtain a copy of the License at

7

      *

8

      *      http://www.apache.org/licenses/LICENSE-2.0

9

      *

10

      * Unless required by applicable law or agreed to in writing, software

11

      * distributed under the License is distributed on an "AS IS" BASIS,

12

      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

13

      * See the License for the specific language governing permissions and

14

      * limitations under the License.

15

      */

16

     package org.apache.commons.jelly.test;

17

18

     import java.net.URL;

19

20

     import junit.framework.TestCase;

21

22

     import org.apache.commons.jelly.Jelly;

23

     import org.apache.commons.jelly.JellyContext;

24

     import org.apache.commons.jelly.XMLOutput;

25

26

     /**

27

      * @author Rodney Waldhoff

28

      * @version $Revision: 155420 $ $Date: 2005-02-27 00:06:03 +1100 (Sun, 27 Feb 2005) $

29

      */

30

     public abstract class BaseJellyTest extends TestCase {

31

32

         public BaseJellyTest(String name) {

33

910

             super(name);

34

910

         }

35

36

         public void setUp() throws Exception {

37

910

             super.setUp();

38

910

             jelly = new Jelly();

39

845

             context = new JellyContext();

40

845

             xmlOutput = XMLOutput.createDummyXMLOutput();

41

845

         }

42

43

         protected void setUpScript(String scriptname) throws Exception {

44

624

             URL url = this.getClass().getResource(scriptname);

45

624

             if(null == url) {

46

0

                 throw new Exception(

47

                     "Could not find Jelly script: " + scriptname

48

                     + " in package of class: " + getClass().getName()

49

                 );

50

             }

51

624

             jelly.setUrl(url);

52

53

624

             String exturl = url.toExternalForm();

54

624

             int lastSlash = exturl.lastIndexOf("/");

55

624

             String extBase = exturl.substring(0,lastSlash+1);

56

624

             URL baseurl = new URL(extBase);

57

624

             context.setCurrentURL(baseurl);

58

624

         }

59

60

         protected Jelly getJelly() {

61

624

             return jelly;

62

         }

63

64

         protected JellyContext getJellyContext() {

65

2665

             return context;

66

         }

67

68

         protected XMLOutput getXMLOutput() {

69

988

             return xmlOutput;

70

         }

71

72

910

         private Jelly jelly = null;

73

910

         private JellyContext context = null;

74

910

         private XMLOutput xmlOutput = null;

75

76

     }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.