EMMA Coverage Report (generated Mon Nov 29 14:43:38 PST 2010)
[all classes][com.jeantessier.classreader]

COVERAGE SUMMARY FOR SOURCE FILE [TestFileFilteringLoadListener.java]

nameclass, %method, %block, %line, %
TestFileFilteringLoadListener.java100% (9/9)100% (19/19)100% (400/400)100% (67/67)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TestFileFilteringLoadListener100% (1/1)100% (11/11)100% (256/256)100% (51/51)
TestFileFilteringLoadListener (): void 100% (1/1)100% (3/3)100% (1/1)
access$000 (TestFileFilteringLoadListener): LoadListener 100% (1/1)100% (3/3)100% (1/1)
setUp (): void 100% (1/1)100% (30/30)100% (6/6)
testBeginFileExcludingFileName (): void 100% (1/1)100% (30/30)100% (6/6)
testBeginFileMatchingFileNameOnSecondRE (): void 100% (1/1)100% (30/30)100% (6/6)
testBeginFileNonMatchingFileName (): void 100% (1/1)100% (25/25)100% (5/5)
testBeginFileWithMatchingFileName (): void 100% (1/1)100% (25/25)100% (5/5)
testEndFileExcludingFileName (): void 100% (1/1)100% (30/30)100% (6/6)
testEndFileMatchingFileNameOnSecondRE (): void 100% (1/1)100% (30/30)100% (6/6)
testEndFileNonMatchingFileName (): void 100% (1/1)100% (25/25)100% (5/5)
testEndFileWithMatchingFileName (): void 100% (1/1)100% (25/25)100% (5/5)
     
class TestFileFilteringLoadListener$1100% (1/1)100% (1/1)100% (18/18)100% (3/3)
TestFileFilteringLoadListener$1 (TestFileFilteringLoadListener, LoadEvent): void 100% (1/1)100% (18/18)100% (3/3)
     
class TestFileFilteringLoadListener$2100% (1/1)100% (1/1)100% (18/18)100% (3/3)
TestFileFilteringLoadListener$2 (TestFileFilteringLoadListener, LoadEvent): void 100% (1/1)100% (18/18)100% (3/3)
     
class TestFileFilteringLoadListener$3100% (1/1)100% (1/1)100% (18/18)100% (3/3)
TestFileFilteringLoadListener$3 (TestFileFilteringLoadListener, LoadEvent): void 100% (1/1)100% (18/18)100% (3/3)
     
class TestFileFilteringLoadListener$4100% (1/1)100% (1/1)100% (18/18)100% (3/3)
TestFileFilteringLoadListener$4 (TestFileFilteringLoadListener, LoadEvent): void 100% (1/1)100% (18/18)100% (3/3)
     
class TestFileFilteringLoadListener$5100% (1/1)100% (1/1)100% (18/18)100% (3/3)
TestFileFilteringLoadListener$5 (TestFileFilteringLoadListener, LoadEvent): void 100% (1/1)100% (18/18)100% (3/3)
     
class TestFileFilteringLoadListener$6100% (1/1)100% (1/1)100% (18/18)100% (3/3)
TestFileFilteringLoadListener$6 (TestFileFilteringLoadListener, LoadEvent): void 100% (1/1)100% (18/18)100% (3/3)
     
class TestFileFilteringLoadListener$7100% (1/1)100% (1/1)100% (18/18)100% (3/3)
TestFileFilteringLoadListener$7 (TestFileFilteringLoadListener, LoadEvent): void 100% (1/1)100% (18/18)100% (3/3)
     
class TestFileFilteringLoadListener$8100% (1/1)100% (1/1)100% (18/18)100% (3/3)
TestFileFilteringLoadListener$8 (TestFileFilteringLoadListener, LoadEvent): void 100% (1/1)100% (18/18)100% (3/3)

1/*
2 *  Copyright (c) 2001-2009, Jean Tessier
3 *  All rights reserved.
4 *
5 *  Redistribution and use in source and binary forms, with or without
6 *  modification, are permitted provided that the following conditions
7 *  are met:
8 *
9 *      * Redistributions of source code must retain the above copyright
10 *        notice, this list of conditions and the following disclaimer.
11 *
12 *      * Redistributions in binary form must reproduce the above copyright
13 *        notice, this list of conditions and the following disclaimer in the
14 *        documentation and/or other materials provided with the distribution.
15 *
16 *      * Neither the name of Jean Tessier nor the names of his contributors
17 *        may be used to endorse or promote products derived from this software
18 *        without specific prior written permission.
19 *
20 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 *  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
24 *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 
33package com.jeantessier.classreader;
34 
35import java.util.*;
36 
37import org.jmock.integration.junit3.*;
38import org.jmock.*;
39 
40public class TestFileFilteringLoadListener extends MockObjectTestCase {
41    private LoadListener mockDelegate;
42 
43    private List<String> includes;
44    private List<String> excludes;
45 
46    public LoadListener sut;
47 
48    protected void setUp() throws Exception {
49        super.setUp();
50 
51        mockDelegate = mock(LoadListener.class);
52 
53        includes = new LinkedList<String>();
54        excludes = new LinkedList<String>();
55 
56        sut = new FileFilteringLoadListener(mockDelegate, includes, excludes);
57    }
58 
59    public void testBeginFileWithMatchingFileName() {
60        includes.add("/Foo/");
61        final LoadEvent testEvent = new LoadEvent(this, "", "Foo.class", null);
62 
63        checking(new Expectations() {{
64            one (mockDelegate).beginFile(testEvent);
65        }});
66 
67        sut.beginFile(testEvent);
68    }
69 
70    public void testBeginFileMatchingFileNameOnSecondRE() {
71        includes.add("/Foo/");
72        includes.add("/Bar/");
73        final LoadEvent testEvent = new LoadEvent(this, "", "Bar.class", null);
74 
75        checking(new Expectations() {{
76            one (mockDelegate).beginFile(testEvent);
77        }});
78 
79        sut.beginFile(testEvent);
80    }
81 
82    public void testBeginFileNonMatchingFileName() {
83        includes.add("/Foo/");
84        final LoadEvent testEvent = new LoadEvent(this, "", "Bar.class", null);
85 
86        checking(new Expectations() {{
87            never (mockDelegate).beginFile(testEvent);
88        }});
89 
90        sut.beginFile(testEvent);
91    }
92 
93    public void testBeginFileExcludingFileName() {
94        includes.add("/Foo/");
95        excludes.add("/Bar/");
96        final LoadEvent testEvent = new LoadEvent(this, "", "FooBar.class", null);
97 
98        checking(new Expectations() {{
99            never (mockDelegate).beginFile(testEvent);
100        }});
101 
102        sut.beginFile(testEvent);
103    }
104 
105    public void testEndFileWithMatchingFileName() {
106        includes.add("/Foo/");
107        final LoadEvent testEvent = new LoadEvent(this, "", "Foo.class", null);
108 
109        checking(new Expectations() {{
110            one (mockDelegate).endFile(testEvent);
111        }});
112 
113        sut.endFile(testEvent);
114    }
115 
116    public void testEndFileMatchingFileNameOnSecondRE() {
117        includes.add("/Foo/");
118        includes.add("/Bar/");
119        final LoadEvent testEvent = new LoadEvent(this, "", "Bar.class", null);
120 
121        checking(new Expectations() {{
122            one (mockDelegate).endFile(testEvent);
123        }});
124 
125        sut.endFile(testEvent);
126    }
127 
128    public void testEndFileNonMatchingFileName() {
129        includes.add("/Foo/");
130        final LoadEvent testEvent = new LoadEvent(this, "", "Bar.class", null);
131 
132        checking(new Expectations() {{
133            never (mockDelegate).endFile(testEvent);
134        }});
135 
136        sut.endFile(testEvent);
137    }
138 
139    public void testEndFileExcludingFileName() {
140        includes.add("/Foo/");
141        excludes.add("/Bar/");
142        final LoadEvent testEvent = new LoadEvent(this, "", "FooBar.class", null);
143 
144        checking(new Expectations() {{
145            never (mockDelegate).endFile(testEvent);
146        }});
147 
148        sut.endFile(testEvent);
149    }
150}

[all classes][com.jeantessier.classreader]
EMMA 2.0.5312 (C) Vladimir Roubtsov