public static void assertRtfParserDumpMatches(Object parentTest, IRtfParser parser, String filename) throws Exception
   {

      File outputFile = File.createTempFile(filename, ".xml");
      outputFile.deleteOnExit();

      InputStream is = null;
      OutputStream os = null;

      try
      {
         is = parentTest.getClass().getResourceAsStream("data/" + filename + ".rtf");
         os = new FileOutputStream(outputFile);
         parser.parse(new RtfStreamSource(is), new RtfDumpListener(os));
      }

      finally
      {
         if (is != null)
         {
            try
            {
               is.close();
            }

            catch (Exception ex)
            {
               // Ignored
            }
         }

         if (os != null)
         {
            try
            {
               os.close();
            }

            catch (Exception ex)
            {
               // Ignored
            }
         }
      }

      InputStream actualStream = null;
      InputStream expectedStream = null;

      try
      {
         actualStream = new FileInputStream(outputFile);
         expectedStream = parentTest.getClass().getResourceAsStream("data/" + filename + ".xml");
         String expectedText = TestUtilities.readStreamToString(expectedStream);
         String actualText = TestUtilities.readStreamToString(actualStream);
         assertEquals(expectedText, actualText);
      }

      finally
      {
         if (actualStream != null)
         {
            try
            {
               actualStream.close();
            }

            catch (Exception ex)
            {
               // Ignored
            }
         }

         if (expectedStream != null)
         {
            try
            {
               expectedStream.close();
            }

            catch (Exception ex)
            {
               // Ignored
            }
         }

      }
   }