File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
utils/src/test/java/com/cloud/utils/log Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 2121
2222import java .lang .reflect .Method ;
2323
24+ import org .apache .commons .lang .StringUtils ;
2425import org .junit .Assert ;
2526import org .junit .Test ;
2627
@@ -39,18 +40,20 @@ public void testDoRendere() {
3940 sampleClass .theFirstMethodThatCapturesAnException ();
4041 } catch (Exception e ) {
4142 String [] exceptions = cglibThrowableRenderer .doRender (e );
42- dumpExceptions (exceptions );
43- Assert .assertEquals (40 , exceptions .length );
43+ assertThatTheTraceListDoesNotContainsCgLibLogs (exceptions );
4444 }
4545 }
4646
47- private void dumpExceptions (String [] exceptions ) {
48- System .out .println ("Dumping exception for debugging purposes" );
47+ private void assertThatTheTraceListDoesNotContainsCgLibLogs (String [] exceptions ) {
4948 for (String s : exceptions ) {
50- System . out . println ( s );
49+ Assert . assertEquals ( false , isCgLibLogTrace ( s ) );
5150 }
5251 }
5352
53+ private boolean isCgLibLogTrace (String s ) {
54+ return StringUtils .contains (s , "net.sf.cglib.proxy" );
55+ }
56+
5457 static class SampleClass {
5558 public void theFirstMethodThatCapturesAnException () {
5659 try {
You can’t perform that action at this time.
0 commit comments