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 17
17
import java .util .ArrayList ;
18
18
import java .util .List ;
19
19
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
+ */
20
28
public class CompositeLogScrubber implements LogScrubber {
21
-
29
+ /** Delegate scrubbers.*/
22
30
private final List <LogScrubber > messageCleaners ;
23
31
32
+ /**
33
+ * Ctr.
34
+ * @param orderedCleaner Ordered List of delegate implementations. Cannot be {@code null}
35
+ */
24
36
public CompositeLogScrubber (List <LogScrubber > orderedCleaner ) {
37
+ if (orderedCleaner == null ) {
38
+ throw new IllegalArgumentException ("Delegate LogScrubber List cannot be null" );
39
+ }
25
40
this .messageCleaners = new ArrayList <>(orderedCleaner );
26
41
}
27
42
Original file line number Diff line number Diff line change 18
18
import java .util .Arrays ;
19
19
20
20
import org .junit .Assert ;
21
+ import org .junit .Rule ;
21
22
import org .junit .Test ;
23
+ import org .junit .rules .ExpectedException ;
22
24
import org .mockito .Mockito ;
23
25
24
26
25
27
public class CompositeLogScrubberTest {
26
28
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
+
27
41
@ Test
28
42
public void testPassthroughOnEmpty () {
29
43
String str = "Testing Content" ;
You can’t perform that action at this time.
0 commit comments