Coverage Report - org.jbehave.core.reporters.PrintStreamOutput
 
Classes in this File Line Coverage Branch Coverage Complexity
PrintStreamOutput
97%
140/144
84%
37/44
1.732
PrintStreamOutput$1
100%
6/6
80%
4/5
1.732
PrintStreamOutput$2
100%
1/1
N/A
1.732
PrintStreamOutput$Format
100%
1/1
N/A
1.732
PrintStreamOutput$Replacement
100%
5/5
N/A
1.732
 
 1  
 package org.jbehave.core.reporters;
 2  
 
 3  
 import org.apache.commons.collections.CollectionUtils;
 4  
 import org.apache.commons.collections.Transformer;
 5  
 import org.apache.commons.lang.ArrayUtils;
 6  
 import org.apache.commons.lang.StringUtils;
 7  
 import org.apache.commons.lang.builder.ToStringBuilder;
 8  
 import org.apache.commons.lang.builder.ToStringStyle;
 9  
 import org.jbehave.core.configuration.Keywords;
 10  
 import org.jbehave.core.failures.UUIDExceptionWrapper;
 11  
 import org.jbehave.core.model.ExamplesTable;
 12  
 import org.jbehave.core.model.GivenStories;
 13  
 import org.jbehave.core.model.GivenStory;
 14  
 import org.jbehave.core.model.Meta;
 15  
 import org.jbehave.core.model.Narrative;
 16  
 import org.jbehave.core.model.OutcomesTable;
 17  
 import org.jbehave.core.model.OutcomesTable.Outcome;
 18  
 import org.jbehave.core.model.Scenario;
 19  
 import org.jbehave.core.model.Story;
 20  
 
 21  
 import java.io.ByteArrayOutputStream;
 22  
 import java.io.PrintStream;
 23  
 import java.text.MessageFormat;
 24  
 import java.util.Arrays;
 25  
 import java.util.List;
 26  
 import java.util.Locale;
 27  
 import java.util.Map;
 28  
 import java.util.Properties;
 29  
 import java.util.regex.Pattern;
 30  
 
 31  
 import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
 32  
 import static org.apache.commons.lang.StringEscapeUtils.escapeXml;
 33  
 import static org.jbehave.core.steps.StepCreator.PARAMETER_VALUE_END;
 34  
 import static org.jbehave.core.steps.StepCreator.PARAMETER_VALUE_NEWLINE;
 35  
 import static org.jbehave.core.steps.StepCreator.PARAMETER_VALUE_START;
 36  
 
 37  
 /**
 38  
  * <p>
 39  
  * Abstract story reporter that outputs to a PrintStream.
 40  
  * </p>
 41  
  * <p>
 42  
  * The output of the reported event is configurable via:
 43  
  * <ul>
 44  
  * <li>custom output patterns, providing only the patterns that differ from
 45  
  * default</li>
 46  
  * <li>keywords localised for different languages, providing the i18n Locale</li>
 47  
  * <li>flag to report failure trace</li>
 48  
  * </ul>
 49  
  * </p>
 50  
  * <p>
 51  
  * Let's look at example of providing custom output patterns, e.g. for the
 52  
  * failed event. <br/>
 53  
  * we'd need to provide the custom pattern, say we want to have something like
 54  
  * "(step being executed) <<< FAILED", keyed on the method name:
 55  
  * 
 56  
  * <pre>
 57  
  * Properties patterns = new Properties();
 58  
  * patterns.setProperty(&quot;failed&quot;, &quot;{0} &lt;&lt;&lt; {1}&quot;);
 59  
  * </pre>
 60  
  * 
 61  
  * The pattern is by default processed and formatted by the
 62  
  * {@link MessageFormat}. Both the {@link #format(String key, String defaultPattern, Object... args)} and
 63  
  * {@link #lookupPattern(String key, String defaultPattern)} methods are override-able and a different formatter
 64  
  * or pattern lookup can be used by subclasses.
 65  
  * </p>
 66  
  * <p>
 67  
  * If the keyword "FAILED" (or any other keyword used by the reporter) needs to
 68  
  * be expressed in a different language, all we need to do is to provide an
 69  
  * instance of {@link org.jbehave.core.i18n.LocalizedKeywords} using the appropriate {@link Locale}, e.g.
 70  
  * 
 71  
  * <pre>
 72  
  * Keywords keywords = new LocalizedKeywords(new Locale(&quot;it&quot;));
 73  
  * </pre>
 74  
  * 
 75  
  * </p>
 76  
  */
 77  
 public abstract class PrintStreamOutput implements StoryReporter {
 78  
 
 79  
     private static final String EMPTY = "";
 80  
 
 81  5
     public enum Format { TXT, HTML, XML }
 82  
     
 83  
     private final Format format;    
 84  
     private final PrintStream output;
 85  
     private final Properties outputPatterns;
 86  
     private final Keywords keywords;
 87  
     private boolean reportFailureTrace;
 88  
     private boolean compressFailureTrace;
 89  
     private Throwable cause;
 90  
     
 91  
     protected PrintStreamOutput(Format format, PrintStream output, Properties outputPatterns,
 92  266
             Keywords keywords, boolean reportFailureTrace, boolean compressFailureTrace) {
 93  266
         this.format = format;
 94  266
         this.output = output;
 95  266
         this.outputPatterns = outputPatterns;
 96  266
         this.keywords = keywords;
 97  266
         this.reportFailureTrace = reportFailureTrace;
 98  266
         this.compressFailureTrace = compressFailureTrace;   
 99  266
     }
 100  
 
 101  
     public void successful(String step) {
 102  44
         print(format("successful", "{0}\n", step));
 103  44
     }
 104  
 
 105  
     public void ignorable(String step) {
 106  12
         print(format("ignorable", "{0}\n", step));
 107  12
     }
 108  
 
 109  
     public void pending(String step) {
 110  16
         print(format("pending", "{0} ({1})\n", step, keywords.pending()));
 111  16
     }
 112  
 
 113  
     public void notPerformed(String step) {
 114  16
         print(format("notPerformed", "{0} ({1})\n", step, keywords.notPerformed()));
 115  16
     }
 116  
 
 117  
     public void failed(String step, Throwable storyFailure) {
 118  
         // storyFailure be used if a subclass has rewritten the "failed" pattern to have a {3} as WebDriverHtmlOutput (jbehave-web) does.
 119  17
         if (storyFailure instanceof UUIDExceptionWrapper) {
 120  17
             this.cause = storyFailure.getCause();
 121  17
             print(format("failed", "{0} ({1})\n({2})\n", step, keywords.failed(), storyFailure.getCause(), ((UUIDExceptionWrapper) storyFailure).getUUID()));
 122  
         } else {
 123  0
             throw new ClassCastException(storyFailure +" should be an instance of UUIDExceptionWrapper");
 124  
         }
 125  17
     }
 126  
 
 127  
     public void failedOutcomes(String step, OutcomesTable table) {
 128  12
             failed(step, table.failureCause());
 129  12
         print(table);
 130  12
     }
 131  
     
 132  
         private void print(OutcomesTable table) {
 133  12
                 print(format("outcomesTableStart", "\n"));
 134  12
         List<Outcome<?>> rows = table.getOutcomes();
 135  12
         print(format("outcomesTableHeadStart", "|"));
 136  
         //TODO i18n outcome fields
 137  12
         for (String field : table.getOutcomeFields()) {
 138  48
             print(format("outcomesTableHeadCell", "{0}|", field));
 139  
         }
 140  12
         print(format("outcomesTableHeadEnd", "\n"));
 141  12
         print(format("outcomesTableBodyStart", EMPTY));
 142  12
         for (Outcome<?> outcome : rows) {
 143  12
             print(format("outcomesTableRowStart", "|", outcome.isVerified()?"verified":"notVerified"));
 144  12
             print(format("outcomesTableCell", "{0}|", outcome.getDescription()));
 145  12
             print(format("outcomesTableCell", "{0}|", outcome.getValue()));
 146  12
             print(format("outcomesTableCell", "{0}|", outcome.getMatcher()));
 147  12
             print(format("outcomesTableCell", "{0}|", outcome.isVerified()));
 148  12
             print(format("outcomesTableRowEnd", "\n"));
 149  
         }
 150  12
         print(format("outcomesTableBodyEnd", "\n"));
 151  12
         print(format("outcomesTableEnd", "\n"));
 152  12
         }
 153  
 
 154  
     public void storyNotAllowed(Story story, String filter) {
 155  3
         print(format("filter", "{0}\n", filter));
 156  3
     }
 157  
 
 158  
     public void beforeStory(Story story, boolean givenStory) {
 159  15
         print(format("beforeStory", "{0}\n({1})\n", story.getDescription().asString(), story.getPath()));
 160  15
         if (!story.getMeta().isEmpty()) {
 161  15
             Meta meta = story.getMeta();
 162  15
             print(meta);
 163  
         }
 164  15
     }
 165  
 
 166  
     public void narrative(Narrative narrative) {
 167  12
         if (!narrative.isEmpty()) {
 168  12
             print(format("narrative", "{0}\n{1} {2}\n{3} {4}\n{5} {6}\n", keywords.narrative(), keywords.inOrderTo(),
 169  
                     narrative.inOrderTo(), keywords.asA(), narrative.asA(), keywords.iWantTo(), narrative.iWantTo()));
 170  
         }
 171  12
     }
 172  
 
 173  
     private void print(Meta meta) {
 174  18
         print(format("metaStart", "{0}\n", keywords.meta()));
 175  18
         for (String name : meta.getPropertyNames() ){
 176  36
             print(format("metaProperty", "{0}{1} {2}", keywords.metaProperty(), name, meta.getProperty(name)));                
 177  
         }
 178  18
         print(format("metaEnd", "\n"));
 179  18
     }
 180  
 
 181  
     public void afterStory(boolean givenStory) {
 182  15
         print(format("afterStory", "\n"));
 183  15
     }
 184  
 
 185  
     public void givenStories(GivenStories givenStories) {
 186  12
         print(format("givenStoriesStart", "{0}\n", keywords.givenStories()));
 187  12
         for (GivenStory givenStory : givenStories.getStories()) {
 188  24
             print(format("givenStory", "{0} {1}\n", givenStory.asString(), (givenStory.hasAnchor() ? givenStory.getParameters() : "")));
 189  
         }
 190  12
         print(format("givenStoriesEnd", "\n"));
 191  12
     }
 192  
 
 193  
     public void givenStories(List<String> storyPaths) {
 194  12
         givenStories(new GivenStories(StringUtils.join(storyPaths, ",")));
 195  12
     }
 196  
 
 197  
     public void scenarioNotAllowed(Scenario scenario, String filter) {
 198  3
         print(format("filter", "{0}\n", filter));
 199  3
     }
 200  
 
 201  
     public void beforeScenario(String title) {
 202  17
         cause = null;
 203  17
         print(format("beforeScenario", "{0} {1}\n", keywords.scenario(), title));
 204  17
     }
 205  
 
 206  
     public void scenarioMeta(Meta meta) {
 207  3
         if (!meta.isEmpty()) {
 208  3
             print(meta);
 209  
         }
 210  3
     }
 211  
 
 212  
     public void afterScenario() {
 213  17
         if (cause != null && reportFailureTrace) {
 214  3
             print(format("afterScenarioWithFailure", "\n{0}\n", stackTrace(cause)));
 215  
         } else {
 216  14
             print(format("afterScenario", "\n"));
 217  
         }
 218  17
     }
 219  
 
 220  
     private String stackTrace(Throwable cause) {
 221  3
         ByteArrayOutputStream out = new ByteArrayOutputStream();        
 222  3
         cause.printStackTrace(new PrintStream(out));
 223  3
         return stackTrace(out.toString());
 224  
     }
 225  
 
 226  
     protected String stackTrace(String stackTrace) {
 227  4
         if ( !compressFailureTrace ){
 228  3
             return stackTrace;
 229  
         }
 230  
         // don't print past certain parts of the stack.  Try them even though they may be redundant.
 231  1
         stackTrace = cutOff(stackTrace, "org.jbehave.core.embedder.");
 232  1
         stackTrace = cutOff(stackTrace, "org.junit.runners.");
 233  1
         stackTrace = cutOff(stackTrace, "org.apache.maven.surefire.");
 234  
 
 235  
         //System.out.println("=====before>" + stackTrace + "<==========");
 236  
 
 237  
         // replace whole series of lines with '\t(summary)'  The end-user will thank us.
 238  9
         for (Replacement replacement : REPLACEMENTS) {
 239  8
             stackTrace = replacement.from.matcher(stackTrace).replaceAll(replacement.to);
 240  
         }
 241  1
         return stackTrace;
 242  
     }
 243  
 
 244  
     private String cutOff(String stackTrace, String at) {
 245  3
         if (stackTrace.indexOf(at) > -1) {
 246  1
             int ix = stackTrace.indexOf(at);
 247  1
             ix = stackTrace.indexOf("\n", ix);
 248  1
             if (ix != -1) {
 249  0
                 stackTrace = stackTrace.substring(0,ix);
 250  
             }
 251  
         }
 252  3
         return stackTrace;
 253  
     }
 254  
 
 255  
     public void beforeExamples(List<String> steps, ExamplesTable table) {
 256  12
         print(format("beforeExamples", "{0}\n", keywords.examplesTable()));
 257  12
         for (String step : steps) {
 258  24
             print(format("examplesStep", "{0}\n", step));
 259  
         }
 260  12
         print(table);
 261  12
     }
 262  
 
 263  
         private void print(ExamplesTable table) {
 264  12
                 print(format("examplesTableStart", "\n"));
 265  12
         List<Map<String, String>> rows = table.getRows();
 266  12
         List<String> headers = table.getHeaders();
 267  12
         print(format("examplesTableHeadStart", "|"));
 268  12
         for (String header : headers) {
 269  24
             print(format("examplesTableHeadCell", "{0}|", header));
 270  
         }
 271  12
         print(format("examplesTableHeadEnd", "\n"));
 272  12
         print(format("examplesTableBodyStart", EMPTY));
 273  12
         for (Map<String, String> row : rows) {
 274  24
             print(format("examplesTableRowStart", "|"));
 275  24
             for (String header : headers) {
 276  48
                 print(format("examplesTableCell", "{0}|", row.get(header)));
 277  
             }
 278  24
             print(format("examplesTableRowEnd", "\n"));
 279  
         }
 280  12
         print(format("examplesTableBodyEnd", "\n"));
 281  12
         print(format("examplesTableEnd", "\n"));
 282  12
         }
 283  
 
 284  
     public void example(Map<String, String> tableRow) {
 285  24
         print(format("example", "\n{0} {1}\n", keywords.examplesTableRow(), tableRow));
 286  24
     }
 287  
 
 288  
     public void afterExamples() {
 289  12
         print(format("afterExamples", "\n"));
 290  12
     }
 291  
 
 292  
         public void dryRun() {
 293  12
                 print(format("dryRun", "{0}\n", keywords.dryRun()));
 294  12
         }
 295  
         
 296  
 
 297  
     public void pendingMethods(List<String> methods) {
 298  12
         for (String method : methods) {
 299  24
             print(format("pendingMethod", "{0}\n", method));
 300  
         }        
 301  12
     }
 302  
 
 303  
     /**
 304  
      * Formats event output by key, usually equal to the method name.
 305  
      * 
 306  
      * @param key the event key
 307  
      * @param defaultPattern the default pattern to return if a custom pattern
 308  
      *            is not found
 309  
      * @param args the args used to format output
 310  
      * @return A formatted event output
 311  
      */
 312  
     protected String format(String key, String defaultPattern, Object... args) {
 313  5593
         return MessageFormat.format(lookupPattern(key, escape(defaultPattern)), escapeAll(args));
 314  
     }
 315  
 
 316  
     private String escape(String defaultPattern) {
 317  5593
         return (String) escapeAll(defaultPattern)[0];
 318  
     }
 319  
 
 320  
     private Object[] escapeAll(Object... args) {
 321  11186
         return escape(format, args);
 322  
     }
 323  
 
 324  
     /**
 325  
      * Escapes args' string values according to format
 326  
      * 
 327  
      * @param format the Format used by the PrintStream
 328  
      * @param args the array of args to escape
 329  
      * @return The cloned and escaped array of args
 330  
      */
 331  
     protected Object[] escape(final Format format, Object... args) {
 332  
         // Transformer that escapes HTML and XML strings
 333  11186
         Transformer escapingTransformer = new Transformer( ) {
 334  
             public Object transform(Object object) {
 335  6424
                 switch ( format ){
 336  2066
                     case HTML: return escapeHtml(asString(object));
 337  605
                     case XML: return escapeXml(asString(object));
 338  3753
                     default: return object;
 339  
                 }
 340  
             }
 341  
 
 342  
             private String asString(Object object) {
 343  2671
                 return  ( object != null ? object.toString() : EMPTY );
 344  
             }
 345  
         };
 346  11186
         List<?> list = Arrays.asList( ArrayUtils.clone( args ) );
 347  11186
         CollectionUtils.transform( list, escapingTransformer );
 348  11186
         return list.toArray();
 349  
     }
 350  
 
 351  
     /**
 352  
      * Looks up the format pattern for the event output by key, conventionally
 353  
      * equal to the method name. The pattern is used by the
 354  
      * {#format(String,String,Object...)} method and by default is formatted
 355  
      * using the {@link MessageFormat#format(String, Object...)} method. If no pattern is found
 356  
      * for key or needs to be overridden, the default pattern should be
 357  
      * returned.
 358  
      * 
 359  
      * @param key the format pattern key
 360  
      * @param defaultPattern the default pattern if no pattern is
 361  
      * @return The format patter for the given key
 362  
      */
 363  
     protected String lookupPattern(String key, String defaultPattern) {
 364  5593
         if (outputPatterns.containsKey(key)) {
 365  3182
             return outputPatterns.getProperty(key);
 366  
         }
 367  2411
         return defaultPattern;
 368  
     }
 369  
 
 370  
     public PrintStreamOutput doReportFailureTrace(boolean reportFailureTrace){
 371  18
             this.reportFailureTrace = reportFailureTrace;
 372  18
             return this;
 373  
     }
 374  
 
 375  
     public PrintStreamOutput doCompressFailureTrace(boolean compressFailureTrace){
 376  18
         this.compressFailureTrace = compressFailureTrace;
 377  18
         return this;
 378  
     }
 379  
 
 380  
     protected void overwritePattern(String key, String pattern) {
 381  0
         outputPatterns.put(key, pattern);
 382  0
     }
 383  
 
 384  
     /**
 385  
      * Prints text to output stream, replacing parameter start and end placeholders
 386  
      * 
 387  
      * @param text the String to print
 388  
      */
 389  
     protected void print(String text) {
 390  799
         output.print(text.replace(format(PARAMETER_VALUE_START, PARAMETER_VALUE_START), format("parameterValueStart", EMPTY))
 391  
                          .replace(format(PARAMETER_VALUE_END, PARAMETER_VALUE_END), format("parameterValueEnd", EMPTY))
 392  
                          .replace(format(PARAMETER_VALUE_NEWLINE, PARAMETER_VALUE_NEWLINE), format("parameterValueNewline", "\n")));
 393  799
     }
 394  
     
 395  
         @Override
 396  
         public String toString() {
 397  1
                 return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
 398  
         }
 399  
 
 400  24
     private static class Replacement {
 401  
         private final Pattern from;
 402  
         private final String to;
 403  8
         private Replacement(Pattern from, String to) {
 404  8
             this.from = from;
 405  8
             this.to = to;
 406  8
         }
 407  
     }
 408  
 
 409  1
     private static Replacement[] REPLACEMENTS = new Replacement[]{
 410  
             new Replacement(
 411  
                     Pattern.compile(
 412  
                             "\\tat sun.reflect.NativeMethodAccessorImpl.invoke0\\(Native Method\\)\\n" +
 413  
                             "\\tat sun.reflect.NativeMethodAccessorImpl.invoke\\(NativeMethodAccessorImpl.java:\\d+\\)\\n" +
 414  
                             "\\tat sun.reflect.DelegatingMethodAccessorImpl.invoke\\(DelegatingMethodAccessorImpl.java:\\d+\\)\\n" +
 415  
                             "\\tat java.lang.reflect.Method.invoke\\(Method.java:\\d+\\)"
 416  
                     ),
 417  
                     "\t(reflection-invoke)"),
 418  
             new Replacement(
 419  
                     Pattern.compile(
 420  
                             "\\tat org.codehaus.groovy.reflection.CachedMethod.invoke\\(CachedMethod.java:\\d+\\)\\n" +
 421  
                             "\\tat org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke\\(ClosureMetaMethod.java:\\d+\\)\\n" +
 422  
                             "\\tat org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite\\$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke\\(PojoMetaMethodSite.java:\\d+\\)\\n" +
 423  
                             "\\tat org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call\\(PojoMetaMethodSite.java:\\d+\\)\\n" +
 424  
                             "\\tat org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall\\(CallSiteArray.java:\\d+\\)\\n" +
 425  
                             "\\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.call\\(AbstractCallSite.java:\\d+\\)\\n" +
 426  
                             "\\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.call\\(AbstractCallSite.java:\\d+\\)"
 427  
                     ),
 428  
                     "\t(groovy-closure-invoke)"),
 429  
 
 430  
 
 431  
             new Replacement(
 432  
                     Pattern.compile(
 433  
                             "\\tat org.codehaus.groovy.reflection.CachedMethod.invoke\\(CachedMethod.java:\\d+\\)\\n" +
 434  
                             "\\tat groovy.lang.MetaMethod.doMethodInvoke\\(MetaMethod.java:\\d+\\)\\n" +
 435  
                             "\\tat org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod\\(ClosureMetaClass.java:\\d+\\)\\n" +
 436  
                             "\\tat org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN\\(ScriptBytecodeAdapter.java:\\d+\\)"
 437  
                     ),
 438  
                     "\t(groovy-instance-method-invoke)"),
 439  
 
 440  
             new Replacement(
 441  
                     Pattern.compile(
 442  
                             "\\tat org.codehaus.groovy.reflection.CachedMethod.invoke\\(CachedMethod.java:\\d+\\)\n" +
 443  
                             "\\tat org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke\\(ClosureMetaMethod.java:\\d+\\)\n" +
 444  
                             "\\tat org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite\\$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke\\(PojoMetaMethodSite.java:\\d+\\)\n" +
 445  
                             "\\tat org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call\\(PojoMetaMethodSite.java:\\d+\\)\n" +
 446  
                             "\\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.call\\(AbstractCallSite.java:\\d+\\)"
 447  
                     ),
 448  
                     "\t(groovy-abstract-method-invoke)"),
 449  
 
 450  
             new Replacement(
 451  
                     Pattern.compile(
 452  
                             "\\tat org.codehaus.groovy.reflection.CachedMethod.invoke\\(CachedMethod.java:\\d+\\)\\n" +
 453  
                             "\\tat groovy.lang.MetaMethod.doMethodInvoke\\(MetaMethod.java:\\d+\\)\\n" +
 454  
                             "\\tat groovy.lang.MetaClassImpl.invokeStaticMethod\\(MetaClassImpl.java:\\d+\\)\\n" +
 455  
                             "\\tat org.codehaus.groovy.runtime.InvokerHelper.invokeStaticMethod\\(InvokerHelper.java:\\d+\\)\\n" +
 456  
                             "\\tat org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeStaticMethodN\\(ScriptBytecodeAdapter.java:\\d+\\)"
 457  
                     ),
 458  
                     "\t(groovy-static-method-invoke)"),
 459  
 
 460  
             new Replacement(
 461  
                     Pattern.compile(
 462  
                             "\\tat sun.reflect.NativeConstructorAccessorImpl.newInstance0\\(Native Method\\)\\n" +
 463  
                             "\\tat sun.reflect.NativeConstructorAccessorImpl.newInstance\\(NativeConstructorAccessorImpl.java:\\d+\\)\\n" +
 464  
                             "\\tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance\\(DelegatingConstructorAccessorImpl.java:\\d+\\)\\n" +
 465  
                             "\\tat java.lang.reflect.Constructor.newInstance\\(Constructor.java:\\d+\\)"
 466  
                     ),
 467  
                     "\t(reflection-construct)"),
 468  
 
 469  
             new Replacement(
 470  
                     Pattern.compile(
 471  
                             "\\tat org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(Current|)\\(CallSiteArray.java:\\d+\\)\\n" +
 472  
                             "\\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(Current|)\\(AbstractCallSite.java:\\d+\\)\\n" +
 473  
                             "\\tat org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(Current|)\\(AbstractCallSite.java:\\d+\\)"
 474  
 
 475  
                     ),
 476  
                     "\t(groovy-call)"),
 477  
 
 478  
             // This one last.
 479  
             new Replacement(
 480  
                     Pattern.compile(
 481  
                             "\\t\\(reflection\\-invoke\\)\\n" +
 482  
                                     "\\t\\(groovy\\-"),
 483  
                     "\t(groovy-")
 484  
 
 485  
     };
 486  
 
 487  
 
 488  
 
 489  
 }