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

COVERAGE SUMMARY FOR SOURCE FILE [TestNodeHandler.java]

nameclass, %method, %block, %line, %
TestNodeHandler.java100% (1/1)100% (32/32)100% (4775/4775)100% (726/726)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TestNodeHandler100% (1/1)100% (32/32)100% (4775/4775)100% (726/726)
TestNodeHandler (): void 100% (1/1)100% (3/3)100% (1/1)
setUp (): void 100% (1/1)100% (8/8)100% (3/3)
testConfirmedClassNode (): void 100% (1/1)100% (156/156)100% (24/24)
testConfirmedFeatureNode (): void 100% (1/1)100% (208/208)100% (31/31)
testConfirmedInboundClassDependency (): void 100% (1/1)100% (186/186)100% (28/28)
testConfirmedInboundFeatureDependency (): void 100% (1/1)100% (204/204)100% (30/30)
testConfirmedInboundPackageDependency (): void 100% (1/1)100% (168/168)100% (26/26)
testConfirmedOutboundClassDependency (): void 100% (1/1)100% (186/186)100% (28/28)
testConfirmedOutboundFeatureDependency (): void 100% (1/1)100% (204/204)100% (30/30)
testConfirmedOutboundPackageDependency (): void 100% (1/1)100% (168/168)100% (26/26)
testConfirmedPackageNode (): void 100% (1/1)100% (111/111)100% (18/18)
testConstructor (): void 100% (1/1)100% (25/25)100% (4/4)
testEmptyDocument (): void 100% (1/1)100% (31/31)100% (6/6)
testEmptyTopNode (): void 100% (1/1)100% (48/48)100% (9/9)
testInferredClassNode (): void 100% (1/1)100% (163/163)100% (25/25)
testInferredFeatureNode (): void 100% (1/1)100% (215/215)100% (32/32)
testInferredInboundClassDependency (): void 100% (1/1)100% (186/186)100% (28/28)
testInferredInboundFeatureDependency (): void 100% (1/1)100% (204/204)100% (30/30)
testInferredInboundPackageDependency (): void 100% (1/1)100% (168/168)100% (26/26)
testInferredOutboundClassDependency (): void 100% (1/1)100% (186/186)100% (28/28)
testInferredOutboundFeatureDependency (): void 100% (1/1)100% (204/204)100% (30/30)
testInferredOutboundPackageDependency (): void 100% (1/1)100% (168/168)100% (26/26)
testInferredPackageNode (): void 100% (1/1)100% (111/111)100% (18/18)
testUnspecifiedClassNodeIsConfirmed (): void 100% (1/1)100% (152/152)100% (23/23)
testUnspecifiedFeatureNodeIsConfirmed (): void 100% (1/1)100% (204/204)100% (30/30)
testUnspecifiedInboundClassDependencyIsConfirmed (): void 100% (1/1)100% (168/168)100% (25/25)
testUnspecifiedInboundFeatureDependencyIsConfirmed (): void 100% (1/1)100% (186/186)100% (27/27)
testUnspecifiedInboundPackageDependencyIsConfirmed (): void 100% (1/1)100% (150/150)100% (23/23)
testUnspecifiedOutboundClassDependencyIsConfirmed (): void 100% (1/1)100% (168/168)100% (25/25)
testUnspecifiedOutboundFeatureDependencyIsConfirmed (): void 100% (1/1)100% (186/186)100% (27/27)
testUnspecifiedOutboundPackageDependencyIsConfirmed (): void 100% (1/1)100% (150/150)100% (23/23)
testUnspecifiedPackageNodeIsConfirmed (): void 100% (1/1)100% (100/100)100% (16/16)

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 org.xml.sax.*;
36import org.xml.sax.helpers.*;
37 
38import junit.framework.*;
39 
40public class TestNodeHandler extends TestCase {
41    private static final String MY_PACKAGE_NAME    = "mypackage";
42    private static final String MY_CLASS_NAME      = "mypackage.MyClass";
43    private static final String MY_FEATURE_NAME    = "mypackage.MyClass.myFeature";
44    private static final String OTHER_PACKAGE_NAME = "otherpackage";
45    private static final String OTHER_CLASS_NAME   = "otherpackage.OtherClass";
46    private static final String OTHER_FEATURE_NAME = "otherpackage.OtherClass.otherFeature";
47    
48    private NodeHandler handler;
49 
50    protected void setUp() throws Exception {
51        super.setUp();
52 
53        handler = new NodeHandler();
54    }
55 
56    public void testConstructor() {
57        assertEquals("nb packages", 0, handler.getFactory().getPackages().size());
58 
59        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
60 
61        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
62    }
63 
64    public void testEmptyDocument() throws SAXException {
65        handler.startDocument();
66        handler.endDocument();
67 
68        assertEquals("nb packages", 0, handler.getFactory().getPackages().size());
69 
70        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
71 
72        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
73    }
74 
75    public void testEmptyTopNode() throws SAXException {
76        Attributes attsEmpty = new AttributesImpl();
77        
78        handler.startDocument();
79        handler.startElement(null, null, "dependencies", attsEmpty);
80        handler.endElement(null, null, "dependencies");
81        handler.endDocument();
82 
83        assertEquals("nb packages", 0, handler.getFactory().getPackages().size());
84 
85        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
86 
87        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
88    }
89 
90    public void testUnspecifiedPackageNodeIsConfirmed() throws SAXException {
91        Attributes attsEmpty = new AttributesImpl();
92 
93        handler.startDocument();
94        handler.startElement(null, null, "dependencies", attsEmpty);
95        handler.startElement(null, null, "package", attsEmpty);
96        handler.startElement(null, null, "name", attsEmpty);
97        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
98        handler.endElement(null, null, "name");
99        handler.endElement(null, null, "package");
100        handler.endElement(null, null, "dependencies");
101        handler.endDocument();
102 
103        assertEquals("nb packages",  1, handler.getFactory().getPackages().size());
104        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
105        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
106 
107        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
108 
109        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
110    }
111 
112    public void testInferredPackageNode() throws SAXException {
113        AttributesImpl attsEmpty = new AttributesImpl();
114        AttributesImpl attsNo    = new AttributesImpl();
115        attsNo.addAttribute(null, null, "confirmed", null, "no");
116 
117        handler.startDocument();
118        handler.startElement(null, null, "dependencies", attsEmpty);
119        handler.startElement(null, null, "package", attsNo);
120        handler.startElement(null, null, "name", attsEmpty);
121        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
122        handler.endElement(null, null, "name");
123        handler.endElement(null, null, "package");
124        handler.endElement(null, null, "dependencies");
125        handler.endDocument();
126 
127        assertEquals("nb packages",  1, handler.getFactory().getPackages().size());
128        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
129        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
130 
131        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
132 
133        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
134    }
135 
136    public void testConfirmedPackageNode() throws SAXException {
137        AttributesImpl attsEmpty = new AttributesImpl();
138        AttributesImpl attsYes   = new AttributesImpl();
139        attsYes.addAttribute(null, null, "confirmed", null, "yes");
140 
141        handler.startDocument();
142        handler.startElement(null, null, "dependencies", attsEmpty);
143        handler.startElement(null, null, "package", attsYes);
144        handler.startElement(null, null, "name", attsEmpty);
145        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
146        handler.endElement(null, null, "name");
147        handler.endElement(null, null, "package");
148        handler.endElement(null, null, "dependencies");
149        handler.endDocument();
150 
151        assertEquals("nb packages",  1, handler.getFactory().getPackages().size());
152        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
153        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
154 
155        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
156 
157        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
158    }
159 
160    public void testUnspecifiedClassNodeIsConfirmed() throws SAXException {
161        Attributes attsEmpty = new AttributesImpl();
162 
163        handler.startDocument();
164        handler.startElement(null, null, "dependencies", attsEmpty);
165        handler.startElement(null, null, "package", attsEmpty);
166        handler.startElement(null, null, "name", attsEmpty);
167        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
168        handler.endElement(null, null, "name");
169        handler.startElement(null, null, "class", attsEmpty);
170        handler.startElement(null, null, "name", attsEmpty);
171        handler.characters(MY_CLASS_NAME.toCharArray(), 0, MY_CLASS_NAME.length());
172        handler.endElement(null, null, "name");
173        handler.endElement(null, null, "class");
174        handler.endElement(null, null, "package");
175        handler.endElement(null, null, "dependencies");
176        handler.endDocument();
177 
178        assertEquals("nb packages", 1, handler.getFactory().getPackages().size());
179        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
180        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
181 
182        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
183        assertNotNull("missing class", handler.getFactory().getClasses().get(MY_CLASS_NAME));
184        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(MY_CLASS_NAME)).isConfirmed());
185 
186        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
187    }
188 
189    public void testInferredClassNode() throws SAXException {
190        AttributesImpl attsEmpty = new AttributesImpl();
191        AttributesImpl attsNo = new AttributesImpl();
192        attsNo.addAttribute(null, null, "confirmed", null, "no");
193 
194        handler.startDocument();
195        handler.startElement(null, null, "dependencies", attsEmpty);
196        handler.startElement(null, null, "package", attsNo);
197        handler.startElement(null, null, "name", attsEmpty);
198        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
199        handler.endElement(null, null, "name");
200        handler.startElement(null, null, "class", attsNo);
201        handler.startElement(null, null, "name", attsEmpty);
202        handler.characters(MY_CLASS_NAME.toCharArray(), 0, MY_CLASS_NAME.length());
203        handler.endElement(null, null, "name");
204        handler.endElement(null, null, "class");
205        handler.endElement(null, null, "package");
206        handler.endElement(null, null, "dependencies");
207        handler.endDocument();
208 
209        assertEquals("nb packages", 1, handler.getFactory().getPackages().size());
210        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
211        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
212 
213        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
214        assertNotNull("missing class", handler.getFactory().getClasses().get(MY_CLASS_NAME));
215        assertFalse("class is confirmed", ((Node) handler.getFactory().getClasses().get(MY_CLASS_NAME)).isConfirmed());
216 
217        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
218    }
219 
220    public void testConfirmedClassNode() throws SAXException {
221        AttributesImpl attsEmpty = new AttributesImpl();
222        AttributesImpl attsYes = new AttributesImpl();
223 
224        handler.startDocument();
225        handler.startElement(null, null, "dependencies", attsEmpty);
226        handler.startElement(null, null, "package", attsYes);
227        handler.startElement(null, null, "name", attsEmpty);
228        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
229        handler.endElement(null, null, "name");
230        handler.startElement(null, null, "class", attsYes);
231        handler.startElement(null, null, "name", attsEmpty);
232        handler.characters(MY_CLASS_NAME.toCharArray(), 0, MY_CLASS_NAME.length());
233        handler.endElement(null, null, "name");
234        handler.endElement(null, null, "class");
235        handler.endElement(null, null, "package");
236        handler.endElement(null, null, "dependencies");
237        handler.endDocument();
238 
239        assertEquals("nb packages", 1, handler.getFactory().getPackages().size());
240        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
241        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
242 
243        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
244        assertNotNull("missing class", handler.getFactory().getClasses().get(MY_CLASS_NAME));
245        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(MY_CLASS_NAME)).isConfirmed());
246 
247        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
248    }
249 
250    public void testUnspecifiedFeatureNodeIsConfirmed() throws SAXException {
251        Attributes attsEmpty = new AttributesImpl();
252 
253        handler.startDocument();
254        handler.startElement(null, null, "dependencies", attsEmpty);
255        handler.startElement(null, null, "package", attsEmpty);
256        handler.startElement(null, null, "name", attsEmpty);
257        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
258        handler.endElement(null, null, "name");
259        handler.startElement(null, null, "class", attsEmpty);
260        handler.startElement(null, null, "name", attsEmpty);
261        handler.characters(MY_CLASS_NAME.toCharArray(), 0, MY_CLASS_NAME.length());
262        handler.endElement(null, null, "name");
263        handler.startElement(null, null, "feature", attsEmpty);
264        handler.startElement(null, null, "name", attsEmpty);
265        handler.characters(MY_FEATURE_NAME.toCharArray(), 0, MY_FEATURE_NAME.length());
266        handler.endElement(null, null, "name");
267        handler.endElement(null, null, "feature");
268        handler.endElement(null, null, "class");
269        handler.endElement(null, null, "package");
270        handler.endElement(null, null, "dependencies");
271        handler.endDocument();
272 
273        assertEquals("nb packages", 1, handler.getFactory().getPackages().size());
274        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
275        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
276 
277        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
278        assertNotNull("missing class", handler.getFactory().getClasses().get(MY_CLASS_NAME));
279        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(MY_CLASS_NAME)).isConfirmed());
280 
281        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
282        assertNotNull("missing feature", handler.getFactory().getFeatures().get(MY_FEATURE_NAME));
283        assertTrue("feature is inferred", ((Node) handler.getFactory().getFeatures().get(MY_FEATURE_NAME)).isConfirmed());
284    }
285 
286    public void testInferredFeatureNode() throws SAXException {
287        AttributesImpl attsEmpty = new AttributesImpl();
288        AttributesImpl attsNo = new AttributesImpl();
289        attsNo.addAttribute(null, null, "confirmed", null, "no");
290 
291        handler.startDocument();
292        handler.startElement(null, null, "dependencies", attsEmpty);
293        handler.startElement(null, null, "package", attsNo);
294        handler.startElement(null, null, "name", attsEmpty);
295        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
296        handler.endElement(null, null, "name");
297        handler.startElement(null, null, "class", attsNo);
298        handler.startElement(null, null, "name", attsEmpty);
299        handler.characters(MY_CLASS_NAME.toCharArray(), 0, MY_CLASS_NAME.length());
300        handler.endElement(null, null, "name");
301        handler.startElement(null, null, "feature", attsNo);
302        handler.startElement(null, null, "name", attsEmpty);
303        handler.characters(MY_FEATURE_NAME.toCharArray(), 0, MY_FEATURE_NAME.length());
304        handler.endElement(null, null, "name");
305        handler.endElement(null, null, "feature");
306        handler.endElement(null, null, "class");
307        handler.endElement(null, null, "package");
308        handler.endElement(null, null, "dependencies");
309        handler.endDocument();
310 
311        assertEquals("nb packages", 1, handler.getFactory().getPackages().size());
312        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
313        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
314 
315        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
316        assertNotNull("missing class", handler.getFactory().getClasses().get(MY_CLASS_NAME));
317        assertFalse("class is confirmed", ((Node) handler.getFactory().getClasses().get(MY_CLASS_NAME)).isConfirmed());
318 
319        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
320        assertNotNull("missing feature", handler.getFactory().getFeatures().get(MY_FEATURE_NAME));
321        assertFalse("feature is confirmed", ((Node) handler.getFactory().getFeatures().get(MY_FEATURE_NAME)).isConfirmed());
322    }
323 
324    public void testConfirmedFeatureNode() throws SAXException {
325        AttributesImpl attsEmpty = new AttributesImpl();
326        AttributesImpl attsYes = new AttributesImpl();
327 
328        handler.startDocument();
329        handler.startElement(null, null, "dependencies", attsEmpty);
330        handler.startElement(null, null, "package", attsYes);
331        handler.startElement(null, null, "name", attsEmpty);
332        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
333        handler.endElement(null, null, "name");
334        handler.startElement(null, null, "class", attsYes);
335        handler.startElement(null, null, "name", attsEmpty);
336        handler.characters(MY_CLASS_NAME.toCharArray(), 0, MY_CLASS_NAME.length());
337        handler.endElement(null, null, "name");
338        handler.startElement(null, null, "feature", attsYes);
339        handler.startElement(null, null, "name", attsEmpty);
340        handler.characters(MY_FEATURE_NAME.toCharArray(), 0, MY_FEATURE_NAME.length());
341        handler.endElement(null, null, "name");
342        handler.endElement(null, null, "feature");
343        handler.endElement(null, null, "class");
344        handler.endElement(null, null, "package");
345        handler.endElement(null, null, "dependencies");
346        handler.endDocument();
347 
348        assertEquals("nb packages", 1, handler.getFactory().getPackages().size());
349        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
350        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
351 
352        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
353        assertNotNull("missing class", handler.getFactory().getClasses().get(MY_CLASS_NAME));
354        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(MY_CLASS_NAME)).isConfirmed());
355 
356        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
357        assertNotNull("missing feature", handler.getFactory().getFeatures().get(MY_FEATURE_NAME));
358        assertTrue("feature is inferred", ((Node) handler.getFactory().getFeatures().get(MY_FEATURE_NAME)).isConfirmed());
359    }
360 
361    public void testUnspecifiedInboundPackageDependencyIsConfirmed() throws SAXException {
362        Attributes attsEmpty = new AttributesImpl();
363        AttributesImpl attsPackage = new AttributesImpl();
364        attsPackage.addAttribute(null, null, "type", null, "package");
365 
366        handler.startDocument();
367        handler.startElement(null, null, "dependencies", attsEmpty);
368        handler.startElement(null, null, "package", attsEmpty);
369        handler.startElement(null, null, "name", attsEmpty);
370        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
371        handler.endElement(null, null, "name");
372        handler.startElement(null, null, "inbound", attsPackage);
373        handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0, OTHER_PACKAGE_NAME.length());
374        handler.endElement(null, null, "inbound");
375        handler.endElement(null, null, "package");
376        handler.endElement(null, null, "dependencies");
377        handler.endDocument();
378 
379        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
380        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
381        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
382        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
383        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
384 
385        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
386 
387        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
388    }
389 
390    public void testInferredInboundPackageDependency() throws SAXException {
391        AttributesImpl attsEmpty = new AttributesImpl();
392        AttributesImpl attsNo = new AttributesImpl();
393        attsNo.addAttribute(null, null, "confirmed", null, "no");
394        AttributesImpl attsPackageNo = new AttributesImpl();
395        attsPackageNo.addAttribute(null, null, "type", null, "package");
396        attsPackageNo.addAttribute(null, null, "confirmed", null, "no");
397 
398        handler.startDocument();
399        handler.startElement(null, null, "dependencies", attsEmpty);
400        handler.startElement(null, null, "package", attsNo);
401        handler.startElement(null, null, "name", attsEmpty);
402        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
403        handler.endElement(null, null, "name");
404        handler.startElement(null, null, "inbound", attsPackageNo);
405        handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0, OTHER_PACKAGE_NAME.length());
406        handler.endElement(null, null, "inbound");
407        handler.endElement(null, null, "package");
408        handler.endElement(null, null, "dependencies");
409        handler.endDocument();
410 
411        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
412        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
413        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
414        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
415        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
416 
417        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
418 
419        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
420    }
421 
422    public void testConfirmedInboundPackageDependency() throws SAXException {
423        AttributesImpl attsEmpty = new AttributesImpl();
424        AttributesImpl attsYes = new AttributesImpl();
425        attsYes.addAttribute(null, null, "confirmed", null, "yes");
426        AttributesImpl attsPackageYes = new AttributesImpl();
427        attsPackageYes.addAttribute(null, null, "type", null, "package");
428        attsPackageYes.addAttribute(null, null, "confirmed", null, "yes");
429 
430        handler.startDocument();
431        handler.startElement(null, null, "dependencies", attsEmpty);
432        handler.startElement(null, null, "package", attsYes);
433        handler.startElement(null, null, "name", attsEmpty);
434        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
435        handler.endElement(null, null, "name");
436        handler.startElement(null, null, "inbound", attsPackageYes);
437        handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0, OTHER_PACKAGE_NAME.length());
438        handler.endElement(null, null, "inbound");
439        handler.endElement(null, null, "package");
440        handler.endElement(null, null, "dependencies");
441        handler.endDocument();
442 
443        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
444        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
445        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
446        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
447        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
448 
449        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
450 
451        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
452    }
453 
454    public void testUnspecifiedOutboundPackageDependencyIsConfirmed() throws SAXException {
455        Attributes attsEmpty = new AttributesImpl();
456        AttributesImpl attsPackage = new AttributesImpl();
457        attsPackage.addAttribute(null, null, "type", null, "package");
458 
459        handler.startDocument();
460        handler.startElement(null, null, "dependencies", attsEmpty);
461        handler.startElement(null, null, "package", attsEmpty);
462        handler.startElement(null, null, "name", attsEmpty);
463        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
464        handler.endElement(null, null, "name");
465        handler.startElement(null, null, "outbound", attsPackage);
466        handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0, OTHER_PACKAGE_NAME.length());
467        handler.endElement(null, null, "outbound");
468        handler.endElement(null, null, "package");
469        handler.endElement(null, null, "dependencies");
470        handler.endDocument();
471 
472        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
473        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
474        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
475        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
476        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
477 
478        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
479 
480        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
481    }
482 
483    public void testInferredOutboundPackageDependency() throws SAXException {
484        AttributesImpl attsEmpty = new AttributesImpl();
485        AttributesImpl attsNo = new AttributesImpl();
486        attsNo.addAttribute(null, null, "confirmed", null, "no");
487        AttributesImpl attsPackageNo = new AttributesImpl();
488        attsPackageNo.addAttribute(null, null, "type", null, "package");
489        attsPackageNo.addAttribute(null, null, "confirmed", null, "no");
490 
491        handler.startDocument();
492        handler.startElement(null, null, "dependencies", attsEmpty);
493        handler.startElement(null, null, "package", attsNo);
494        handler.startElement(null, null, "name", attsEmpty);
495        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
496        handler.endElement(null, null, "name");
497        handler.startElement(null, null, "outbound", attsPackageNo);
498        handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0, OTHER_PACKAGE_NAME.length());
499        handler.endElement(null, null, "outbound");
500        handler.endElement(null, null, "package");
501        handler.endElement(null, null, "dependencies");
502        handler.endDocument();
503 
504        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
505        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
506        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
507        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
508        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
509 
510        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
511 
512        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
513    }
514 
515    public void testConfirmedOutboundPackageDependency() throws SAXException {
516        AttributesImpl attsEmpty = new AttributesImpl();
517        AttributesImpl attsYes = new AttributesImpl();
518        attsYes.addAttribute(null, null, "confirmed", null, "yes");
519        AttributesImpl attsPackageYes = new AttributesImpl();
520        attsPackageYes.addAttribute(null, null, "type", null, "package");
521        attsPackageYes.addAttribute(null, null, "confirmed", null, "yes");
522 
523        handler.startDocument();
524        handler.startElement(null, null, "dependencies", attsEmpty);
525        handler.startElement(null, null, "package", attsYes);
526        handler.startElement(null, null, "name", attsEmpty);
527        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
528        handler.endElement(null, null, "name");
529        handler.startElement(null, null, "outbound", attsPackageYes);
530        handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0, OTHER_PACKAGE_NAME.length());
531        handler.endElement(null, null, "outbound");
532        handler.endElement(null, null, "package");
533        handler.endElement(null, null, "dependencies");
534        handler.endDocument();
535 
536        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
537        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
538        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
539        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
540        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
541 
542        assertEquals("nb classes", 0, handler.getFactory().getClasses().size());
543 
544        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
545    }
546 
547    public void testUnspecifiedInboundClassDependencyIsConfirmed() throws SAXException {
548        Attributes attsEmpty = new AttributesImpl();
549        AttributesImpl attsClass = new AttributesImpl();
550        attsClass.addAttribute(null, null, "type", null, "class");
551 
552        handler.startDocument();
553        handler.startElement(null, null, "dependencies", attsEmpty);
554        handler.startElement(null, null, "package", attsEmpty);
555        handler.startElement(null, null, "name", attsEmpty);
556        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
557        handler.endElement(null, null, "name");
558        handler.startElement(null, null, "inbound", attsClass);
559        handler.characters(OTHER_CLASS_NAME.toCharArray(), 0, OTHER_CLASS_NAME.length());
560        handler.endElement(null, null, "inbound");
561        handler.endElement(null, null, "package");
562        handler.endElement(null, null, "dependencies");
563        handler.endDocument();
564 
565        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
566        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
567        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
568        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
569        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
570 
571        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
572        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
573        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
574 
575        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
576    }
577 
578    public void testInferredInboundClassDependency() throws SAXException {
579        AttributesImpl attsEmpty = new AttributesImpl();
580        AttributesImpl attsNo = new AttributesImpl();
581        attsNo.addAttribute(null, null, "confirmed", null, "no");
582        AttributesImpl attsClassNo = new AttributesImpl();
583        attsClassNo.addAttribute(null, null, "type", null, "class");
584        attsClassNo.addAttribute(null, null, "confirmed", null, "no");
585 
586        handler.startDocument();
587        handler.startElement(null, null, "dependencies", attsEmpty);
588        handler.startElement(null, null, "package", attsNo);
589        handler.startElement(null, null, "name", attsEmpty);
590        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
591        handler.endElement(null, null, "name");
592        handler.startElement(null, null, "inbound", attsClassNo);
593        handler.characters(OTHER_CLASS_NAME.toCharArray(), 0, OTHER_CLASS_NAME.length());
594        handler.endElement(null, null, "inbound");
595        handler.endElement(null, null, "package");
596        handler.endElement(null, null, "dependencies");
597        handler.endDocument();
598 
599        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
600        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
601        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
602        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
603        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
604 
605        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
606        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
607        assertFalse("class is confirmed", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
608 
609        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
610    }
611 
612    public void testConfirmedInboundClassDependency() throws SAXException {
613        AttributesImpl attsEmpty = new AttributesImpl();
614        AttributesImpl attsYes = new AttributesImpl();
615        attsYes.addAttribute(null, null, "confirmed", null, "yes");
616        AttributesImpl attsClassYes = new AttributesImpl();
617        attsClassYes.addAttribute(null, null, "type", null, "class");
618        attsClassYes.addAttribute(null, null, "confirmed", null, "yes");
619 
620        handler.startDocument();
621        handler.startElement(null, null, "dependencies", attsEmpty);
622        handler.startElement(null, null, "package", attsYes);
623        handler.startElement(null, null, "name", attsEmpty);
624        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
625        handler.endElement(null, null, "name");
626        handler.startElement(null, null, "inbound", attsClassYes);
627        handler.characters(OTHER_CLASS_NAME.toCharArray(), 0, OTHER_CLASS_NAME.length());
628        handler.endElement(null, null, "inbound");
629        handler.endElement(null, null, "package");
630        handler.endElement(null, null, "dependencies");
631        handler.endDocument();
632 
633        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
634        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
635        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
636        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
637        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
638 
639        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
640        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
641        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
642 
643        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
644    }
645 
646    public void testUnspecifiedOutboundClassDependencyIsConfirmed() throws SAXException {
647        Attributes attsEmpty = new AttributesImpl();
648        AttributesImpl attsClass = new AttributesImpl();
649        attsClass.addAttribute(null, null, "type", null, "class");
650 
651        handler.startDocument();
652        handler.startElement(null, null, "dependencies", attsEmpty);
653        handler.startElement(null, null, "package", attsEmpty);
654        handler.startElement(null, null, "name", attsEmpty);
655        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
656        handler.endElement(null, null, "name");
657        handler.startElement(null, null, "outbound", attsClass);
658        handler.characters(OTHER_CLASS_NAME.toCharArray(), 0, OTHER_CLASS_NAME.length());
659        handler.endElement(null, null, "outbound");
660        handler.endElement(null, null, "package");
661        handler.endElement(null, null, "dependencies");
662        handler.endDocument();
663 
664        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
665        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
666        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
667        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
668        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
669 
670        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
671        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
672        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
673 
674        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
675    }
676 
677    public void testInferredOutboundClassDependency() throws SAXException {
678        AttributesImpl attsEmpty = new AttributesImpl();
679        AttributesImpl attsNo = new AttributesImpl();
680        attsNo.addAttribute(null, null, "confirmed", null, "no");
681        AttributesImpl attsClassNo = new AttributesImpl();
682        attsClassNo.addAttribute(null, null, "type", null, "class");
683        attsClassNo.addAttribute(null, null, "confirmed", null, "no");
684 
685        handler.startDocument();
686        handler.startElement(null, null, "dependencies", attsEmpty);
687        handler.startElement(null, null, "package", attsNo);
688        handler.startElement(null, null, "name", attsEmpty);
689        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
690        handler.endElement(null, null, "name");
691        handler.startElement(null, null, "outbound", attsClassNo);
692        handler.characters(OTHER_CLASS_NAME.toCharArray(), 0, OTHER_CLASS_NAME.length());
693        handler.endElement(null, null, "outbound");
694        handler.endElement(null, null, "package");
695        handler.endElement(null, null, "dependencies");
696        handler.endDocument();
697 
698        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
699        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
700        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
701        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
702        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
703 
704        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
705        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
706        assertFalse("class is confirmed", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
707 
708        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
709    }
710 
711    public void testConfirmedOutboundClassDependency() throws SAXException {
712        AttributesImpl attsEmpty = new AttributesImpl();
713        AttributesImpl attsYes = new AttributesImpl();
714        attsYes.addAttribute(null, null, "confirmed", null, "yes");
715        AttributesImpl attsClassYes = new AttributesImpl();
716        attsClassYes.addAttribute(null, null, "type", null, "class");
717        attsClassYes.addAttribute(null, null, "confirmed", null, "yes");
718 
719        handler.startDocument();
720        handler.startElement(null, null, "dependencies", attsEmpty);
721        handler.startElement(null, null, "package", attsYes);
722        handler.startElement(null, null, "name", attsEmpty);
723        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
724        handler.endElement(null, null, "name");
725        handler.startElement(null, null, "outbound", attsClassYes);
726        handler.characters(OTHER_CLASS_NAME.toCharArray(), 0, OTHER_CLASS_NAME.length());
727        handler.endElement(null, null, "outbound");
728        handler.endElement(null, null, "package");
729        handler.endElement(null, null, "dependencies");
730        handler.endDocument();
731 
732        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
733        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
734        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
735        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
736        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
737 
738        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
739        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
740        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
741 
742        assertEquals("nb features", 0, handler.getFactory().getFeatures().size());
743    }
744 
745// 123456
746 
747    
748    public void testUnspecifiedInboundFeatureDependencyIsConfirmed() throws SAXException {
749        Attributes attsEmpty = new AttributesImpl();
750        AttributesImpl attsFeature = new AttributesImpl();
751        attsFeature.addAttribute(null, null, "type", null, "feature");
752 
753        handler.startDocument();
754        handler.startElement(null, null, "dependencies", attsEmpty);
755        handler.startElement(null, null, "package", attsEmpty);
756        handler.startElement(null, null, "name", attsEmpty);
757        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
758        handler.endElement(null, null, "name");
759        handler.startElement(null, null, "inbound", attsFeature);
760        handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0, OTHER_FEATURE_NAME.length());
761        handler.endElement(null, null, "inbound");
762        handler.endElement(null, null, "package");
763        handler.endElement(null, null, "dependencies");
764        handler.endDocument();
765 
766        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
767        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
768        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
769        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
770        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
771 
772        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
773        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
774        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
775 
776        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
777        assertNotNull("missing feature", handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME));
778        assertTrue("feature is inferred", ((Node) handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
779    }
780 
781    public void testInferredInboundFeatureDependency() throws SAXException {
782        AttributesImpl attsEmpty = new AttributesImpl();
783        AttributesImpl attsNo = new AttributesImpl();
784        attsNo.addAttribute(null, null, "confirmed", null, "no");
785        AttributesImpl attsFeatureNo = new AttributesImpl();
786        attsFeatureNo.addAttribute(null, null, "type", null, "feature");
787        attsFeatureNo.addAttribute(null, null, "confirmed", null, "no");
788 
789        handler.startDocument();
790        handler.startElement(null, null, "dependencies", attsEmpty);
791        handler.startElement(null, null, "package", attsNo);
792        handler.startElement(null, null, "name", attsEmpty);
793        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
794        handler.endElement(null, null, "name");
795        handler.startElement(null, null, "inbound", attsFeatureNo);
796        handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0, OTHER_FEATURE_NAME.length());
797        handler.endElement(null, null, "inbound");
798        handler.endElement(null, null, "package");
799        handler.endElement(null, null, "dependencies");
800        handler.endDocument();
801 
802        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
803        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
804        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
805        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
806        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
807 
808        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
809        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
810        assertFalse("class is confirmed", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
811 
812        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
813        assertNotNull("missing feature", handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME));
814        assertFalse("feature is confirmed", ((Node) handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
815    }
816 
817    public void testConfirmedInboundFeatureDependency() throws SAXException {
818        AttributesImpl attsEmpty = new AttributesImpl();
819        AttributesImpl attsYes = new AttributesImpl();
820        attsYes.addAttribute(null, null, "confirmed", null, "yes");
821        AttributesImpl attsFeatureYes = new AttributesImpl();
822        attsFeatureYes.addAttribute(null, null, "type", null, "feature");
823        attsFeatureYes.addAttribute(null, null, "confirmed", null, "yes");
824 
825        handler.startDocument();
826        handler.startElement(null, null, "dependencies", attsEmpty);
827        handler.startElement(null, null, "package", attsYes);
828        handler.startElement(null, null, "name", attsEmpty);
829        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
830        handler.endElement(null, null, "name");
831        handler.startElement(null, null, "inbound", attsFeatureYes);
832        handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0, OTHER_FEATURE_NAME.length());
833        handler.endElement(null, null, "inbound");
834        handler.endElement(null, null, "package");
835        handler.endElement(null, null, "dependencies");
836        handler.endDocument();
837 
838        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
839        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
840        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
841        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
842        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
843 
844        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
845        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
846        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
847 
848        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
849        assertNotNull("missing feature", handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME));
850        assertTrue("feature is inferred", ((Node) handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
851    }
852 
853    public void testUnspecifiedOutboundFeatureDependencyIsConfirmed() throws SAXException {
854        Attributes attsEmpty = new AttributesImpl();
855        AttributesImpl attsFeature = new AttributesImpl();
856        attsFeature.addAttribute(null, null, "type", null, "feature");
857 
858        handler.startDocument();
859        handler.startElement(null, null, "dependencies", attsEmpty);
860        handler.startElement(null, null, "package", attsEmpty);
861        handler.startElement(null, null, "name", attsEmpty);
862        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
863        handler.endElement(null, null, "name");
864        handler.startElement(null, null, "outbound", attsFeature);
865        handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0, OTHER_FEATURE_NAME.length());
866        handler.endElement(null, null, "outbound");
867        handler.endElement(null, null, "package");
868        handler.endElement(null, null, "dependencies");
869        handler.endDocument();
870 
871        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
872        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
873        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
874        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
875        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
876 
877        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
878        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
879        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
880 
881        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
882        assertNotNull("missing feature", handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME));
883        assertTrue("feature is inferred", ((Node) handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
884    }
885 
886    public void testInferredOutboundFeatureDependency() throws SAXException {
887        AttributesImpl attsEmpty = new AttributesImpl();
888        AttributesImpl attsNo = new AttributesImpl();
889        attsNo.addAttribute(null, null, "confirmed", null, "no");
890        AttributesImpl attsFeatureNo = new AttributesImpl();
891        attsFeatureNo.addAttribute(null, null, "type", null, "feature");
892        attsFeatureNo.addAttribute(null, null, "confirmed", null, "no");
893 
894        handler.startDocument();
895        handler.startElement(null, null, "dependencies", attsEmpty);
896        handler.startElement(null, null, "package", attsNo);
897        handler.startElement(null, null, "name", attsEmpty);
898        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
899        handler.endElement(null, null, "name");
900        handler.startElement(null, null, "outbound", attsFeatureNo);
901        handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0, OTHER_FEATURE_NAME.length());
902        handler.endElement(null, null, "outbound");
903        handler.endElement(null, null, "package");
904        handler.endElement(null, null, "dependencies");
905        handler.endDocument();
906 
907        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
908        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
909        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
910        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
911        assertFalse("package is confirmed", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
912 
913        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
914        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
915        assertFalse("class is confirmed", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
916 
917        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
918        assertNotNull("missing feature", handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME));
919        assertFalse("feature is confirmed", ((Node) handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
920    }
921 
922    public void testConfirmedOutboundFeatureDependency() throws SAXException {
923        AttributesImpl attsEmpty = new AttributesImpl();
924        AttributesImpl attsYes = new AttributesImpl();
925        attsYes.addAttribute(null, null, "confirmed", null, "yes");
926        AttributesImpl attsFeatureYes = new AttributesImpl();
927        attsFeatureYes.addAttribute(null, null, "type", null, "feature");
928        attsFeatureYes.addAttribute(null, null, "confirmed", null, "yes");
929 
930        handler.startDocument();
931        handler.startElement(null, null, "dependencies", attsEmpty);
932        handler.startElement(null, null, "package", attsYes);
933        handler.startElement(null, null, "name", attsEmpty);
934        handler.characters(MY_PACKAGE_NAME.toCharArray(), 0, MY_PACKAGE_NAME.length());
935        handler.endElement(null, null, "name");
936        handler.startElement(null, null, "outbound", attsFeatureYes);
937        handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0, OTHER_FEATURE_NAME.length());
938        handler.endElement(null, null, "outbound");
939        handler.endElement(null, null, "package");
940        handler.endElement(null, null, "dependencies");
941        handler.endDocument();
942 
943        assertEquals("nb packages", 2, handler.getFactory().getPackages().size());
944        assertNotNull("missing package", handler.getFactory().getPackages().get(MY_PACKAGE_NAME));
945        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
946        assertNotNull("missing package", handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME));
947        assertTrue("package is inferred", ((Node) handler.getFactory().getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
948 
949        assertEquals("nb classes", 1, handler.getFactory().getClasses().size());
950        assertNotNull("missing class", handler.getFactory().getClasses().get(OTHER_CLASS_NAME));
951        assertTrue("class is inferred", ((Node) handler.getFactory().getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
952 
953        assertEquals("nb features", 1, handler.getFactory().getFeatures().size());
954        assertNotNull("missing feature", handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME));
955        assertTrue("feature is inferred", ((Node) handler.getFactory().getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
956    }
957}

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