File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
main/java/org/owasp/esapi/logging/cleaning
test/java/org/owasp/esapi/logging/cleaning Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1717import java .util .ArrayList ;
1818import java .util .List ;
1919
20+ /**
21+ * LogScrubber implementation which performs iterative delegate to an ordered
22+ * List of LogScrubbers. <br>
23+ * The results of the delegate list of LogScrubbers is additive, meaning that
24+ * the the original message is passed to the first delegate and its return value
25+ * is passed to the second (etc). <br>
26+ *
27+ */
2028public class CompositeLogScrubber implements LogScrubber {
21-
29+ /** Delegate scrubbers.*/
2230 private final List <LogScrubber > messageCleaners ;
2331
32+ /**
33+ * Ctr.
34+ * @param orderedCleaner Ordered List of delegate implementations. Cannot be {@code null}
35+ */
2436 public CompositeLogScrubber (List <LogScrubber > orderedCleaner ) {
37+ if (orderedCleaner == null ) {
38+ throw new IllegalArgumentException ("Delegate LogScrubber List cannot be null" );
39+ }
2540 this .messageCleaners = new ArrayList <>(orderedCleaner );
2641 }
2742
Original file line number Diff line number Diff line change 1818import java .util .Arrays ;
1919
2020import org .junit .Assert ;
21+ import org .junit .Rule ;
2122import org .junit .Test ;
23+ import org .junit .rules .ExpectedException ;
2224import org .mockito .Mockito ;
2325
2426
2527public class CompositeLogScrubberTest {
2628
29+ @ Rule
30+ public ExpectedException exEx = ExpectedException .none ();
31+
32+ @ Test
33+ public void testNullListThrowsException () {
34+ exEx .expect (IllegalArgumentException .class );
35+ exEx .expectMessage ("cannot be null" );
36+
37+ new CompositeLogScrubber (null );
38+ }
39+
40+
2741 @ Test
2842 public void testPassthroughOnEmpty () {
2943 String str = "Testing Content" ;
You can’t perform that action at this time.
0 commit comments