1
1
package bugs .stackoverflow .belisarius .filters ;
2
2
3
3
import java .io .IOException ;
4
+ import java .util .List ;
4
5
5
6
import bugs .stackoverflow .belisarius .models .Post ;
6
7
7
8
import static org .junit .jupiter .api .Assertions .assertEquals ;
9
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
8
10
9
11
import org .junit .jupiter .api .Test ;
10
12
@@ -70,5 +72,22 @@ public void hitTest() throws IOException {
70
72
assertEquals (filter4 .isHit (), true );
71
73
// 1 (title) + 1 (edit summary) + 2 (post body) = 4
72
74
assertEquals (filter4 .getTotalScore (), 4.0 );
75
+
76
+ List <String > reasons = List .of (
77
+ "Contains blacklisted word: (?i)(problem|error|issue)\\ s+(re|now\\ s+)?(solved|fixed)" ,
78
+ "Contains blacklisted word: (?:problem|error|issue).{0,10}(?<!n't|not)\\ s+(?:now\\ s+)?fixed(?!\\ W*\\ ?)" ,
79
+ "Contains blacklisted word: (?i)(problem|error|issue)\\ s+(re|now\\ s+)?(solved|fixed)" ,
80
+ "Contains blacklisted word: (?i)(answer -|answer:)"
81
+ );
82
+ List <String > actual = filter4 .getReasonName ();
83
+
84
+ assertTrue (actual .containsAll (reasons ) && reasons .containsAll (actual ));
85
+ assertEquals (
86
+ filter4 .getFormattedReasonMessage (),
87
+ "**Body contains blacklisted words:** (?i)(problem|error|issue)\\ s+(re|now\\ s+)?(solved|fixed), "
88
+ + "(?i)(answer -|answer:) **Edit summary contains blacklisted words:** "
89
+ + "(?i)(problem|error|issue)\\ s+(re|now\\ s+)?(solved|fixed), "
90
+ + "(?:problem|error|issue).{0,10}(?<!n't|not)\\ s+(?:now\\ s+)?fixed(?!\\ W*\\ ?)"
91
+ );
73
92
}
74
93
}
0 commit comments