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

COVERAGE SUMMARY FOR SOURCE FILE [TestBasicTraversal.java]

nameclass, %method, %block, %line, %
TestBasicTraversal.java100% (7/7)100% (24/24)100% (452/452)100% (79/79)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TestBasicTraversal100% (1/1)100% (18/18)100% (201/201)100% (46/46)
TestBasicTraversal (): void 100% (1/1)100% (3/3)100% (1/1)
access$000 (TestBasicTraversal): Visitor 100% (1/1)100% (3/3)100% (1/1)
access$100 (TestBasicTraversal): PackageNode 100% (1/1)100% (3/3)100% (1/1)
access$200 (TestBasicTraversal): ClassNode 100% (1/1)100% (3/3)100% (1/1)
access$300 (TestBasicTraversal): FeatureNode 100% (1/1)100% (3/3)100% (1/1)
setUp (): void 100% (1/1)100% (48/48)100% (9/9)
testTraverseInbound (): void 100% (1/1)100% (16/16)100% (4/4)
testTraverseNodes_CallsAcceptDelegateOnNodes (): void 100% (1/1)100% (16/16)100% (4/4)
testTraverseOutbound (): void 100% (1/1)100% (16/16)100% (4/4)
testVisitClassNode_DelegatesTraversalOfInboundsAndOutboundsAndClasses (): void 100% (1/1)100% (18/18)100% (4/4)
testVisitFeatureNode_InScope (): void 100% (1/1)100% (18/18)100% (4/4)
testVisitInboundClassNode_DoesNothing (): void 100% (1/1)100% (6/6)100% (2/2)
testVisitInboundFeatureNode_DoesNothing (): void 100% (1/1)100% (6/6)100% (2/2)
testVisitInboundPackageNode_DoesNothing (): void 100% (1/1)100% (6/6)100% (2/2)
testVisitOutboundClassNode_DoesNothing (): void 100% (1/1)100% (6/6)100% (2/2)
testVisitOutboundFeatureNode_DoesNothing (): void 100% (1/1)100% (6/6)100% (2/2)
testVisitOutboundPackageNode_DoesNothing (): void 100% (1/1)100% (6/6)100% (2/2)
testVisitPackageNode_DelegatesTraversalOfInboundsAndOutboundsAndClasses (): void 100% (1/1)100% (18/18)100% (4/4)
     
class TestBasicTraversal$1100% (1/1)100% (1/1)100% (16/16)100% (3/3)
TestBasicTraversal$1 (TestBasicTraversal): void 100% (1/1)100% (16/16)100% (3/3)
     
class TestBasicTraversal$2100% (1/1)100% (1/1)100% (16/16)100% (3/3)
TestBasicTraversal$2 (TestBasicTraversal): void 100% (1/1)100% (16/16)100% (3/3)
     
class TestBasicTraversal$3100% (1/1)100% (1/1)100% (16/16)100% (3/3)
TestBasicTraversal$3 (TestBasicTraversal): void 100% (1/1)100% (16/16)100% (3/3)
     
class TestBasicTraversal$4100% (1/1)100% (1/1)100% (75/75)100% (11/11)
TestBasicTraversal$4 (TestBasicTraversal, Collection): void 100% (1/1)100% (75/75)100% (11/11)
     
class TestBasicTraversal$5100% (1/1)100% (1/1)100% (75/75)100% (11/11)
TestBasicTraversal$5 (TestBasicTraversal, Collection): void 100% (1/1)100% (75/75)100% (11/11)
     
class TestBasicTraversal$6100% (1/1)100% (1/1)100% (53/53)100% (8/8)
TestBasicTraversal$6 (TestBasicTraversal, Collection): void 100% (1/1)100% (53/53)100% (8/8)

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.dependency;
34 
35import java.util.*;
36 
37import org.jmock.*;
38import org.jmock.integration.junit4.*;
39import org.jmock.lib.legacy.*;
40import org.junit.*;
41import org.junit.runner.*;
42 
43@RunWith(JMock.class)
44public class TestBasicTraversal {
45    private Mockery context;
46 
47    private Visitor delegate;
48 
49    private PackageNode packageNode;
50    private ClassNode classNode;
51    private FeatureNode featureNode;
52 
53    private BasicTraversal sut;
54 
55    @Before
56    public void setUp() {
57        context = new Mockery();
58        context.setImposteriser(ClassImposteriser.INSTANCE);
59 
60        delegate = context.mock(Visitor.class);
61 
62        packageNode = context.mock(PackageNode.class);
63        classNode = context.mock(ClassNode.class);
64        featureNode = context.mock(FeatureNode.class);
65 
66        sut = new BasicTraversal();
67        sut.setDelegate(delegate);
68    }
69 
70    @Test
71    public void testTraverseNodes_CallsAcceptDelegateOnNodes() {
72        final Collection<PackageNode> nodes = Collections.singleton(packageNode);
73 
74        context.checking(new Expectations() {{
75            one (packageNode).accept(delegate);
76        }});
77 
78        sut.traverseNodes(nodes);
79    }
80 
81    @Test
82    public void testTraverseInbound() {
83        final Collection<PackageNode> nodes = Collections.singleton(packageNode);
84 
85        context.checking(new Expectations() {{
86            one (packageNode).acceptInbound(delegate);
87        }});
88 
89        sut.traverseInbound(nodes);
90    }
91 
92    @Test
93    public void testTraverseOutbound() {
94        final Collection<PackageNode> nodes = Collections.singleton(packageNode);
95 
96        context.checking(new Expectations() {{
97            one (packageNode).acceptOutbound(delegate);
98        }});
99 
100        sut.traverseOutbound(nodes);
101    }
102 
103    @Test
104    public void testVisitPackageNode_DelegatesTraversalOfInboundsAndOutboundsAndClasses() {
105        final Collection<ClassNode> nodes = Collections.singleton(classNode);
106 
107        context.checking(new Expectations() {{
108            // Process inbounds
109            one (packageNode).getInboundDependencies();
110                will(returnValue(nodes));
111            one (delegate).traverseInbound(nodes);
112 
113            // Process outbounds
114            one (packageNode).getOutboundDependencies();
115                will(returnValue(nodes));
116            one (delegate).traverseOutbound(nodes);
117 
118            // Process classes
119            one (packageNode).getClasses();
120                will(returnValue(nodes));
121            one (delegate).traverseNodes(nodes);
122        }});
123 
124        sut.visitPackageNode(packageNode);
125    }
126 
127    @Test
128    public void testVisitInboundPackageNode_DoesNothing() {
129        sut.visitInboundPackageNode(packageNode);
130    }
131 
132    @Test
133    public void testVisitOutboundPackageNode_DoesNothing() {
134        sut.visitOutboundPackageNode(packageNode);
135    }
136 
137    @Test
138    public void testVisitClassNode_DelegatesTraversalOfInboundsAndOutboundsAndClasses() {
139        final Collection<FeatureNode> nodes = Collections.singleton(featureNode);
140 
141        context.checking(new Expectations() {{
142            // Process inbounds
143            one (classNode).getInboundDependencies();
144                will(returnValue(nodes));
145            one (delegate).traverseInbound(nodes);
146 
147            // Process outbounds
148            one (classNode).getOutboundDependencies();
149                will(returnValue(nodes));
150            one (delegate).traverseOutbound(nodes);
151 
152            // Process features
153            one (classNode).getFeatures();
154                will(returnValue(nodes));
155            one (delegate).traverseNodes(nodes);
156        }});
157 
158        sut.visitClassNode(classNode);
159    }
160 
161    @Test
162    public void testVisitInboundClassNode_DoesNothing() {
163        sut.visitInboundClassNode(classNode);
164    }
165 
166    @Test
167    public void testVisitOutboundClassNode_DoesNothing() {
168        sut.visitOutboundClassNode(classNode);
169    }
170 
171    @Test
172    public void testVisitFeatureNode_InScope() {
173        final Collection<ClassNode> nodes = Collections.singleton(classNode);
174 
175        context.checking(new Expectations() {{
176            // Process inbounds
177            one (featureNode).getInboundDependencies();
178                will(returnValue(nodes));
179            one (delegate).traverseInbound(nodes);
180 
181            // Process outbounds
182            one (featureNode).getOutboundDependencies();
183                will(returnValue(nodes));
184            one (delegate).traverseOutbound(nodes);
185        }});
186 
187        sut.visitFeatureNode(featureNode);
188    }
189 
190    @Test
191    public void testVisitInboundFeatureNode_DoesNothing() {
192        sut.visitInboundFeatureNode(featureNode);
193    }
194 
195    @Test
196    public void testVisitOutboundFeatureNode_DoesNothing() {
197        sut.visitOutboundFeatureNode(featureNode);
198    }
199}

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