Clover coverage report - Dependency Finder
Coverage timestamp: Mon Nov 29 2010 15:00:50 PST
file stats: LOC: 1,814   Methods: 118
NCLOC: 1,306   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
TestXMLPrinter.java - 99.6% 100% 99.6%
coverage coverage
 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   
 33    package com.jeantessier.classreader;
 34   
 35    import java.io.*;
 36    import java.util.*;
 37    import javax.xml.parsers.*;
 38    import javax.xml.xpath.*;
 39   
 40    import org.apache.oro.text.perl.*;
 41    import org.jmock.*;
 42    import org.jmock.integration.junit3.*;
 43    import org.w3c.dom.*;
 44    import org.xml.sax.*;
 45   
 46    public class TestXMLPrinter extends MockObjectTestCase {
 47    private static final String TEST_CLASS = "test";
 48    private static final String TEST_FILENAME = "classes" + File.separator + "test.class";
 49    private static final String TEST_DIRECTORY = "tests" + File.separator + "JarJarDiff" + File.separator + "new";
 50   
 51    private static final String SPECIFIC_ENCODING = "iso-latin-1";
 52    private static final String SPECIFIC_DTD_PREFIX = "./etc";
 53   
 54    private static final String ANNOTATION_TYPE = "foobar";
 55    private static final String ELEMENT_NAME = "foo";
 56   
 57    private ClassfileLoader loader;
 58    private StringWriter buffer;
 59    private Visitor printer;
 60    private XMLReader reader;
 61    private ErrorHandler errorHandler;
 62   
 63    private Perl5Util perl;
 64   
 65  115 protected void setUp() throws Exception {
 66  115 super.setUp();
 67   
 68  115 loader = new AggregatingClassfileLoader();
 69   
 70  115 buffer = new StringWriter();
 71  115 printer = new XMLPrinter(new PrintWriter(buffer), XMLPrinter.DEFAULT_ENCODING, SPECIFIC_DTD_PREFIX);
 72  115 reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
 73   
 74  115 boolean validate = Boolean.getBoolean("DEPENDENCYFINDER_TESTS_VALIDATE");
 75  115 reader.setFeature("http://xml.org/sax/features/validation", validate);
 76  115 reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", validate);
 77   
 78  115 errorHandler = mock(ErrorHandler.class);
 79  115 reader.setErrorHandler(errorHandler);
 80   
 81  115 perl = new Perl5Util();
 82    }
 83   
 84  1 public void testDefaultDTDPrefix() throws Exception {
 85  1 checking(new Expectations() {{
 86  1 one (errorHandler).fatalError(with(any(SAXParseException.class)));
 87    }});
 88   
 89  1 buffer = new StringWriter();
 90  1 printer = new XMLPrinter(new PrintWriter(buffer));
 91   
 92  1 String xmlDocument = buffer.toString();
 93  1 assertTrue(xmlDocument + "Missing DTD", perl.match("/DOCTYPE \\S+ SYSTEM \"(.*)\"/", xmlDocument));
 94  1 assertTrue("DTD \"" + perl.group(1) + "\" does not have prefix \"" + XMLPrinter.DEFAULT_DTD_PREFIX + "\"", perl.group(1).startsWith(XMLPrinter.DEFAULT_DTD_PREFIX));
 95   
 96  1 try {
 97  1 reader.parse(new InputSource(new StringReader(xmlDocument)));
 98  0 fail("Parsed non-existant document\n" + xmlDocument);
 99    } catch (SAXParseException ex) {
 100    // Expected
 101    }
 102    }
 103   
 104  1 public void testSpecificDTDPrefix() throws Exception {
 105  1 checking(new Expectations() {{
 106  1 one (errorHandler).fatalError(with(any(SAXParseException.class)));
 107    }});
 108   
 109  1 buffer = new StringWriter();
 110  1 printer = new XMLPrinter(new PrintWriter(buffer), XMLPrinter.DEFAULT_ENCODING, SPECIFIC_DTD_PREFIX);
 111   
 112  1 String xmlDocument = buffer.toString();
 113  1 assertTrue(xmlDocument + "Missing DTD", perl.match("/DOCTYPE \\S+ SYSTEM \"(.*)\"/", xmlDocument));
 114  1 assertTrue("DTD \"" + perl.group(1) + "\" does not have prefix \"./etc\"", perl.group(1).startsWith(SPECIFIC_DTD_PREFIX));
 115   
 116  1 try {
 117  1 reader.parse(new InputSource(new StringReader(xmlDocument)));
 118  0 fail("Parsed non-existant document\n" + xmlDocument);
 119    } catch (SAXParseException ex) {
 120    // Expected
 121    }
 122    }
 123   
 124  1 public void testDefaultEncoding() throws Exception {
 125  1 checking(new Expectations() {{
 126  1 one (errorHandler).fatalError(with(any(SAXParseException.class)));
 127    }});
 128   
 129  1 buffer = new StringWriter();
 130  1 printer = new XMLPrinter(new PrintWriter(buffer));
 131   
 132  1 String xmlDocument = buffer.toString();
 133  1 assertTrue(xmlDocument + "Missing encoding", perl.match("/encoding=\"([^\"]*)\"/", xmlDocument));
 134  1 assertEquals("Encoding", XMLPrinter.DEFAULT_ENCODING, perl.group(1));
 135   
 136  1 try {
 137  1 reader.parse(new InputSource(new StringReader(xmlDocument)));
 138  0 fail("Parsed non-existant document\n" + xmlDocument);
 139    } catch (SAXParseException ex) {
 140    // Expected
 141    }
 142    }
 143   
 144  1 public void testSpecificEncoding() throws Exception {
 145  1 checking(new Expectations() {{
 146  1 one (errorHandler).fatalError(with(any(SAXParseException.class)));
 147    }});
 148   
 149  1 buffer = new StringWriter();
 150  1 printer = new XMLPrinter(new PrintWriter(buffer), SPECIFIC_ENCODING, XMLPrinter.DEFAULT_DTD_PREFIX);
 151   
 152  1 String xmlDocument = buffer.toString();
 153  1 assertTrue(xmlDocument + "Missing encoding", perl.match("/encoding=\"([^\"]*)\"/", xmlDocument));
 154  1 assertEquals("Encoding", SPECIFIC_ENCODING, perl.group(1));
 155   
 156  1 try {
 157  1 reader.parse(new InputSource(new StringReader(xmlDocument)));
 158  0 fail("Parsed non-existant document\n" + xmlDocument);
 159    } catch (SAXParseException ex) {
 160    // Expected
 161    }
 162    }
 163   
 164  1 public void testSingleClassfile() throws Exception {
 165  1 loader.load(Collections.singleton(TEST_FILENAME));
 166   
 167  1 loader.getClassfile(TEST_CLASS).accept(printer);
 168   
 169  1 String xmlDocument = buffer.toString();
 170  1 assertXPathCount(xmlDocument, "classfile[this-class='" + TEST_CLASS + "']", 1);
 171    }
 172   
 173  1 public void testZeroClassfile() throws Exception {
 174  1 printer.visitClassfiles(Collections.<Classfile>emptyList());
 175   
 176  1 String xmlDocument = buffer.toString();
 177  1 assertXPathCount(xmlDocument, "*/classfile[this-class='" + TEST_CLASS + "']", 0);
 178    }
 179   
 180  1 public void testOneClassfile() throws Exception {
 181  1 loader.load(Collections.singleton(TEST_FILENAME));
 182   
 183  1 printer.visitClassfiles(loader.getAllClassfiles());
 184   
 185  1 String xmlDocument = buffer.toString();
 186  1 assertXPathCount(xmlDocument, "*/classfile", loader.getAllClassfiles().size());
 187    }
 188   
 189  1 public void testMultipleClassfiles() throws Exception {
 190  1 loader.load(Collections.singleton(TEST_DIRECTORY));
 191   
 192  1 printer.visitClassfiles(loader.getAllClassfiles());
 193   
 194  1 String xmlDocument = buffer.toString();
 195  1 assertXPathCount(xmlDocument, "*/classfile", loader.getAllClassfiles().size());
 196    }
 197   
 198  1 public void testNonPublicClassfile() throws Exception {
 199  1 final Classfile mockClassfile = mock(Classfile.class);
 200   
 201  1 checking(new Expectations() {{
 202  1 one (mockClassfile).isPublic(); will(returnValue(false));
 203  1 ignoring (mockClassfile);
 204    }});
 205   
 206  1 printer.visitClassfile(mockClassfile);
 207   
 208  1 String xmlDocument = buffer.toString();
 209  1 assertXPathCount(xmlDocument, "classfile/public", 0);
 210    }
 211   
 212  1 public void testPublicClassfile() throws Exception {
 213  1 final Classfile mockClassfile = mock(Classfile.class);
 214   
 215  1 checking(new Expectations() {{
 216  1 one (mockClassfile).isPublic(); will(returnValue(true));
 217  1 ignoring (mockClassfile);
 218    }});
 219   
 220  1 printer.visitClassfile(mockClassfile);
 221   
 222  1 String xmlDocument = buffer.toString();
 223  1 assertXPathCount(xmlDocument, "classfile/public", 1);
 224    }
 225   
 226  1 public void testNonFinalClassfile() throws Exception {
 227  1 final Classfile mockClassfile = mock(Classfile.class);
 228   
 229  1 checking(new Expectations() {{
 230  1 one (mockClassfile).isFinal(); will(returnValue(false));
 231  1 ignoring (mockClassfile);
 232    }});
 233   
 234  1 printer.visitClassfile(mockClassfile);
 235   
 236  1 String xmlDocument = buffer.toString();
 237  1 assertXPathCount(xmlDocument, "classfile/final", 0);
 238    }
 239   
 240  1 public void testFinalClassfile() throws Exception {
 241  1 final Classfile mockClassfile = mock(Classfile.class);
 242   
 243  1 checking(new Expectations() {{
 244  1 one (mockClassfile).isFinal(); will(returnValue(true));
 245  1 ignoring (mockClassfile);
 246    }});
 247   
 248  1 printer.visitClassfile(mockClassfile);
 249   
 250  1 String xmlDocument = buffer.toString();
 251  1 assertXPathCount(xmlDocument, "classfile/final", 1);
 252    }
 253   
 254  1 public void testNonSuperClassfile() throws Exception {
 255  1 final Classfile mockClassfile = mock(Classfile.class);
 256   
 257  1 checking(new Expectations() {{
 258  1 one (mockClassfile).isSuper(); will(returnValue(false));
 259  1 ignoring (mockClassfile);
 260    }});
 261   
 262  1 printer.visitClassfile(mockClassfile);
 263   
 264  1 String xmlDocument = buffer.toString();
 265  1 assertXPathCount(xmlDocument, "classfile/super", 0);
 266    }
 267   
 268  1 public void testSuperClassfile() throws Exception {
 269  1 final Classfile mockClassfile = mock(Classfile.class);
 270   
 271  1 checking(new Expectations() {{
 272  1 one (mockClassfile).isSuper(); will(returnValue(true));
 273  1 ignoring (mockClassfile);
 274    }});
 275   
 276  1 printer.visitClassfile(mockClassfile);
 277   
 278  1 String xmlDocument = buffer.toString();
 279  1 assertXPathCount(xmlDocument, "classfile/super", 1);
 280    }
 281   
 282  1 public void testNonInterfaceClassfile() throws Exception {
 283  1 final Classfile mockClassfile = mock(Classfile.class);
 284   
 285  1 checking(new Expectations() {{
 286  1 one (mockClassfile).isInterface(); will(returnValue(false));
 287  1 ignoring (mockClassfile);
 288    }});
 289   
 290  1 printer.visitClassfile(mockClassfile);
 291   
 292  1 String xmlDocument = buffer.toString();
 293  1 assertXPathCount(xmlDocument, "classfile/is-interface", 0);
 294    }
 295   
 296  1 public void testInterfaceClassfile() throws Exception {
 297  1 final Classfile mockClassfile = mock(Classfile.class);
 298   
 299  1 checking(new Expectations() {{
 300  1 one (mockClassfile).isInterface(); will(returnValue(true));
 301  1 ignoring (mockClassfile);
 302    }});
 303   
 304  1 printer.visitClassfile(mockClassfile);
 305   
 306  1 String xmlDocument = buffer.toString();
 307  1 assertXPathCount(xmlDocument, "classfile/is-interface", 1);
 308    }
 309   
 310  1 public void testNonAbstractClassfile() throws Exception {
 311  1 final Classfile mockClassfile = mock(Classfile.class);
 312   
 313  1 checking(new Expectations() {{
 314  1 one (mockClassfile).isAbstract(); will(returnValue(false));
 315  1 ignoring (mockClassfile);
 316    }});
 317   
 318  1 printer.visitClassfile(mockClassfile);
 319   
 320  1 String xmlDocument = buffer.toString();
 321  1 assertXPathCount(xmlDocument, "classfile/abstract", 0);
 322    }
 323   
 324  1 public void testAbstractClassfile() throws Exception {
 325  1 final Classfile mockClassfile = mock(Classfile.class);
 326   
 327  1 checking(new Expectations() {{
 328  1 one (mockClassfile).isAbstract(); will(returnValue(true));
 329  1 ignoring (mockClassfile);
 330    }});
 331   
 332  1 printer.visitClassfile(mockClassfile);
 333   
 334  1 String xmlDocument = buffer.toString();
 335  1 assertXPathCount(xmlDocument, "classfile/abstract", 1);
 336    }
 337   
 338  1 public void testNonSyntheticClassfile() throws Exception {
 339  1 final Classfile mockClassfile = mock(Classfile.class);
 340   
 341  1 checking(new Expectations() {{
 342  1 one (mockClassfile).isSynthetic(); will(returnValue(false));
 343  1 ignoring (mockClassfile);
 344    }});
 345   
 346  1 printer.visitClassfile(mockClassfile);
 347   
 348  1 String xmlDocument = buffer.toString();
 349  1 assertXPathCount(xmlDocument, "classfile/synthetic", 0);
 350    }
 351   
 352  1 public void testSyntheticClassfile() throws Exception {
 353  1 final Classfile mockClassfile = mock(Classfile.class);
 354   
 355  1 checking(new Expectations() {{
 356  1 one (mockClassfile).isSynthetic(); will(returnValue(true));
 357  1 ignoring (mockClassfile);
 358    }});
 359   
 360  1 printer.visitClassfile(mockClassfile);
 361   
 362  1 String xmlDocument = buffer.toString();
 363  1 assertXPathCount(xmlDocument, "classfile/synthetic", 1);
 364    }
 365   
 366  1 public void testNonAnnotationClassfile() throws Exception {
 367  1 final Classfile mockClassfile = mock(Classfile.class);
 368   
 369  1 checking(new Expectations() {{
 370  1 one (mockClassfile).isAnnotation(); will(returnValue(false));
 371  1 ignoring (mockClassfile);
 372    }});
 373   
 374  1 printer.visitClassfile(mockClassfile);
 375   
 376  1 String xmlDocument = buffer.toString();
 377  1 assertXPathCount(xmlDocument, "classfile/is-annotation", 0);
 378    }
 379   
 380  1 public void testAnnotationClassfile() throws Exception {
 381  1 final Classfile mockClassfile = mock(Classfile.class);
 382   
 383  1 checking(new Expectations() {{
 384  1 one (mockClassfile).isAnnotation(); will(returnValue(true));
 385  1 ignoring (mockClassfile);
 386    }});
 387   
 388  1 printer.visitClassfile(mockClassfile);
 389   
 390  1 String xmlDocument = buffer.toString();
 391  1 assertXPathCount(xmlDocument, "classfile/is-annotation", 1);
 392    }
 393   
 394  1 public void testNonEnumClassfile() throws Exception {
 395  1 final Classfile mockClassfile = mock(Classfile.class);
 396   
 397  1 checking(new Expectations() {{
 398  1 one (mockClassfile).isEnum(); will(returnValue(false));
 399  1 ignoring (mockClassfile);
 400    }});
 401   
 402  1 printer.visitClassfile(mockClassfile);
 403   
 404  1 String xmlDocument = buffer.toString();
 405  1 assertXPathCount(xmlDocument, "classfile/enum", 0);
 406    }
 407   
 408  1 public void testEnumClassfile() throws Exception {
 409  1 final Classfile mockClassfile = mock(Classfile.class);
 410   
 411  1 checking(new Expectations() {{
 412  1 one (mockClassfile).isEnum(); will(returnValue(true));
 413  1 ignoring (mockClassfile);
 414    }});
 415   
 416  1 printer.visitClassfile(mockClassfile);
 417   
 418  1 String xmlDocument = buffer.toString();
 419  1 assertXPathCount(xmlDocument, "classfile/enum", 1);
 420    }
 421   
 422  1 public void testNonPublicField() throws Exception {
 423  1 final Field_info mockField = mock(Field_info.class);
 424   
 425  1 checking(new Expectations() {{
 426  1 one (mockField).isPublic(); will(returnValue(false));
 427  1 ignoring (mockField);
 428    }});
 429   
 430  1 printer.visitField_info(mockField);
 431   
 432  1 String xmlDocument = buffer.toString();
 433  1 assertXPathCount(xmlDocument, "field-info/public", 0);
 434    }
 435   
 436  1 public void testPublicField() throws Exception {
 437  1 final Field_info mockField = mock(Field_info.class);
 438   
 439  1 checking(new Expectations() {{
 440  1 one (mockField).isPublic(); will(returnValue(true));
 441  1 ignoring (mockField);
 442    }});
 443   
 444  1 printer.visitField_info(mockField);
 445   
 446  1 String xmlDocument = buffer.toString();
 447  1 assertXPathCount(xmlDocument, "field-info/public", 1);
 448    }
 449   
 450  1 public void testNonProtectedField() throws Exception {
 451  1 final Field_info mockField = mock(Field_info.class);
 452   
 453  1 checking(new Expectations() {{
 454  1 one (mockField).isProtected(); will(returnValue(false));
 455  1 ignoring (mockField);
 456    }});
 457   
 458  1 printer.visitField_info(mockField);
 459   
 460  1 String xmlDocument = buffer.toString();
 461  1 assertXPathCount(xmlDocument, "field-info/protected", 0);
 462    }
 463   
 464  1 public void testProtectedField() throws Exception {
 465  1 final Field_info mockField = mock(Field_info.class);
 466   
 467  1 checking(new Expectations() {{
 468  1 one (mockField).isProtected(); will(returnValue(true));
 469  1 ignoring (mockField);
 470    }});
 471   
 472  1 printer.visitField_info(mockField);
 473   
 474  1 String xmlDocument = buffer.toString();
 475  1 assertXPathCount(xmlDocument, "field-info/protected", 1);
 476    }
 477   
 478  1 public void testNonPrivateField() throws Exception {
 479  1 final Field_info mockField = mock(Field_info.class);
 480   
 481  1 checking(new Expectations() {{
 482  1 one (mockField).isPrivate(); will(returnValue(false));
 483  1 ignoring (mockField);
 484    }});
 485   
 486  1 printer.visitField_info(mockField);
 487   
 488  1 String xmlDocument = buffer.toString();
 489  1 assertXPathCount(xmlDocument, "field-info/private", 0);
 490    }
 491   
 492  1 public void testPrivateField() throws Exception {
 493  1 final Field_info mockField = mock(Field_info.class);
 494   
 495  1 checking(new Expectations() {{
 496  1 one (mockField).isPrivate(); will(returnValue(true));
 497  1 ignoring (mockField);
 498    }});
 499   
 500  1 printer.visitField_info(mockField);
 501   
 502  1 String xmlDocument = buffer.toString();
 503  1 assertXPathCount(xmlDocument, "field-info/private", 1);
 504    }
 505   
 506  1 public void testNonStaticField() throws Exception {
 507  1 final Field_info mockField = mock(Field_info.class);
 508   
 509  1 checking(new Expectations() {{
 510  1 one (mockField).isStatic(); will(returnValue(false));
 511  1 ignoring (mockField);
 512    }});
 513   
 514  1 printer.visitField_info(mockField);
 515   
 516  1 String xmlDocument = buffer.toString();
 517  1 assertXPathCount(xmlDocument, "field-info/static", 0);
 518    }
 519   
 520  1 public void testStaticField() throws Exception {
 521  1 final Field_info mockField = mock(Field_info.class);
 522   
 523  1 checking(new Expectations() {{
 524  1 one (mockField).isStatic(); will(returnValue(true));
 525  1 ignoring (mockField);
 526    }});
 527   
 528  1 printer.visitField_info(mockField);
 529   
 530  1 String xmlDocument = buffer.toString();
 531  1 assertXPathCount(xmlDocument, "field-info/static", 1);
 532    }
 533   
 534  1 public void testNonFinalField() throws Exception {
 535  1 final Field_info mockField = mock(Field_info.class);
 536   
 537  1 checking(new Expectations() {{
 538  1 one (mockField).isFinal(); will(returnValue(false));
 539  1 ignoring (mockField);
 540    }});
 541   
 542  1 printer.visitField_info(mockField);
 543   
 544  1 String xmlDocument = buffer.toString();
 545  1 assertXPathCount(xmlDocument, "field-info/final", 0);
 546    }
 547   
 548  1 public void testFinalField() throws Exception {
 549  1 final Field_info mockField = mock(Field_info.class);
 550   
 551  1 checking(new Expectations() {{
 552  1 one (mockField).isFinal(); will(returnValue(true));
 553  1 ignoring (mockField);
 554    }});
 555   
 556  1 printer.visitField_info(mockField);
 557   
 558  1 String xmlDocument = buffer.toString();
 559  1 assertXPathCount(xmlDocument, "field-info/final", 1);
 560    }
 561   
 562  1 public void testNonVolatileField() throws Exception {
 563  1 final Field_info mockField = mock(Field_info.class);
 564   
 565  1 checking(new Expectations() {{
 566  1 one (mockField).isVolatile(); will(returnValue(false));
 567  1 ignoring (mockField);
 568    }});
 569   
 570  1 printer.visitField_info(mockField);
 571   
 572  1 String xmlDocument = buffer.toString();
 573  1 assertXPathCount(xmlDocument, "field-info/volatile", 0);
 574    }
 575   
 576  1 public void testVolatileField() throws Exception {
 577  1 final Field_info mockField = mock(Field_info.class);
 578   
 579  1 checking(new Expectations() {{
 580  1 one (mockField).isVolatile(); will(returnValue(true));
 581  1 ignoring (mockField);
 582    }});
 583   
 584  1 printer.visitField_info(mockField);
 585   
 586  1 String xmlDocument = buffer.toString();
 587  1 assertXPathCount(xmlDocument, "field-info/volatile", 1);
 588    }
 589   
 590  1 public void testNonTransientField() throws Exception {
 591  1 final Field_info mockField = mock(Field_info.class);
 592   
 593  1 checking(new Expectations() {{
 594  1 one (mockField).isTransient(); will(returnValue(false));
 595  1 ignoring (mockField);
 596    }});
 597   
 598  1 printer.visitField_info(mockField);
 599   
 600  1 String xmlDocument = buffer.toString();
 601  1 assertXPathCount(xmlDocument, "field-info/transient", 0);
 602    }
 603   
 604  1 public void testTransientField() throws Exception {
 605  1 final Field_info mockField = mock(Field_info.class);
 606   
 607  1 checking(new Expectations() {{
 608  1 one (mockField).isTransient(); will(returnValue(true));
 609  1 ignoring (mockField);
 610    }});
 611   
 612  1 printer.visitField_info(mockField);
 613   
 614  1 String xmlDocument = buffer.toString();
 615  1 assertXPathCount(xmlDocument, "field-info/transient", 1);
 616    }
 617   
 618  1 public void testNonSyntheticField() throws Exception {
 619  1 final Field_info mockField = mock(Field_info.class);
 620   
 621  1 checking(new Expectations() {{
 622  1 one (mockField).isSynthetic(); will(returnValue(false));
 623  1 ignoring (mockField);
 624    }});
 625   
 626  1 printer.visitField_info(mockField);
 627   
 628  1 String xmlDocument = buffer.toString();
 629  1 assertXPathCount(xmlDocument, "field-info/synthetic", 0);
 630    }
 631   
 632  1 public void testSyntheticField() throws Exception {
 633  1 final Field_info mockField = mock(Field_info.class);
 634   
 635  1 checking(new Expectations() {{
 636  1 one (mockField).isSynthetic(); will(returnValue(true));
 637  1 ignoring (mockField);
 638    }});
 639   
 640  1 printer.visitField_info(mockField);
 641   
 642  1 String xmlDocument = buffer.toString();
 643  1 assertXPathCount(xmlDocument, "field-info/synthetic", 1);
 644    }
 645   
 646  1 public void testNonEnumField() throws Exception {
 647  1 final Field_info mockField = mock(Field_info.class);
 648   
 649  1 checking(new Expectations() {{
 650  1 one (mockField).isEnum(); will(returnValue(false));
 651  1 ignoring (mockField);
 652    }});
 653   
 654  1 printer.visitField_info(mockField);
 655   
 656  1 String xmlDocument = buffer.toString();
 657  1 assertXPathCount(xmlDocument, "field-info/enum", 0);
 658    }
 659   
 660  1 public void testEnumField() throws Exception {
 661  1 final Field_info mockField = mock(Field_info.class);
 662   
 663  1 checking(new Expectations() {{
 664  1 one (mockField).isEnum(); will(returnValue(true));
 665  1 ignoring (mockField);
 666    }});
 667   
 668  1 printer.visitField_info(mockField);
 669   
 670  1 String xmlDocument = buffer.toString();
 671  1 assertXPathCount(xmlDocument, "field-info/enum", 1);
 672    }
 673   
 674  1 public void testNonPublicMethod() throws Exception {
 675  1 final Method_info mockMethod = mock(Method_info.class);
 676   
 677  1 checking(new Expectations() {{
 678  1 one (mockMethod).isPublic(); will(returnValue(false));
 679  1 ignoring (mockMethod);
 680    }});
 681   
 682  1 printer.visitMethod_info(mockMethod);
 683   
 684  1 String xmlDocument = buffer.toString();
 685  1 assertXPathCount(xmlDocument, "method-info/public", 0);
 686    }
 687   
 688  1 public void testPublicMethod() throws Exception {
 689  1 final Method_info mockMethod = mock(Method_info.class);
 690   
 691  1 checking(new Expectations() {{
 692  1 one (mockMethod).isPublic(); will(returnValue(true));
 693  1 ignoring (mockMethod);
 694    }});
 695   
 696  1 printer.visitMethod_info(mockMethod);
 697   
 698  1 String xmlDocument = buffer.toString();
 699  1 assertXPathCount(xmlDocument, "method-info/public", 1);
 700    }
 701   
 702  1 public void testNonPrivateMethod() throws Exception {
 703  1 final Method_info mockMethod = mock(Method_info.class);
 704   
 705  1 checking(new Expectations() {{
 706  1 one (mockMethod).isPrivate(); will(returnValue(false));
 707  1 ignoring (mockMethod);
 708    }});
 709   
 710  1 printer.visitMethod_info(mockMethod);
 711   
 712  1 String xmlDocument = buffer.toString();
 713  1 assertXPathCount(xmlDocument, "method-info/private", 0);
 714    }
 715   
 716  1 public void testPrivateMethod() throws Exception {
 717  1 final Method_info mockMethod = mock(Method_info.class);
 718   
 719  1 checking(new Expectations() {{
 720  1 one (mockMethod).isPrivate(); will(returnValue(true));
 721  1 ignoring (mockMethod);
 722    }});
 723   
 724  1 printer.visitMethod_info(mockMethod);
 725   
 726  1 String xmlDocument = buffer.toString();
 727  1 assertXPathCount(xmlDocument, "method-info/private", 1);
 728    }
 729   
 730  1 public void testNonProtectedMethod() throws Exception {
 731  1 final Method_info mockMethod = mock(Method_info.class);
 732   
 733  1 checking(new Expectations() {{
 734  1 one (mockMethod).isProtected(); will(returnValue(false));
 735  1 ignoring (mockMethod);
 736    }});
 737   
 738  1 printer.visitMethod_info(mockMethod);
 739   
 740  1 String xmlDocument = buffer.toString();
 741  1 assertXPathCount(xmlDocument, "method-info/protected", 0);
 742    }
 743   
 744  1 public void testProtectedMethod() throws Exception {
 745  1 final Method_info mockMethod = mock(Method_info.class);
 746   
 747  1 checking(new Expectations() {{
 748  1 one (mockMethod).isProtected(); will(returnValue(true));
 749  1 ignoring (mockMethod);
 750    }});
 751   
 752  1 printer.visitMethod_info(mockMethod);
 753   
 754  1 String xmlDocument = buffer.toString();
 755  1 assertXPathCount(xmlDocument, "method-info/protected", 1);
 756    }
 757   
 758  1 public void testNonStaticMethod() throws Exception {
 759  1 final Method_info mockMethod = mock(Method_info.class);
 760   
 761  1 checking(new Expectations() {{
 762  1 one (mockMethod).isStatic(); will(returnValue(false));
 763  1 ignoring (mockMethod);
 764    }});
 765   
 766  1 printer.visitMethod_info(mockMethod);
 767   
 768  1 String xmlDocument = buffer.toString();
 769  1 assertXPathCount(xmlDocument, "method-info/static", 0);
 770    }
 771   
 772  1 public void testStaticMethod() throws Exception {
 773  1 final Method_info mockMethod = mock(Method_info.class);
 774   
 775  1 checking(new Expectations() {{
 776  1 one (mockMethod).isStatic(); will(returnValue(true));
 777  1 ignoring (mockMethod);
 778    }});
 779   
 780  1 printer.visitMethod_info(mockMethod);
 781   
 782  1 String xmlDocument = buffer.toString();
 783  1 assertXPathCount(xmlDocument, "method-info/static", 1);
 784    }
 785   
 786  1 public void testNonFinalMethod() throws Exception {
 787  1 final Method_info mockMethod = mock(Method_info.class);
 788   
 789  1 checking(new Expectations() {{
 790  1 one (mockMethod).isFinal(); will(returnValue(false));
 791  1 ignoring (mockMethod);
 792    }});
 793   
 794  1 printer.visitMethod_info(mockMethod);
 795   
 796  1 String xmlDocument = buffer.toString();
 797  1 assertXPathCount(xmlDocument, "method-info/final", 0);
 798    }
 799   
 800  1 public void testFinalMethod() throws Exception {
 801  1 final Method_info mockMethod = mock(Method_info.class);
 802   
 803  1 checking(new Expectations() {{
 804  1 one (mockMethod).isFinal(); will(returnValue(true));
 805  1 ignoring (mockMethod);
 806    }});
 807   
 808  1 printer.visitMethod_info(mockMethod);
 809   
 810  1 String xmlDocument = buffer.toString();
 811  1 assertXPathCount(xmlDocument, "method-info/final", 1);
 812    }
 813   
 814  1 public void testNonSynchronizedMethod() throws Exception {
 815  1 final Method_info mockMethod = mock(Method_info.class);
 816   
 817  1 checking(new Expectations() {{
 818  1 one (mockMethod).isSynchronized(); will(returnValue(false));
 819  1 ignoring (mockMethod);
 820    }});
 821   
 822  1 printer.visitMethod_info(mockMethod);
 823   
 824  1 String xmlDocument = buffer.toString();
 825  1 assertXPathCount(xmlDocument, "method-info/synchronized", 0);
 826    }
 827   
 828  1 public void testSynchronizedMethod() throws Exception {
 829  1 final Method_info mockMethod = mock(Method_info.class);
 830   
 831  1 checking(new Expectations() {{
 832  1 one (mockMethod).isSynchronized(); will(returnValue(true));
 833  1 ignoring (mockMethod);
 834    }});
 835   
 836  1 printer.visitMethod_info(mockMethod);
 837   
 838  1 String xmlDocument = buffer.toString();
 839  1 assertXPathCount(xmlDocument, "method-info/synchronized", 1);
 840    }
 841   
 842  1 public void testNonBridgeMethod() throws Exception {
 843  1 final Method_info mockMethod = mock(Method_info.class);
 844   
 845  1 checking(new Expectations() {{
 846  1 one (mockMethod).isBridge(); will(returnValue(false));
 847  1 ignoring (mockMethod);
 848    }});
 849   
 850  1 printer.visitMethod_info(mockMethod);
 851   
 852  1 String xmlDocument = buffer.toString();
 853  1 assertXPathCount(xmlDocument, "method-info/bridge", 0);
 854    }
 855   
 856  1 public void testBridgeMethod() throws Exception {
 857  1 final Method_info mockMethod = mock(Method_info.class);
 858   
 859  1 checking(new Expectations() {{
 860  1 one (mockMethod).isBridge(); will(returnValue(true));
 861  1 ignoring (mockMethod);
 862    }});
 863   
 864  1 printer.visitMethod_info(mockMethod);
 865   
 866  1 String xmlDocument = buffer.toString();
 867  1 assertXPathCount(xmlDocument, "method-info/bridge", 1);
 868    }
 869   
 870  1 public void testNonVarargsMethod() throws Exception {
 871  1 final Method_info mockMethod = mock(Method_info.class);
 872   
 873  1 checking(new Expectations() {{
 874  1 one (mockMethod).isVarargs(); will(returnValue(false));
 875  1 ignoring (mockMethod);
 876    }});
 877   
 878  1 printer.visitMethod_info(mockMethod);
 879   
 880  1 String xmlDocument = buffer.toString();
 881  1 assertXPathCount(xmlDocument, "method-info/varargs", 0);
 882    }
 883   
 884  1 public void testVarargsMethod() throws Exception {
 885  1 final Method_info mockMethod = mock(Method_info.class);
 886   
 887  1 checking(new Expectations() {{
 888  1 one (mockMethod).isVarargs(); will(returnValue(true));
 889  1 ignoring (mockMethod);
 890    }});
 891   
 892  1 printer.visitMethod_info(mockMethod);
 893   
 894  1 String xmlDocument = buffer.toString();
 895  1 assertXPathCount(xmlDocument, "method-info/varargs", 1);
 896    }
 897   
 898  1 public void testNonNativeMethod() throws Exception {
 899  1 final Method_info mockMethod = mock(Method_info.class);
 900   
 901  1 checking(new Expectations() {{
 902  1 one (mockMethod).isNative(); will(returnValue(false));
 903  1 ignoring (mockMethod);
 904    }});
 905   
 906  1 printer.visitMethod_info(mockMethod);
 907   
 908  1 String xmlDocument = buffer.toString();
 909  1 assertXPathCount(xmlDocument, "method-info/native", 0);
 910    }
 911   
 912  1 public void testNativeMethod() throws Exception {
 913  1 final Method_info mockMethod = mock(Method_info.class);
 914   
 915  1 checking(new Expectations() {{
 916  1 one (mockMethod).isNative(); will(returnValue(true));
 917  1 ignoring (mockMethod);
 918    }});
 919   
 920  1 printer.visitMethod_info(mockMethod);
 921   
 922  1 String xmlDocument = buffer.toString();
 923  1 assertXPathCount(xmlDocument, "method-info/native", 1);
 924    }
 925   
 926  1 public void testNonAbstractMethod() throws Exception {
 927  1 final Method_info mockMethod = mock(Method_info.class);
 928   
 929  1 checking(new Expectations() {{
 930  1 one (mockMethod).isAbstract(); will(returnValue(false));
 931  1 ignoring (mockMethod);
 932    }});
 933   
 934  1 printer.visitMethod_info(mockMethod);
 935   
 936  1 String xmlDocument = buffer.toString();
 937  1 assertXPathCount(xmlDocument, "method-info/abstract", 0);
 938    }
 939   
 940  1 public void testAbstractMethod() throws Exception {
 941  1 final Method_info mockMethod = mock(Method_info.class);
 942   
 943  1 checking(new Expectations() {{
 944  1 one (mockMethod).isAbstract(); will(returnValue(true));
 945  1 ignoring (mockMethod);
 946    }});
 947   
 948  1 printer.visitMethod_info(mockMethod);
 949   
 950  1 String xmlDocument = buffer.toString();
 951  1 assertXPathCount(xmlDocument, "method-info/abstract", 1);
 952    }
 953   
 954  1 public void testNonStrictMethod() throws Exception {
 955  1 final Method_info mockMethod = mock(Method_info.class);
 956   
 957  1 checking(new Expectations() {{
 958  1 one (mockMethod).isStrict(); will(returnValue(false));
 959  1 ignoring (mockMethod);
 960    }});
 961   
 962  1 printer.visitMethod_info(mockMethod);
 963   
 964  1 String xmlDocument = buffer.toString();
 965  1 assertXPathCount(xmlDocument, "method-info/strict", 0);
 966    }
 967   
 968  1 public void testStrictMethod() throws Exception {
 969  1 final Method_info mockMethod = mock(Method_info.class);
 970   
 971  1 checking(new Expectations() {{
 972  1 one (mockMethod).isStrict(); will(returnValue(true));
 973  1 ignoring (mockMethod);
 974    }});
 975   
 976  1 printer.visitMethod_info(mockMethod);
 977   
 978  1 String xmlDocument = buffer.toString();
 979  1 assertXPathCount(xmlDocument, "method-info/strict", 1);
 980    }
 981   
 982  1 public void testNonSyntheticMethod() throws Exception {
 983  1 final Method_info mockMethod = mock(Method_info.class);
 984   
 985  1 checking(new Expectations() {{
 986  1 one (mockMethod).isSynthetic(); will(returnValue(false));
 987  1 ignoring (mockMethod);
 988    }});
 989   
 990  1 printer.visitMethod_info(mockMethod);
 991   
 992  1 String xmlDocument = buffer.toString();
 993  1 assertXPathCount(xmlDocument, "method-info/synthetic", 0);
 994    }
 995   
 996  1 public void testSyntheticMethod() throws Exception {
 997  1 final Method_info mockMethod = mock(Method_info.class);
 998   
 999  1 checking(new Expectations() {{
 1000  1 one (mockMethod).isSynthetic(); will(returnValue(true));
 1001  1 ignoring (mockMethod);
 1002    }});
 1003   
 1004  1 printer.visitMethod_info(mockMethod);
 1005   
 1006  1 String xmlDocument = buffer.toString();
 1007  1 assertXPathCount(xmlDocument, "method-info/synthetic", 1);
 1008    }
 1009   
 1010  1 public void testNonPublicInnerClass() throws Exception {
 1011  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1012   
 1013  1 checking(new Expectations() {{
 1014  1 one (mockInnerClass).isPublic(); will(returnValue(false));
 1015  1 ignoring (mockInnerClass);
 1016    }});
 1017   
 1018  1 printer.visitInnerClass(mockInnerClass);
 1019   
 1020  1 String xmlDocument = buffer.toString();
 1021  1 assertXPathCount(xmlDocument, "inner-class/public", 0);
 1022    }
 1023   
 1024  1 public void testPublicInnerClass() throws Exception {
 1025  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1026   
 1027  1 checking(new Expectations() {{
 1028  1 one (mockInnerClass).isPublic(); will(returnValue(true));
 1029  1 ignoring (mockInnerClass);
 1030    }});
 1031   
 1032  1 printer.visitInnerClass(mockInnerClass);
 1033   
 1034  1 String xmlDocument = buffer.toString();
 1035  1 assertXPathCount(xmlDocument, "inner-class/public", 1);
 1036    }
 1037   
 1038  1 public void testNonPrivateInnerClass() throws Exception {
 1039  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1040   
 1041  1 checking(new Expectations() {{
 1042  1 one (mockInnerClass).isPrivate(); will(returnValue(false));
 1043  1 ignoring (mockInnerClass);
 1044    }});
 1045   
 1046  1 printer.visitInnerClass(mockInnerClass);
 1047   
 1048  1 String xmlDocument = buffer.toString();
 1049  1 assertXPathCount(xmlDocument, "inner-class/private", 0);
 1050    }
 1051   
 1052  1 public void testPrivateInnerClass() throws Exception {
 1053  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1054   
 1055  1 checking(new Expectations() {{
 1056  1 one (mockInnerClass).isPrivate(); will(returnValue(true));
 1057  1 ignoring (mockInnerClass);
 1058    }});
 1059   
 1060  1 printer.visitInnerClass(mockInnerClass);
 1061   
 1062  1 String xmlDocument = buffer.toString();
 1063  1 assertXPathCount(xmlDocument, "inner-class/private", 1);
 1064    }
 1065   
 1066  1 public void testNonProtectedInnerClass() throws Exception {
 1067  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1068   
 1069  1 checking(new Expectations() {{
 1070  1 one (mockInnerClass).isProtected(); will(returnValue(false));
 1071  1 ignoring (mockInnerClass);
 1072    }});
 1073   
 1074  1 printer.visitInnerClass(mockInnerClass);
 1075   
 1076  1 String xmlDocument = buffer.toString();
 1077  1 assertXPathCount(xmlDocument, "inner-class/protected", 0);
 1078    }
 1079   
 1080  1 public void testProtectedInnerClass() throws Exception {
 1081  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1082   
 1083  1 checking(new Expectations() {{
 1084  1 one (mockInnerClass).isProtected(); will(returnValue(true));
 1085  1 ignoring (mockInnerClass);
 1086    }});
 1087   
 1088  1 printer.visitInnerClass(mockInnerClass);
 1089   
 1090  1 String xmlDocument = buffer.toString();
 1091  1 assertXPathCount(xmlDocument, "inner-class/protected", 1);
 1092    }
 1093   
 1094  1 public void testNonStaticInnerClass() throws Exception {
 1095  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1096   
 1097  1 checking(new Expectations() {{
 1098  1 one (mockInnerClass).isStatic(); will(returnValue(false));
 1099  1 ignoring (mockInnerClass);
 1100    }});
 1101   
 1102  1 printer.visitInnerClass(mockInnerClass);
 1103   
 1104  1 String xmlDocument = buffer.toString();
 1105  1 assertXPathCount(xmlDocument, "inner-class/static", 0);
 1106    }
 1107   
 1108  1 public void testStaticInnerClass() throws Exception {
 1109  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1110   
 1111  1 checking(new Expectations() {{
 1112  1 one (mockInnerClass).isStatic(); will(returnValue(true));
 1113  1 ignoring (mockInnerClass);
 1114    }});
 1115   
 1116  1 printer.visitInnerClass(mockInnerClass);
 1117   
 1118  1 String xmlDocument = buffer.toString();
 1119  1 assertXPathCount(xmlDocument, "inner-class/static", 1);
 1120    }
 1121   
 1122  1 public void testNonFinalInnerClass() throws Exception {
 1123  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1124   
 1125  1 checking(new Expectations() {{
 1126  1 one (mockInnerClass).isFinal(); will(returnValue(false));
 1127  1 ignoring (mockInnerClass);
 1128    }});
 1129   
 1130  1 printer.visitInnerClass(mockInnerClass);
 1131   
 1132  1 String xmlDocument = buffer.toString();
 1133  1 assertXPathCount(xmlDocument, "inner-class/final", 0);
 1134    }
 1135   
 1136  1 public void testFinalInnerClass() throws Exception {
 1137  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1138   
 1139  1 checking(new Expectations() {{
 1140  1 one (mockInnerClass).isFinal(); will(returnValue(true));
 1141  1 ignoring (mockInnerClass);
 1142    }});
 1143   
 1144  1 printer.visitInnerClass(mockInnerClass);
 1145   
 1146  1 String xmlDocument = buffer.toString();
 1147  1 assertXPathCount(xmlDocument, "inner-class/final", 1);
 1148    }
 1149   
 1150  1 public void testNonInterfaceInnerClass() throws Exception {
 1151  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1152   
 1153  1 checking(new Expectations() {{
 1154  1 one (mockInnerClass).isInterface(); will(returnValue(false));
 1155  1 ignoring (mockInnerClass);
 1156    }});
 1157   
 1158  1 printer.visitInnerClass(mockInnerClass);
 1159   
 1160  1 String xmlDocument = buffer.toString();
 1161  1 assertXPathCount(xmlDocument, "inner-class/is-interface", 0);
 1162    }
 1163   
 1164  1 public void testInterfaceInnerClass() throws Exception {
 1165  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1166   
 1167  1 checking(new Expectations() {{
 1168  1 one (mockInnerClass).isInterface(); will(returnValue(true));
 1169  1 ignoring (mockInnerClass);
 1170    }});
 1171   
 1172  1 printer.visitInnerClass(mockInnerClass);
 1173   
 1174  1 String xmlDocument = buffer.toString();
 1175  1 assertXPathCount(xmlDocument, "inner-class/is-interface", 1);
 1176    }
 1177   
 1178  1 public void testNonAbstractInnerClass() throws Exception {
 1179  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1180   
 1181  1 checking(new Expectations() {{
 1182  1 one (mockInnerClass).isAbstract(); will(returnValue(false));
 1183  1 ignoring (mockInnerClass);
 1184    }});
 1185   
 1186  1 printer.visitInnerClass(mockInnerClass);
 1187   
 1188  1 String xmlDocument = buffer.toString();
 1189  1 assertXPathCount(xmlDocument, "inner-class/abstract", 0);
 1190    }
 1191   
 1192  1 public void testAbstractInnerClass() throws Exception {
 1193  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1194   
 1195  1 checking(new Expectations() {{
 1196  1 one (mockInnerClass).isAbstract(); will(returnValue(true));
 1197  1 ignoring (mockInnerClass);
 1198    }});
 1199   
 1200  1 printer.visitInnerClass(mockInnerClass);
 1201   
 1202  1 String xmlDocument = buffer.toString();
 1203  1 assertXPathCount(xmlDocument, "inner-class/abstract", 1);
 1204    }
 1205   
 1206  1 public void testNonSyntheticInnerClass() throws Exception {
 1207  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1208   
 1209  1 checking(new Expectations() {{
 1210  1 one (mockInnerClass).isSynthetic(); will(returnValue(false));
 1211  1 ignoring (mockInnerClass);
 1212    }});
 1213   
 1214  1 printer.visitInnerClass(mockInnerClass);
 1215   
 1216  1 String xmlDocument = buffer.toString();
 1217  1 assertXPathCount(xmlDocument, "inner-class/synthetic", 0);
 1218    }
 1219   
 1220  1 public void testSyntheticInnerClass() throws Exception {
 1221  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1222   
 1223  1 checking(new Expectations() {{
 1224  1 one (mockInnerClass).isSynthetic(); will(returnValue(true));
 1225  1 ignoring (mockInnerClass);
 1226    }});
 1227   
 1228  1 printer.visitInnerClass(mockInnerClass);
 1229   
 1230  1 String xmlDocument = buffer.toString();
 1231  1 assertXPathCount(xmlDocument, "inner-class/synthetic", 1);
 1232    }
 1233   
 1234  1 public void testNonAnnotationInnerClass() throws Exception {
 1235  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1236   
 1237  1 checking(new Expectations() {{
 1238  1 one (mockInnerClass).isAnnotation(); will(returnValue(false));
 1239  1 ignoring (mockInnerClass);
 1240    }});
 1241   
 1242  1 printer.visitInnerClass(mockInnerClass);
 1243   
 1244  1 String xmlDocument = buffer.toString();
 1245  1 assertXPathCount(xmlDocument, "inner-class/is-annotation", 0);
 1246    }
 1247   
 1248  1 public void testAnnotationInnerClass() throws Exception {
 1249  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1250   
 1251  1 checking(new Expectations() {{
 1252  1 one (mockInnerClass).isAnnotation(); will(returnValue(true));
 1253  1 ignoring (mockInnerClass);
 1254    }});
 1255   
 1256  1 printer.visitInnerClass(mockInnerClass);
 1257   
 1258  1 String xmlDocument = buffer.toString();
 1259  1 assertXPathCount(xmlDocument, "inner-class/is-annotation", 1);
 1260    }
 1261   
 1262  1 public void testNonEnumInnerClass() throws Exception {
 1263  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1264   
 1265  1 checking(new Expectations() {{
 1266  1 one (mockInnerClass).isEnum(); will(returnValue(false));
 1267  1 ignoring (mockInnerClass);
 1268    }});
 1269   
 1270  1 printer.visitInnerClass(mockInnerClass);
 1271   
 1272  1 String xmlDocument = buffer.toString();
 1273  1 assertXPathCount(xmlDocument, "inner-class/enum", 0);
 1274    }
 1275   
 1276  1 public void testEnumInnerClass() throws Exception {
 1277  1 final InnerClass mockInnerClass = mock(InnerClass.class);
 1278   
 1279  1 checking(new Expectations() {{
 1280  1 one (mockInnerClass).isEnum(); will(returnValue(true));
 1281  1 ignoring (mockInnerClass);
 1282    }});
 1283   
 1284  1 printer.visitInnerClass(mockInnerClass);
 1285   
 1286  1 String xmlDocument = buffer.toString();
 1287  1 assertXPathCount(xmlDocument, "inner-class/enum", 1);
 1288    }
 1289   
 1290  1 public void testVisitLocalVariable() throws Exception {
 1291  1 final LocalVariable localVariable = mock(LocalVariable.class);
 1292   
 1293  1 checking(new Expectations() {{
 1294  1 one (localVariable).getStartPC();
 1295  1 one (localVariable).getLength();
 1296  1 one (localVariable).getRawName();
 1297  1 one (localVariable).getDescriptor();
 1298  1 will(returnValue("I"));
 1299  1 one (localVariable).getIndex();
 1300    }});
 1301   
 1302  1 printer.visitLocalVariable(localVariable);
 1303   
 1304  1 String xmlDocument = buffer.toString();
 1305  1 assertXPathCount(xmlDocument, "local-variable/@pc", 1);
 1306  1 assertXPathCount(xmlDocument, "local-variable/@length", 1);
 1307  1 assertXPathCount(xmlDocument, "local-variable/name", 1);
 1308  1 assertXPathText(xmlDocument, "local-variable/type", "int");
 1309  1 assertXPathCount(xmlDocument, "local-variable/@index", 1);
 1310    }
 1311   
 1312  1 public void testVisitLocalVariableType() throws Exception {
 1313  1 final LocalVariableType localVariableType = mock(LocalVariableType.class);
 1314   
 1315  1 checking(new Expectations() {{
 1316  1 one (localVariableType).getStartPC();
 1317  1 one (localVariableType).getLength();
 1318  1 one (localVariableType).getRawName();
 1319  1 one (localVariableType).getRawSignature();
 1320  1 one (localVariableType).getIndex();
 1321    }});
 1322   
 1323  1 printer.visitLocalVariableType(localVariableType);
 1324   
 1325  1 String xmlDocument = buffer.toString();
 1326  1 assertXPathCount(xmlDocument, "local-variable-type/@pc", 1);
 1327  1 assertXPathCount(xmlDocument, "local-variable-type/@length", 1);
 1328  1 assertXPathCount(xmlDocument, "local-variable-type/name", 1);
 1329  1 assertXPathCount(xmlDocument, "local-variable-type/signature", 1);
 1330  1 assertXPathCount(xmlDocument, "local-variable-type/@index", 1);
 1331    }
 1332   
 1333  1 public void testVisitRuntimeVisibleAnnotations_attribute_WithoutAnnotations() throws Exception {
 1334  1 final RuntimeVisibleAnnotations_attribute runtimeVisibleAnnotations = mock(RuntimeVisibleAnnotations_attribute.class);
 1335   
 1336  1 checking(new Expectations() {{
 1337  1 atLeast(1).of (runtimeVisibleAnnotations).getAnnotations();
 1338    }});
 1339   
 1340  1 printer.visitRuntimeVisibleAnnotations_attribute(runtimeVisibleAnnotations);
 1341   
 1342  1 String xmlDocument = buffer.toString();
 1343  1 assertXPathCount(xmlDocument, "runtime-visible-annotations-attribute/annotations", 1);
 1344    }
 1345   
 1346  1 public void testVisitRuntimeVisibleAnnotations_attribute_WithAnAnnotation() throws Exception {
 1347  1 final RuntimeVisibleAnnotations_attribute runtimeVisibleAnnotations = mock(RuntimeVisibleAnnotations_attribute.class);
 1348  1 final Annotation annotation = mock(Annotation.class);
 1349   
 1350  1 checking(new Expectations() {{
 1351  1 atLeast(1).of (runtimeVisibleAnnotations).getAnnotations();
 1352  1 will(returnValue(Collections.singleton(annotation)));
 1353  1 one (annotation).accept(printer);
 1354    }});
 1355   
 1356  1 printer.visitRuntimeVisibleAnnotations_attribute(runtimeVisibleAnnotations);
 1357   
 1358  1 String xmlDocument = buffer.toString();
 1359  1 assertXPathCount(xmlDocument, "runtime-visible-annotations-attribute/annotations", 1);
 1360    }
 1361   
 1362  1 public void testVisitRuntimeInvisibleAnnotations_attribute_WithoutAnnotations() throws Exception {
 1363  1 final RuntimeInvisibleAnnotations_attribute runtimeInvisibleAnnotations = mock(RuntimeInvisibleAnnotations_attribute.class);
 1364   
 1365  1 checking(new Expectations() {{
 1366  1 atLeast(1).of (runtimeInvisibleAnnotations).getAnnotations();
 1367    }});
 1368   
 1369  1 printer.visitRuntimeInvisibleAnnotations_attribute(runtimeInvisibleAnnotations);
 1370   
 1371  1 String xmlDocument = buffer.toString();
 1372  1 assertXPathCount(xmlDocument, "runtime-invisible-annotations-attribute/annotations", 1);
 1373    }
 1374   
 1375  1 public void testVisitRuntimeInvisibleAnnotations_attribute_WithAnAnnotation() throws Exception {
 1376  1 final RuntimeInvisibleAnnotations_attribute runtimeInvisibleAnnotations = mock(RuntimeInvisibleAnnotations_attribute.class);
 1377  1 final Annotation annotation = mock(Annotation.class);
 1378   
 1379  1 checking(new Expectations() {{
 1380  1 atLeast(1).of (runtimeInvisibleAnnotations).getAnnotations();
 1381  1 will(returnValue(Collections.singleton(annotation)));
 1382  1 one (annotation).accept(printer);
 1383    }});
 1384   
 1385  1 printer.visitRuntimeInvisibleAnnotations_attribute(runtimeInvisibleAnnotations);
 1386   
 1387  1 String xmlDocument = buffer.toString();
 1388  1 assertXPathCount(xmlDocument, "runtime-invisible-annotations-attribute/annotations", 1);
 1389    }
 1390   
 1391  1 public void testVisitRuntimeVisibleParameterAnnotations_attribute_WithoutParameterAnnotations() throws Exception {
 1392  1 final RuntimeVisibleParameterAnnotations_attribute runtimeVisibleParameterAnnotations = mock(RuntimeVisibleParameterAnnotations_attribute.class);
 1393   
 1394  1 checking(new Expectations() {{
 1395  1 atLeast(1).of (runtimeVisibleParameterAnnotations).getParameterAnnotations();
 1396    }});
 1397   
 1398  1 printer.visitRuntimeVisibleParameterAnnotations_attribute(runtimeVisibleParameterAnnotations);
 1399   
 1400  1 String xmlDocument = buffer.toString();
 1401  1 assertXPathCount(xmlDocument, "runtime-visible-parameter-annotations-attribute/parameter-annotations", 1);
 1402    }
 1403   
 1404  1 public void testVisitRuntimeVisibleParameterAnnotations_attribute_WithAParameterAnnotation() throws Exception {
 1405  1 final RuntimeVisibleParameterAnnotations_attribute runtimeVisibleParameterAnnotations = mock(RuntimeVisibleParameterAnnotations_attribute.class);
 1406  1 final Parameter parameter = mock(Parameter.class);
 1407   
 1408  1 checking(new Expectations() {{
 1409  1 atLeast(1).of (runtimeVisibleParameterAnnotations).getParameterAnnotations();
 1410  1 will(returnValue(Collections.singletonList(parameter)));
 1411  1 one (parameter).accept(printer);
 1412    }});
 1413   
 1414  1 printer.visitRuntimeVisibleParameterAnnotations_attribute(runtimeVisibleParameterAnnotations);
 1415   
 1416  1 String xmlDocument = buffer.toString();
 1417  1 assertXPathCount(xmlDocument, "runtime-visible-parameter-annotations-attribute/parameter-annotations", 1);
 1418    }
 1419   
 1420  1 public void testVisitRuntimeInvisibleParameterAnnotations_attribute_WithoutParameterAnnotations() throws Exception {
 1421  1 final RuntimeInvisibleParameterAnnotations_attribute runtimeInvisibleParameterAnnotations = mock(RuntimeInvisibleParameterAnnotations_attribute.class);
 1422   
 1423  1 checking(new Expectations() {{
 1424  1 atLeast(1).of (runtimeInvisibleParameterAnnotations).getParameterAnnotations();
 1425    }});
 1426   
 1427  1 printer.visitRuntimeInvisibleParameterAnnotations_attribute(runtimeInvisibleParameterAnnotations);
 1428   
 1429  1 String xmlDocument = buffer.toString();
 1430  1 assertXPathCount(xmlDocument, "runtime-invisible-parameter-annotations-attribute/parameter-annotations", 1);
 1431    }
 1432   
 1433  1 public void testVisitRuntimeInvisibleParameterAnnotations_attribute_WithAParameterAnnotation() throws Exception {
 1434  1 final RuntimeInvisibleParameterAnnotations_attribute runtimeInvisibleParameterAnnotations = mock(RuntimeInvisibleParameterAnnotations_attribute.class);
 1435  1 final Parameter parameter = mock(Parameter.class);
 1436   
 1437  1 checking(new Expectations() {{
 1438  1 atLeast(1).of (runtimeInvisibleParameterAnnotations).getParameterAnnotations();
 1439  1 will(returnValue(Collections.singletonList(parameter)));
 1440  1 one (parameter).accept(printer);
 1441    }});
 1442   
 1443  1 printer.visitRuntimeInvisibleParameterAnnotations_attribute(runtimeInvisibleParameterAnnotations);
 1444   
 1445  1 String xmlDocument = buffer.toString();
 1446  1 assertXPathCount(xmlDocument, "runtime-invisible-parameter-annotations-attribute/parameter-annotations", 1);
 1447    }
 1448   
 1449  1 public void testVisitAnnotationDefault_attribute() throws Exception {
 1450  1 final AnnotationDefault_attribute annotationDefault = mock(AnnotationDefault_attribute.class);
 1451  1 final ElementValue elementValue = mock(ElementValue.class);
 1452   
 1453  1 checking(new Expectations() {{
 1454  1 atLeast(1).of (annotationDefault).getElemementValue();
 1455  1 will(returnValue(elementValue));
 1456  1 one (elementValue).accept(printer);
 1457    }});
 1458   
 1459  1 printer.visitAnnotationDefault_attribute(annotationDefault);
 1460   
 1461  1 String xmlDocument = buffer.toString();
 1462  1 assertXPathCount(xmlDocument, "annotation-default-attribute", 1);
 1463    }
 1464   
 1465  1 public void testVisitParameter_WithoutAnnotations() throws Exception {
 1466  1 final Parameter parameter = mock(Parameter.class);
 1467   
 1468  1 checking(new Expectations() {{
 1469  1 atLeast(1).of (parameter).getAnnotations();
 1470    }});
 1471   
 1472  1 printer.visitParameter(parameter);
 1473   
 1474  1 String xmlDocument = buffer.toString();
 1475  1 assertXPathCount(xmlDocument, "parameter", 1);
 1476  1 assertXPathCount(xmlDocument, "parameter/annotations", 1);
 1477    }
 1478   
 1479  1 public void testVisitParameter_WithAnAnnotation() throws Exception {
 1480  1 final Parameter parameter = mock(Parameter.class);
 1481  1 final Annotation annotation = mock(Annotation.class);
 1482   
 1483  1 checking(new Expectations() {{
 1484  1 atLeast(1).of (parameter).getAnnotations();
 1485  1 will(returnValue(Collections.singleton(annotation)));
 1486  1 one (annotation).accept(printer);
 1487    }});
 1488   
 1489  1 printer.visitParameter(parameter);
 1490   
 1491  1 String xmlDocument = buffer.toString();
 1492  1 assertXPathCount(xmlDocument, "parameter", 1);
 1493  1 assertXPathCount(xmlDocument, "parameter/annotations", 1);
 1494    }
 1495   
 1496  1 public void testVisitAnnotation_WithoutElementValuePairs() throws Exception {
 1497  1 final Annotation annotation = mock(Annotation.class);
 1498   
 1499  1 checking(new Expectations() {{
 1500  1 atLeast(1).of (annotation).getType();
 1501  1 will(returnValue(ANNOTATION_TYPE));
 1502  1 atLeast(1).of (annotation).getElementValuePairs();
 1503    }});
 1504   
 1505  1 printer.visitAnnotation(annotation);
 1506   
 1507  1 String xmlDocument = buffer.toString();
 1508  1 assertXPathCount(xmlDocument, "annotation", 1);
 1509  1 assertXPathText(xmlDocument, "annotation/type", ANNOTATION_TYPE);
 1510  1 assertXPathCount(xmlDocument, "annotation/element-value-pairs", 1);
 1511    }
 1512   
 1513  1 public void testVisitAnnotation_WithAnElementValuePair() throws Exception {
 1514  1 final Annotation annotation = mock(Annotation.class);
 1515  1 final ElementValuePair elementValuePair = mock(ElementValuePair.class);
 1516   
 1517  1 checking(new Expectations() {{
 1518  1 atLeast(1).of (annotation).getType();
 1519  1 will(returnValue(ANNOTATION_TYPE));
 1520  1 atLeast(1).of (annotation).getElementValuePairs();
 1521  1 will(returnValue(Collections.singleton(elementValuePair)));
 1522  1 one (elementValuePair).accept(printer);
 1523    }});
 1524   
 1525  1 printer.visitAnnotation(annotation);
 1526   
 1527  1 String xmlDocument = buffer.toString();
 1528  1 assertXPathCount(xmlDocument, "annotation", 1);
 1529  1 assertXPathText(xmlDocument, "annotation/type", ANNOTATION_TYPE);
 1530  1 assertXPathCount(xmlDocument, "annotation/element-value-pairs", 1);
 1531    }
 1532   
 1533  1 public void testVisitElementValuePair() throws Exception {
 1534  1 final ElementValuePair elementValuePair = mock(ElementValuePair.class);
 1535  1 final ElementValue elementValue = mock(ElementValue.class);
 1536   
 1537  1 checking(new Expectations() {{
 1538  1 one (elementValuePair).getElementName();
 1539  1 will(returnValue(ELEMENT_NAME));
 1540  1 one (elementValuePair).getElementValue();
 1541  1 will(returnValue(elementValue));
 1542  1 one (elementValue).accept(printer);
 1543    }});
 1544   
 1545  1 printer.visitElementValuePair(elementValuePair);
 1546   
 1547  1 String xmlDocument = buffer.toString();
 1548  1 assertXPathCount(xmlDocument, "element-value-pair", 1);
 1549  1 assertXPathText(xmlDocument, "element-value-pair/element-name", ELEMENT_NAME);
 1550    }
 1551   
 1552  1 public void testVisitByteConstantElementValue() throws Exception {
 1553  1 final ByteConstantElementValue constantElementValue = mock(ByteConstantElementValue.class);
 1554  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1555   
 1556  1 checking(new Expectations() {{
 1557  1 one (constantElementValue).getTag();
 1558  1 will(returnValue(ElementValueType.BYTE.getTag()));
 1559  1 one (constantElementValue).getRawConstValue();
 1560  1 will(returnValue(constantPoolEntry));
 1561  1 one (constantPoolEntry).accept(printer);
 1562    }});
 1563   
 1564  1 printer.visitByteConstantElementValue(constantElementValue);
 1565   
 1566  1 String xmlDocument = buffer.toString();
 1567  1 assertXPathCount(xmlDocument, "byte-element-value", 1);
 1568  1 assertXPathText(xmlDocument, "byte-element-value/@tag", String.valueOf(ElementValueType.BYTE.getTag()));
 1569    }
 1570   
 1571  1 public void testVisitCharConstantElementValue() throws Exception {
 1572  1 final CharConstantElementValue constantElementValue = mock(CharConstantElementValue.class);
 1573  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1574   
 1575  1 checking(new Expectations() {{
 1576  1 one (constantElementValue).getTag();
 1577  1 will(returnValue(ElementValueType.CHAR.getTag()));
 1578  1 one (constantElementValue).getRawConstValue();
 1579  1 will(returnValue(constantPoolEntry));
 1580  1 one (constantPoolEntry).accept(printer);
 1581    }});
 1582   
 1583  1 printer.visitCharConstantElementValue(constantElementValue);
 1584   
 1585  1 String xmlDocument = buffer.toString();
 1586  1 assertXPathCount(xmlDocument, "char-element-value", 1);
 1587  1 assertXPathText(xmlDocument, "char-element-value/@tag", String.valueOf(ElementValueType.CHAR.getTag()));
 1588    }
 1589   
 1590  1 public void testVisitDoubleConstantElementValue() throws Exception {
 1591  1 final DoubleConstantElementValue constantElementValue = mock(DoubleConstantElementValue.class);
 1592  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1593   
 1594  1 checking(new Expectations() {{
 1595  1 one (constantElementValue).getTag();
 1596  1 will(returnValue(ElementValueType.DOUBLE.getTag()));
 1597  1 one (constantElementValue).getRawConstValue();
 1598  1 will(returnValue(constantPoolEntry));
 1599  1 one (constantPoolEntry).accept(printer);
 1600    }});
 1601   
 1602  1 printer.visitDoubleConstantElementValue(constantElementValue);
 1603   
 1604  1 String xmlDocument = buffer.toString();
 1605  1 assertXPathCount(xmlDocument, "double-element-value", 1);
 1606  1 assertXPathText(xmlDocument, "double-element-value/@tag", String.valueOf(ElementValueType.DOUBLE.getTag()));
 1607    }
 1608   
 1609  1 public void testVisitFloatConstantElementValue() throws Exception {
 1610  1 final FloatConstantElementValue constantElementValue = mock(FloatConstantElementValue.class);
 1611  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1612   
 1613  1 checking(new Expectations() {{
 1614  1 one (constantElementValue).getTag();
 1615  1 will(returnValue(ElementValueType.FLOAT.getTag()));
 1616  1 one (constantElementValue).getRawConstValue();
 1617  1 will(returnValue(constantPoolEntry));
 1618  1 one (constantPoolEntry).accept(printer);
 1619    }});
 1620   
 1621  1 printer.visitFloatConstantElementValue(constantElementValue);
 1622   
 1623  1 String xmlDocument = buffer.toString();
 1624  1 assertXPathCount(xmlDocument, "float-element-value", 1);
 1625  1 assertXPathText(xmlDocument, "float-element-value/@tag", String.valueOf(ElementValueType.FLOAT.getTag()));
 1626    }
 1627   
 1628  1 public void testVisitIntegerConstantElementValue() throws Exception {
 1629  1 final IntegerConstantElementValue constantElementValue = mock(IntegerConstantElementValue.class);
 1630  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1631   
 1632  1 checking(new Expectations() {{
 1633  1 one (constantElementValue).getTag();
 1634  1 will(returnValue(ElementValueType.INTEGER.getTag()));
 1635  1 one (constantElementValue).getRawConstValue();
 1636  1 will(returnValue(constantPoolEntry));
 1637  1 one (constantPoolEntry).accept(printer);
 1638    }});
 1639   
 1640  1 printer.visitIntegerConstantElementValue(constantElementValue);
 1641   
 1642  1 String xmlDocument = buffer.toString();
 1643  1 assertXPathCount(xmlDocument, "integer-element-value", 1);
 1644  1 assertXPathText(xmlDocument, "integer-element-value/@tag", String.valueOf(ElementValueType.INTEGER.getTag()));
 1645    }
 1646   
 1647  1 public void testVisitLongConstantElementValue() throws Exception {
 1648  1 final LongConstantElementValue constantElementValue = mock(LongConstantElementValue.class);
 1649  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1650   
 1651  1 checking(new Expectations() {{
 1652  1 one (constantElementValue).getTag();
 1653  1 will(returnValue(ElementValueType.LONG.getTag()));
 1654  1 one (constantElementValue).getRawConstValue();
 1655  1 will(returnValue(constantPoolEntry));
 1656  1 one (constantPoolEntry).accept(printer);
 1657    }});
 1658   
 1659  1 printer.visitLongConstantElementValue(constantElementValue);
 1660   
 1661  1 String xmlDocument = buffer.toString();
 1662  1 assertXPathCount(xmlDocument, "long-element-value", 1);
 1663  1 assertXPathText(xmlDocument, "long-element-value/@tag", String.valueOf(ElementValueType.LONG.getTag()));
 1664    }
 1665   
 1666  1 public void testVisitShortConstantElementValue() throws Exception {
 1667  1 final ShortConstantElementValue constantElementValue = mock(ShortConstantElementValue.class);
 1668  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1669   
 1670  1 checking(new Expectations() {{
 1671  1 one (constantElementValue).getTag();
 1672  1 will(returnValue(ElementValueType.SHORT.getTag()));
 1673  1 one (constantElementValue).getRawConstValue();
 1674  1 will(returnValue(constantPoolEntry));
 1675  1 one (constantPoolEntry).accept(printer);
 1676    }});
 1677   
 1678  1 printer.visitShortConstantElementValue(constantElementValue);
 1679   
 1680  1 String xmlDocument = buffer.toString();
 1681  1 assertXPathCount(xmlDocument, "short-element-value", 1);
 1682  1 assertXPathText(xmlDocument, "short-element-value/@tag", String.valueOf(ElementValueType.SHORT.getTag()));
 1683    }
 1684   
 1685  1 public void testVisitBooleanConstantElementValue() throws Exception {
 1686  1 final BooleanConstantElementValue constantElementValue = mock(BooleanConstantElementValue.class);
 1687  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1688   
 1689  1 checking(new Expectations() {{
 1690  1 one (constantElementValue).getTag();
 1691  1 will(returnValue(ElementValueType.BOOLEAN.getTag()));
 1692  1 one (constantElementValue).getRawConstValue();
 1693  1 will(returnValue(constantPoolEntry));
 1694  1 one (constantPoolEntry).accept(printer);
 1695    }});
 1696   
 1697  1 printer.visitBooleanConstantElementValue(constantElementValue);
 1698   
 1699  1 String xmlDocument = buffer.toString();
 1700  1 assertXPathCount(xmlDocument, "boolean-element-value", 1);
 1701  1 assertXPathText(xmlDocument, "boolean-element-value/@tag", String.valueOf(ElementValueType.BOOLEAN.getTag()));
 1702    }
 1703   
 1704  1 public void testVisitStringConstantElementValue() throws Exception {
 1705  1 final StringConstantElementValue constantElementValue = mock(StringConstantElementValue.class);
 1706  1 final ConstantPoolEntry constantPoolEntry = mock(ConstantPoolEntry.class);
 1707   
 1708  1 checking(new Expectations() {{
 1709  1 one (constantElementValue).getTag();
 1710  1 will(returnValue(ElementValueType.STRING.getTag()));
 1711  1 one (constantElementValue).getRawConstValue();
 1712  1 will(returnValue(constantPoolEntry));
 1713  1 one (constantPoolEntry).accept(printer);
 1714    }});
 1715   
 1716  1 printer.visitStringConstantElementValue(constantElementValue);
 1717   
 1718  1 String xmlDocument = buffer.toString();
 1719  1 assertXPathCount(xmlDocument, "string-element-value", 1);
 1720  1 assertXPathText(xmlDocument, "string-element-value/@tag", String.valueOf(ElementValueType.STRING.getTag()));
 1721    }
 1722   
 1723  1 public void testVisitEnumElementValue() throws Exception {
 1724  1 final EnumElementValue enumElementValue = mock(EnumElementValue.class);
 1725  1 final String constName = "BAR";
 1726   
 1727  1 checking(new Expectations() {{
 1728  1 one (enumElementValue).getTag();
 1729  1 will(returnValue(ElementValueType.ENUM.getTag()));
 1730  1 one (enumElementValue).getTypeName();
 1731  1 will(returnValue(TEST_CLASS));
 1732  1 one (enumElementValue).getConstName();
 1733  1 will(returnValue(constName));
 1734    }});
 1735   
 1736  1 printer.visitEnumElementValue(enumElementValue);
 1737   
 1738  1 String xmlDocument = buffer.toString();
 1739  1 assertXPathText(xmlDocument, "enum-element-value", TEST_CLASS + "." + constName);
 1740  1 assertXPathText(xmlDocument, "enum-element-value/@tag", String.valueOf(ElementValueType.ENUM.getTag()));
 1741    }
 1742   
 1743  1 public void testVisitClassElementValue() throws Exception {
 1744  1 final ClassElementValue classElementValue = mock(ClassElementValue.class);
 1745   
 1746  1 checking(new Expectations() {{
 1747  1 one (classElementValue).getTag();
 1748  1 will(returnValue(ElementValueType.CLASS.getTag()));
 1749  1 one (classElementValue).getClassInfo();
 1750  1 will(returnValue(TEST_CLASS));
 1751    }});
 1752   
 1753  1 printer.visitClassElementValue(classElementValue);
 1754   
 1755  1 String xmlDocument = buffer.toString();
 1756  1 assertXPathText(xmlDocument, "class-element-value", TEST_CLASS);
 1757  1 assertXPathText(xmlDocument, "class-element-value/@tag", String.valueOf(ElementValueType.CLASS.getTag()));
 1758    }
 1759   
 1760  1 public void testVisitAnnotationElementValue() throws Exception {
 1761  1 final AnnotationElementValue annotationElementValue = mock(AnnotationElementValue.class);
 1762  1 final Annotation annotation = mock(Annotation.class);
 1763   
 1764  1 checking(new Expectations() {{
 1765  1 one (annotationElementValue).getTag();
 1766  1 will(returnValue(ElementValueType.ANNOTATION.getTag()));
 1767  1 one (annotationElementValue).getAnnotation();
 1768  1 will(returnValue(annotation));
 1769  1 one (annotation).accept(printer);
 1770    }});
 1771   
 1772  1 printer.visitAnnotationElementValue(annotationElementValue);
 1773   
 1774  1 String xmlDocument = buffer.toString();
 1775  1 assertXPathCount(xmlDocument, "annotation-element-value", 1);
 1776  1 assertXPathText(xmlDocument, "annotation-element-value/@tag", String.valueOf(ElementValueType.ANNOTATION.getTag()));
 1777    }
 1778   
 1779  1 public void testVisitArrayElementValue() throws Exception {
 1780  1 final ArrayElementValue arrayElementValue = mock(ArrayElementValue.class);
 1781  1 final ElementValue elementValue = mock(ElementValue.class);
 1782   
 1783  1 checking(new Expectations() {{
 1784  1 one (arrayElementValue).getTag();
 1785  1 will(returnValue(ElementValueType.ARRAY.getTag()));
 1786  1 atLeast(1).of (arrayElementValue).getValues();
 1787  1 will(returnValue(Collections.singleton(elementValue)));
 1788  1 one (elementValue).accept(printer);
 1789    }});
 1790   
 1791  1 printer.visitArrayElementValue(arrayElementValue);
 1792   
 1793  1 String xmlDocument = buffer.toString();
 1794  1 assertXPathCount(xmlDocument, "array-element-value", 1);
 1795  1 assertXPathText(xmlDocument, "array-element-value/@tag", String.valueOf(ElementValueType.ARRAY.getTag()));
 1796    }
 1797   
 1798  120 private void assertXPathCount(String xmlDocument, String xPathExpression, int expectedCount) throws Exception {
 1799  120 XPath xPath = XPathFactory.newInstance().newXPath();
 1800  120 InputSource in = new InputSource(new StringReader(xmlDocument));
 1801   
 1802  120 NodeList nodeList = (NodeList) xPath.evaluate(xPathExpression, in, XPathConstants.NODESET);
 1803  120 int actualCount = nodeList.getLength();
 1804  120 assertEquals("XPath \"" + xPathExpression + "\" in \n" + xmlDocument, expectedCount, actualCount);
 1805    }
 1806   
 1807  19 private void assertXPathText(String xmlDocument, String xPathExpression, String expectedText) throws Exception {
 1808  19 XPath xPath = XPathFactory.newInstance().newXPath();
 1809  19 InputSource in = new InputSource(new StringReader(xmlDocument));
 1810   
 1811  19 String actualText = (String) xPath.evaluate(xPathExpression, in, XPathConstants.STRING);
 1812  19 assertEquals("XPath \"" + xPathExpression + "\" in \n" + xmlDocument, expectedText, actualText);
 1813    }
 1814    }