File tree Expand file tree Collapse file tree 5 files changed +139
-0
lines changed
src/test/java/org/owasp/esapi/waf/actions Expand file tree Collapse file tree 5 files changed +139
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .owasp .esapi .waf .actions ;
2+
3+ import static org .junit .Assert .assertFalse ;
4+ import static org .junit .Assert .assertTrue ;
5+
6+ import org .junit .Test ;
7+
8+ public class ActionTest {
9+
10+ @ Test
11+ public void assertDefaultState () {
12+ Action uit = new Action () {};
13+ assertTrue (uit .failedRule ());
14+ assertTrue (uit .isActionNecessary ());
15+ }
16+
17+ @ Test
18+ public void assertSettersGetters () {
19+ Action uit = new Action () {};
20+ uit .setActionNecessary (false );
21+ uit .setFailed (false );
22+ assertFalse (uit .failedRule ());
23+ assertFalse (uit .isActionNecessary ());
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ package org .owasp .esapi .waf .actions ;
2+
3+ import static org .junit .Assert .assertTrue ;
4+
5+ import org .junit .Test ;
6+
7+ public class BlockActionTest {
8+
9+ @ Test
10+ public void assertDefaultState () {
11+ BlockAction uit = new BlockAction ();
12+ assertTrue (uit .failedRule ());
13+ assertTrue (uit .isActionNecessary ());
14+ }
15+
16+ @ Test
17+ public void assertSettersGetters_DO_NOTHING () {
18+ BlockAction uit = new BlockAction ();
19+ uit .setActionNecessary (false );
20+ uit .setFailed (false );
21+
22+ //Beautiful....
23+ assertTrue (uit .failedRule ());
24+ assertTrue (uit .isActionNecessary ());
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ package org .owasp .esapi .waf .actions ;
2+
3+ import static org .junit .Assert .assertTrue ;
4+
5+ import org .junit .Test ;
6+
7+ public class DefaultActionTest {
8+
9+ @ Test
10+ public void assertDefaultState () {
11+ DefaultAction uit = new DefaultAction ();
12+ assertTrue (uit .failedRule ());
13+ assertTrue (uit .isActionNecessary ());
14+ }
15+
16+ @ Test
17+ public void assertSettersGetters_DO_NOTHING () {
18+ DefaultAction uit = new DefaultAction ();
19+ uit .setActionNecessary (false );
20+ uit .setFailed (false );
21+
22+ //Beautiful....
23+ assertTrue (uit .failedRule ());
24+ assertTrue (uit .isActionNecessary ());
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ package org .owasp .esapi .waf .actions ;
2+
3+ import static org .junit .Assert .assertFalse ;
4+ import static org .junit .Assert .assertTrue ;
5+
6+ import org .junit .Test ;
7+
8+ public class DoNothingActionTest {
9+
10+ @ Test
11+ public void assertDefaultState () {
12+ DoNothingAction uit = new DoNothingAction ();
13+ assertTrue (uit .failedRule ());
14+ assertFalse (uit .isActionNecessary ());
15+ }
16+
17+ @ Test
18+ public void assertSetGetFailed () {
19+ DoNothingAction uit = new DoNothingAction ();
20+ uit .setFailed (false );
21+ assertFalse (uit .failedRule ());
22+ }
23+
24+ @ Test
25+ public void assertSetGetActionNecessary_DOES_NOTHING () {
26+ DoNothingAction uit = new DoNothingAction ();
27+ uit .setActionNecessary (true );
28+
29+ // Room for improvement.
30+ assertFalse (uit .isActionNecessary ());
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ package org .owasp .esapi .waf .actions ;
2+
3+ import static org .junit .Assert .assertEquals ;
4+ import static org .junit .Assert .assertFalse ;
5+ import static org .junit .Assert .assertNull ;
6+ import static org .junit .Assert .assertTrue ;
7+
8+ import org .junit .Test ;
9+
10+ public class RedirectActionTest {
11+
12+ @ Test
13+ public void assertDefaultState () {
14+ RedirectAction uit = new RedirectAction ();
15+ assertTrue (uit .failedRule ());
16+ assertTrue (uit .isActionNecessary ());
17+ assertNull (uit .getRedirectURL ());
18+ }
19+
20+ @ Test
21+ public void assertSettersGetters () {
22+ RedirectAction uit = new RedirectAction ();
23+ uit .setActionNecessary (false );
24+ uit .setFailed (false );
25+ uit .setRedirectURL ("http://going_nowhere.com" );
26+ assertFalse (uit .failedRule ());
27+ assertFalse (uit .isActionNecessary ());
28+ assertEquals ("http://going_nowhere.com" , uit .getRedirectURL ());
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments