Source Code Cross Referenced for AbstractFactoryTest.java in  » IDE-Netbeans » xml » org » netbeans » tax » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » xml » org.netbeans.tax 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package org.netbeans.tax;
042:
043:        import org.netbeans.tax.TreeElementDecl.ContentType;
044:        import org.netbeans.tests.xml.XTest;
045:        import org.openide.util.Utilities;
046:
047:        abstract class AbstractFactoryTest extends XTest {
048:            final private static String NOT_EXCEPTION = "The InvalidArgumetException wasn't throwed ";
049:
050:            public AbstractFactoryTest(String testName) {
051:                super (testName);
052:            }
053:
054:            //--------------------------------------------------------------------------
055:
056:            static TreeAttlistDecl createAttlistDecl(java.lang.String string,
057:                    String view) throws Exception {
058:                TreeAttlistDecl node = new TreeAttlistDecl(string);
059:
060:                assertEquals(node, view);
061:                cloneNodeTest(node, view);
062:                return node;
063:            }
064:
065:            static void createAttlistDeclInvalid(java.lang.String string)
066:                    throws Exception {
067:                try {
068:                    new TreeAttlistDecl(string);
069:                    // Fail if previous line doesn't trhow exception.
070:                    fail(NOT_EXCEPTION + "from: new TreeAttlistDecl(string)");
071:                } catch (InvalidArgumentException e) {
072:                    // OK
073:                }
074:            }
075:
076:            //--------------------------------------------------------------------------
077:
078:            static TreeAttribute createAttribute(java.lang.String string,
079:                    java.lang.String string1, boolean boolean_val, String view)
080:                    throws Exception {
081:                TreeAttribute node = new TreeAttribute(string, string1,
082:                        boolean_val);
083:
084:                assertEquals(node, view);
085:                cloneNodeTest(node, view);
086:                return node;
087:            }
088:
089:            static void createAttributeInvalid(java.lang.String string,
090:                    java.lang.String string1, boolean boolean_val)
091:                    throws Exception {
092:                try {
093:                    new TreeAttribute(string, string1, boolean_val);
094:                    // Fail if previous line doesn't trhow exception.
095:                    fail(NOT_EXCEPTION
096:                            + "from: new TreeAttribute(string, string1, boolean_val)");
097:                } catch (InvalidArgumentException e) {
098:                    // OK
099:                }
100:            }
101:
102:            //--------------------------------------------------------------------------
103:
104:            static TreeAttribute createAttribute(java.lang.String string,
105:                    java.lang.String string1, String view) throws Exception {
106:                TreeAttribute node = new TreeAttribute(string, string1);
107:
108:                assertEquals(node, view);
109:                cloneNodeTest(node, view);
110:                return node;
111:            }
112:
113:            static void createAttributeInvalid(java.lang.String string,
114:                    java.lang.String string1) throws Exception {
115:                try {
116:                    new TreeAttribute(string, string1);
117:                    // Fail if previous line doesn't trhow exception.
118:                    fail(NOT_EXCEPTION
119:                            + "from: new TreeAttribute(string, string1)");
120:                } catch (InvalidArgumentException e) {
121:                    // OK
122:                }
123:            }
124:
125:            //--------------------------------------------------------------------------
126:
127:            static TreeCDATASection createCDATASection(java.lang.String string,
128:                    String view) throws Exception {
129:                TreeCDATASection node = new TreeCDATASection(string);
130:
131:                assertEquals(node, view);
132:                cloneNodeTest(node, view);
133:                return node;
134:            }
135:
136:            static void createCDATASectionInvalid(java.lang.String string)
137:                    throws Exception {
138:                try {
139:                    new TreeCDATASection(string);
140:                    // Fail if previous line doesn't trhow exception.
141:                    fail(NOT_EXCEPTION + "from: new TreeCDATASection(string)");
142:                } catch (InvalidArgumentException e) {
143:                    // OK
144:                }
145:            }
146:
147:            //--------------------------------------------------------------------------
148:
149:            static TreeCharacterReference createCharacterReference(
150:                    java.lang.String string, String view) throws Exception {
151:                TreeCharacterReference node = new TreeCharacterReference(string);
152:
153:                assertEquals(node, view);
154:                cloneNodeTest(node, view);
155:                return node;
156:            }
157:
158:            static void createCharacterReferenceInvalid(java.lang.String string)
159:                    throws Exception {
160:                try {
161:                    new TreeCharacterReference(string);
162:                    // Fail if previous line doesn't trhow exception.
163:                    fail(NOT_EXCEPTION
164:                            + "from: new TreeCharacterReference(string)");
165:                } catch (InvalidArgumentException e) {
166:                    // OK
167:                }
168:            }
169:
170:            //--------------------------------------------------------------------------
171:
172:            static TreeComment createComment(java.lang.String string,
173:                    String view) throws Exception {
174:                TreeComment node = new TreeComment(string);
175:
176:                assertEquals(node, view);
177:                cloneNodeTest(node, view);
178:                return node;
179:            }
180:
181:            static void createCommentInvalid(java.lang.String string)
182:                    throws Exception {
183:                try {
184:                    new TreeComment(string);
185:                    // Fail if previous line doesn't trhow exception.
186:                    fail(NOT_EXCEPTION + "from: new TreeComment(string)");
187:                } catch (InvalidArgumentException e) {
188:                    // OK
189:                }
190:            }
191:
192:            //--------------------------------------------------------------------------
193:
194:            static TreeConditionalSection createConditionalSection(
195:                    boolean boolean_val, String view) throws Exception {
196:                TreeConditionalSection node = new TreeConditionalSection(
197:                        boolean_val);
198:
199:                assertEquals(node, view);
200:                cloneNodeTest(node, view);
201:                return node;
202:            }
203:
204:            //--------------------------------------------------------------------------
205:
206:            static TreeDTD createDTD(java.lang.String string,
207:                    java.lang.String string1, String view) throws Exception {
208:                TreeDTD node = new TreeDTD(string, string1);
209:
210:                assertEquals(node, view);
211:                cloneNodeTest(node, view);
212:                return node;
213:            }
214:
215:            static void createDTDInvalid(java.lang.String string,
216:                    java.lang.String string1) throws Exception {
217:                try {
218:                    new TreeDTD(string, string1);
219:                    // Fail if previous line doesn't trhow exception.
220:                    fail(NOT_EXCEPTION + "from: new TreeDTD(string, string1)");
221:                } catch (InvalidArgumentException e) {
222:                    // OK
223:                }
224:            }
225:
226:            //--------------------------------------------------------------------------
227:
228:            static TreeDocument createDocument(java.lang.String string,
229:                    java.lang.String string1, java.lang.String string2,
230:                    String view) throws Exception {
231:                TreeDocument node = new TreeDocument(string, string1, string2);
232:
233:                assertEquals(node, view);
234:                cloneNodeTest(node, view);
235:                return node;
236:            }
237:
238:            static void createDocumentInvalid(java.lang.String string,
239:                    java.lang.String string1, java.lang.String string2)
240:                    throws Exception {
241:                try {
242:                    new TreeDocument(string, string1, string2);
243:                    // Fail if previous line doesn't trhow exception.
244:                    fail(NOT_EXCEPTION
245:                            + "from: new TreeDocument(string, string1, string2)");
246:                } catch (InvalidArgumentException e) {
247:                    // OK
248:                }
249:            }
250:
251:            //--------------------------------------------------------------------------
252:
253:            static TreeDocumentFragment createDocumentFragment(
254:                    java.lang.String string, java.lang.String string1,
255:                    String view) throws Exception {
256:                TreeDocumentFragment node = new TreeDocumentFragment(string,
257:                        string1);
258:
259:                assertEquals(node, view);
260:                cloneNodeTest(node, view);
261:                return node;
262:            }
263:
264:            static void createDocumentFragmentInvalid(java.lang.String string,
265:                    java.lang.String string1) throws Exception {
266:                try {
267:                    new TreeDocumentFragment(string, string1);
268:                    // Fail if previous line doesn't trhow exception.
269:                    fail(NOT_EXCEPTION
270:                            + "from: new TreeDocumentFragment(string, string1)");
271:                } catch (InvalidArgumentException e) {
272:                    // OK
273:                }
274:            }
275:
276:            //--------------------------------------------------------------------------
277:
278:            static TreeDocumentType createDocumentType(java.lang.String string,
279:                    java.lang.String string1, java.lang.String string2,
280:                    String view) throws Exception {
281:                TreeDocumentType node = new TreeDocumentType(string, string1,
282:                        string2);
283:
284:                assertEquals(node, view);
285:                cloneNodeTest(node, view);
286:                return node;
287:            }
288:
289:            static void createDocumentTypeInvalid(java.lang.String string,
290:                    java.lang.String string1, java.lang.String string2)
291:                    throws Exception {
292:                try {
293:                    new TreeDocumentType(string, string1, string2);
294:                    // Fail if previous line doesn't trhow exception.
295:                    fail(NOT_EXCEPTION
296:                            + "from: new TreeDocumentType(string, string1, string2)");
297:                } catch (InvalidArgumentException e) {
298:                    // OK
299:                }
300:            }
301:
302:            //--------------------------------------------------------------------------
303:
304:            static TreeDocumentType createDocumentType(java.lang.String string,
305:                    String view) throws Exception {
306:                TreeDocumentType node = new TreeDocumentType(string);
307:
308:                assertEquals(node, view);
309:                cloneNodeTest(node, view);
310:                return node;
311:            }
312:
313:            static void createDocumentTypeInvalid(java.lang.String string)
314:                    throws Exception {
315:                try {
316:                    new TreeDocumentType(string);
317:                    // Fail if previous line doesn't trhow exception.
318:                    fail(NOT_EXCEPTION + "from: new TreeDocumentType(string)");
319:                } catch (InvalidArgumentException e) {
320:                    // OK
321:                }
322:            }
323:
324:            //--------------------------------------------------------------------------
325:
326:            static TreeElement createElement(java.lang.String string,
327:                    boolean boolean_val, String view) throws Exception {
328:                TreeElement node = new TreeElement(string, boolean_val);
329:
330:                assertEquals(node, view);
331:                cloneNodeTest(node, view);
332:                return node;
333:            }
334:
335:            static void createElementInvalid(java.lang.String string,
336:                    boolean boolean_val) throws Exception {
337:                try {
338:                    new TreeElement(string, boolean_val);
339:                    // Fail if previous line doesn't trhow exception.
340:                    fail(NOT_EXCEPTION
341:                            + "from: new TreeElement(string, boolean_val)");
342:                } catch (InvalidArgumentException e) {
343:                    // OK
344:                }
345:            }
346:
347:            //--------------------------------------------------------------------------
348:
349:            static TreeElement createElement(java.lang.String string,
350:                    String view) throws Exception {
351:                TreeElement node = new TreeElement(string);
352:
353:                assertEquals(node, view);
354:                cloneNodeTest(node, view);
355:                return node;
356:            }
357:
358:            static void createElementInvalid(java.lang.String string)
359:                    throws Exception {
360:                try {
361:                    new TreeElement(string);
362:                    // Fail if previous line doesn't trhow exception.
363:                    fail(NOT_EXCEPTION + "from: new TreeElement(string)");
364:                } catch (InvalidArgumentException e) {
365:                    // OK
366:                }
367:            }
368:
369:            //--------------------------------------------------------------------------
370:
371:            static TreeElementDecl createElementDecl(java.lang.String string,
372:                    ContentType treeelementdecl$contenttype, String view)
373:                    throws Exception {
374:                TreeElementDecl node = new TreeElementDecl(string,
375:                        treeelementdecl$contenttype);
376:
377:                assertEquals(node, view);
378:                cloneNodeTest(node, view);
379:                return node;
380:            }
381:
382:            static void createElementDeclInvalid(java.lang.String string,
383:                    ContentType treeelementdecl$contenttype) throws Exception {
384:                try {
385:                    new TreeElementDecl(string, treeelementdecl$contenttype);
386:                    // Fail if previous line doesn't trhow exception.
387:                    fail(NOT_EXCEPTION
388:                            + "from: new TreeElementDecl(string, treeelementdecl$contenttype)");
389:                } catch (InvalidArgumentException e) {
390:                    // OK
391:                }
392:            }
393:
394:            //--------------------------------------------------------------------------
395:
396:            /*
397:             static TreeElementDecl createElementDecl(java.lang.String string, java.lang.String string1, String view) throws Exception {
398:             TreeElementDecl node = new TreeElementDecl(string, string1);
399:            
400:             assertEquals(node, view);
401:             cloneNodeTest(node, view);
402:             return node;
403:             }
404:            
405:             static void createElementDeclInvalid(java.lang.String string, java.lang.String string1) throws Exception {
406:             try {
407:             new TreeElementDecl(string, string1);
408:             // Fail if previous line doesn't trhow exception.
409:             fail(NOT_EXCEPTION + "from: new TreeElementDecl(string, string1)");
410:             } catch (InvalidArgumentException e) {
411:             // OK
412:             }
413:             }
414:            
415:             */
416:            //--------------------------------------------------------------------------
417:
418:            static TreeEntityDecl createEntityDecl(boolean boolean_val,
419:                    java.lang.String string, java.lang.String string2,
420:                    String view) throws Exception {
421:                TreeEntityDecl node = new TreeEntityDecl(boolean_val, string,
422:                        string2);
423:
424:                assertEquals(node, view);
425:                cloneNodeTest(node, view);
426:                return node;
427:            }
428:
429:            static void createEntityDeclInvalid(boolean boolean_val,
430:                    java.lang.String string, java.lang.String string2)
431:                    throws Exception {
432:                try {
433:                    new TreeEntityDecl(boolean_val, string, string2);
434:                    // Fail if previous line doesn't trhow exception.
435:                    fail(NOT_EXCEPTION
436:                            + "from: new TreeEntityDecl(boolean_val, string, string2)");
437:                } catch (InvalidArgumentException e) {
438:                    // OK
439:                }
440:            }
441:
442:            //--------------------------------------------------------------------------
443:
444:            static TreeEntityDecl createEntityDecl(java.lang.String string,
445:                    java.lang.String string1, String view) throws Exception {
446:                TreeEntityDecl node = new TreeEntityDecl(string, string1);
447:
448:                assertEquals(node, view);
449:                cloneNodeTest(node, view);
450:                return node;
451:            }
452:
453:            static void createEntityDeclInvalid(java.lang.String string,
454:                    java.lang.String string1) throws Exception {
455:                try {
456:                    new TreeEntityDecl(string, string1);
457:                    // Fail if previous line doesn't trhow exception.
458:                    fail(NOT_EXCEPTION
459:                            + "from: new TreeEntityDecl(string, string1)");
460:                } catch (InvalidArgumentException e) {
461:                    // OK
462:                }
463:            }
464:
465:            //--------------------------------------------------------------------------
466:
467:            static TreeEntityDecl createEntityDecl(boolean boolean_val,
468:                    java.lang.String string, java.lang.String string2,
469:                    java.lang.String string3, String view) throws Exception {
470:                TreeEntityDecl node = new TreeEntityDecl(boolean_val, string,
471:                        string2, string3);
472:
473:                assertEquals(node, view);
474:                cloneNodeTest(node, view);
475:                return node;
476:            }
477:
478:            static void createEntityDeclInvalid(boolean boolean_val,
479:                    java.lang.String string, java.lang.String string2,
480:                    java.lang.String string3) throws Exception {
481:                try {
482:                    new TreeEntityDecl(boolean_val, string, string2, string3);
483:                    // Fail if previous line doesn't trhow exception.
484:                    fail(NOT_EXCEPTION
485:                            + "from: new TreeEntityDecl(boolean_val, string, string2, string3)");
486:                } catch (InvalidArgumentException e) {
487:                    // OK
488:                }
489:            }
490:
491:            //--------------------------------------------------------------------------
492:
493:            static TreeEntityDecl createEntityDecl(java.lang.String string,
494:                    java.lang.String string1, java.lang.String string2,
495:                    String view) throws Exception {
496:                TreeEntityDecl node = new TreeEntityDecl(string, string1,
497:                        string2);
498:
499:                assertEquals(node, view);
500:                cloneNodeTest(node, view);
501:                return node;
502:            }
503:
504:            static void createEntityDeclInvalid(java.lang.String string,
505:                    java.lang.String string1, java.lang.String string2)
506:                    throws Exception {
507:                try {
508:                    new TreeEntityDecl(string, string1, string2);
509:                    // Fail if previous line doesn't trhow exception.
510:                    fail(NOT_EXCEPTION
511:                            + "from: new TreeEntityDecl(string, string1, string2)");
512:                } catch (InvalidArgumentException e) {
513:                    // OK
514:                }
515:            }
516:
517:            //--------------------------------------------------------------------------
518:
519:            static TreeEntityDecl createEntityDecl(java.lang.String string,
520:                    java.lang.String string1, java.lang.String string2,
521:                    java.lang.String string3, String view) throws Exception {
522:                TreeEntityDecl node = new TreeEntityDecl(string, string1,
523:                        string2, string3);
524:
525:                assertEquals(node, view);
526:                cloneNodeTest(node, view);
527:                return node;
528:            }
529:
530:            static void createEntityDeclInvalid(java.lang.String string,
531:                    java.lang.String string1, java.lang.String string2,
532:                    java.lang.String string3) throws Exception {
533:                try {
534:                    new TreeEntityDecl(string, string1, string2, string3);
535:                    // Fail if previous line doesn't trhow exception.
536:                    fail(NOT_EXCEPTION
537:                            + "from: new TreeEntityDecl(string, string1, string2, string3)");
538:                } catch (InvalidArgumentException e) {
539:                    // OK
540:                }
541:            }
542:
543:            //--------------------------------------------------------------------------
544:
545:            static TreeGeneralEntityReference createGeneralEntityReference(
546:                    java.lang.String string, String view) throws Exception {
547:                TreeGeneralEntityReference node = new TreeGeneralEntityReference(
548:                        string);
549:
550:                assertEquals(node, view);
551:                cloneNodeTest(node, view);
552:                return node;
553:            }
554:
555:            static void createGeneralEntityReferenceInvalid(
556:                    java.lang.String string) throws Exception {
557:                try {
558:                    new TreeGeneralEntityReference(string);
559:                    // Fail if previous line doesn't trhow exception.
560:                    fail(NOT_EXCEPTION
561:                            + "from: new TreeGeneralEntityReference(string)");
562:                } catch (InvalidArgumentException e) {
563:                    // OK
564:                }
565:            }
566:
567:            //--------------------------------------------------------------------------
568:
569:            static TreeNotationDecl createNotationDecl(java.lang.String string,
570:                    java.lang.String string1, java.lang.String string2,
571:                    String view) throws Exception {
572:                TreeNotationDecl node = new TreeNotationDecl(string, string1,
573:                        string2);
574:
575:                assertEquals(node, view);
576:                cloneNodeTest(node, view);
577:                return node;
578:            }
579:
580:            static void createNotationDeclInvalid(java.lang.String string,
581:                    java.lang.String string1, java.lang.String string2)
582:                    throws Exception {
583:                try {
584:                    new TreeNotationDecl(string, string1, string2);
585:                    // Fail if previous line doesn't trhow exception.
586:                    fail(NOT_EXCEPTION
587:                            + "from: new TreeNotationDecl(string, string1, string2)");
588:                } catch (InvalidArgumentException e) {
589:                    // OK
590:                }
591:            }
592:
593:            //--------------------------------------------------------------------------
594:
595:            static TreeParameterEntityReference createParameterEntityReference(
596:                    java.lang.String string, String view) throws Exception {
597:                TreeParameterEntityReference node = new TreeParameterEntityReference(
598:                        string);
599:
600:                assertEquals(node, view);
601:                cloneNodeTest(node, view);
602:                return node;
603:            }
604:
605:            static void createParameterEntityReferenceInvalid(
606:                    java.lang.String string) throws Exception {
607:                try {
608:                    new TreeParameterEntityReference(string);
609:                    // Fail if previous line doesn't trhow exception.
610:                    fail(NOT_EXCEPTION
611:                            + "from: new TreeParameterEntityReference(string)");
612:                } catch (InvalidArgumentException e) {
613:                    // OK
614:                }
615:            }
616:
617:            //--------------------------------------------------------------------------
618:
619:            static TreeProcessingInstruction createProcessingInstruction(
620:                    java.lang.String string, java.lang.String string1,
621:                    String view) throws Exception {
622:                TreeProcessingInstruction node = new TreeProcessingInstruction(
623:                        string, string1);
624:
625:                assertEquals(node, view);
626:                cloneNodeTest(node, view);
627:                return node;
628:            }
629:
630:            static void createProcessingInstructionInvalid(
631:                    java.lang.String string, java.lang.String string1)
632:                    throws Exception {
633:                try {
634:                    new TreeProcessingInstruction(string, string1);
635:                    // Fail if previous line doesn't trhow exception.
636:                    fail(NOT_EXCEPTION
637:                            + "from: new TreeProcessingInstruction(string, string1)");
638:                } catch (InvalidArgumentException e) {
639:                    // OK
640:                }
641:            }
642:
643:            //--------------------------------------------------------------------------
644:
645:            static TreeText createText(java.lang.String string, String view)
646:                    throws Exception {
647:                TreeText node = new TreeText(string);
648:
649:                assertEquals(node, view);
650:                cloneNodeTest(node, view);
651:                return node;
652:            }
653:
654:            static void createTextInvalid(java.lang.String string)
655:                    throws Exception {
656:                try {
657:                    new TreeText(string);
658:                    // Fail if previous line doesn't trhow exception.
659:                    fail(NOT_EXCEPTION + "from: new TreeText(string)");
660:                } catch (InvalidArgumentException e) {
661:                    // OK
662:                }
663:            }
664:
665:            private static void cloneNodeTest(TreeParentNode node, String view)
666:                    throws Exception {
667:                TreeParentNode clone = (TreeParentNode) node.clone(true);
668:                assertNotEquals(clone, node);
669:                assertEquals(clone, view);
670:
671:                clone = (TreeParentNode) node.clone(false);
672:                assertNotEquals(clone, node);
673:                assertEquals(clone, view);
674:            }
675:
676:            private static void cloneNodeTest(TreeNode node, String view)
677:                    throws Exception {
678:                TreeNode clone = (TreeNode) node.clone();
679:                assertNotEquals(clone, node);
680:                assertEquals(clone, view);
681:            }
682:
683:            private static void assertNotEquals(Object orig, Object clone) {
684:                if (orig == clone) {
685:                    fail("Invalid clone.");
686:                }
687:            }
688:
689:            private static void assertEquals(TreeNode node, String view)
690:                    throws TreeException {
691:                String str = Utilities.replaceString(TestUtil
692:                        .nodeToString(node), "\n", "");
693:                if (!!!str.equals(view)) {
694:                    fail("Invalid node view \n is       : \"" + str
695:                            + "\"\n should be: \"" + view + "\"");
696:                }
697:            }
698:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.