11package com .bugsnag ;
22
3+ import static org .junit .Assert .assertEquals ;
34import static org .junit .Assert .assertFalse ;
45import static org .junit .Assert .assertTrue ;
5- import static org .junit .Assert .assertEquals ;
66
77import org .junit .Before ;
88import org .junit .Test ;
@@ -22,15 +22,15 @@ public void setUp() {
2222 @ Test
2323 public void testExactMatch () {
2424 config .setDiscardClasses (new String [] {"com.example.CustomException" });
25-
25+
2626 assertTrue (config .shouldIgnoreClass ("com.example.CustomException" ));
2727 assertFalse (config .shouldIgnoreClass ("com.example.OtherException" ));
2828 }
2929
3030 @ Test
3131 public void testWildcardMatch () {
3232 config .setDiscardClasses (new String [] {"com.example.*" });
33-
33+
3434 assertTrue (config .shouldIgnoreClass ("com.example.CustomException" ));
3535 assertTrue (config .shouldIgnoreClass ("com.example.OtherException" ));
3636 assertTrue (config .shouldIgnoreClass ("com.example." ));
@@ -40,7 +40,7 @@ public void testWildcardMatch() {
4040 @ Test
4141 public void testMultipleWildcards () {
4242 config .setDiscardClasses (new String [] {"com.*.Exception" });
43-
43+
4444 assertTrue (config .shouldIgnoreClass ("com.example.Exception" ));
4545 assertTrue (config .shouldIgnoreClass ("com.other.Exception" ));
4646 assertFalse (config .shouldIgnoreClass ("com.example.CustomException" ));
@@ -49,7 +49,7 @@ public void testMultipleWildcards() {
4949 @ Test
5050 public void testQuestionMarkWildcard () {
5151 config .setDiscardClasses (new String [] {"com.example.Exception?" });
52-
52+
5353 assertTrue (config .shouldIgnoreClass ("com.example.Exception1" ));
5454 assertTrue (config .shouldIgnoreClass ("com.example.ExceptionX" ));
5555 assertFalse (config .shouldIgnoreClass ("com.example.Exception" ));
@@ -63,7 +63,7 @@ public void testMultiplePatterns() {
6363 "com.example.CustomException" ,
6464 "org.*.SpecialException"
6565 });
66-
66+
6767 assertTrue (config .shouldIgnoreClass ("java.io.IOException" ));
6868 assertTrue (config .shouldIgnoreClass ("java.io.FileNotFoundException" ));
6969 assertTrue (config .shouldIgnoreClass ("com.example.CustomException" ));
@@ -76,16 +76,20 @@ public void testMultiplePatterns() {
7676 public void testGetDiscardClassesReturnsOriginalPatterns () {
7777 String [] patterns = new String [] {"com.example.*" , "java.io.IOException" };
7878 config .setDiscardClasses (patterns );
79-
79+
8080 String [] retrieved = config .getDiscardClasses ();
8181 assertEquals (2 , retrieved .length );
82-
82+
8383 // Check that patterns are returned (not regex)
8484 boolean hasWildcard = false ;
8585 boolean hasExact = false ;
8686 for (String pattern : retrieved ) {
87- if (pattern .equals ("com.example.*" )) hasWildcard = true ;
88- if (pattern .equals ("java.io.IOException" )) hasExact = true ;
87+ if (pattern .equals ("com.example.*" )) {
88+ hasWildcard = true ;
89+ }
90+ if (pattern .equals ("java.io.IOException" )) {
91+ hasExact = true ;
92+ }
8993 }
9094 assertTrue (hasWildcard );
9195 assertTrue (hasExact );
@@ -95,15 +99,15 @@ public void testGetDiscardClassesReturnsOriginalPatterns() {
9599 public void testEmptyAndNullPatterns () {
96100 config .setDiscardClasses (new String [] {});
97101 assertFalse (config .shouldIgnoreClass ("com.example.Exception" ));
98-
102+
99103 config .setDiscardClasses (null );
100104 assertFalse (config .shouldIgnoreClass ("com.example.Exception" ));
101105 }
102106
103107 @ Test
104108 public void testSpecialCharactersAreEscaped () {
105109 config .setDiscardClasses (new String [] {"com.example.Exception$Inner" });
106-
110+
107111 assertTrue (config .shouldIgnoreClass ("com.example.Exception$Inner" ));
108112 assertFalse (config .shouldIgnoreClass ("com.example.ExceptionXInner" ));
109113 }
0 commit comments