[OWASP-FILTERS] filters/src/java/test TestBaseFilter.java,1.6,1.7 TestFilterStack.java,1.1,1.2

russcoon at users.sourceforge.net russcoon at users.sourceforge.net
Wed Mar 19 12:37:57 EST 2003


Update of /cvsroot/owasp/filters/src/java/test
In directory sc8-pr-cvs1:/tmp/cvs-serv5642/test

Modified Files:
	TestBaseFilter.java TestFilterStack.java 
Log Message:
fixing the borked pattern removal code in BaseFilter.java, adding tests that actually work for both TestBaseFilter and TestFilterStack


Index: TestBaseFilter.java
===================================================================
RCS file: /cvsroot/owasp/filters/src/java/test/TestBaseFilter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** TestBaseFilter.java	13 Jan 2003 16:27:12 -0000	1.6
--- TestBaseFilter.java	19 Mar 2003 17:37:52 -0000	1.7
***************
*** 28,31 ****
--- 28,32 ----
  		suite.addTest(new TestBaseFilter("testProcess")); 
  		suite.addTest(new TestBaseFilter("testCanonicalize")); 
+ 		suite.addTest(new TestBaseFilter("testPatternStripping")); 
  		return suite;
  	}
***************
*** 62,65 ****
--- 63,73 ----
  		this.bf.SetCharSet("UTF-16");
  		this.bf.SetCharSet("US-ASCII");
+ 	}
+ 
+ 	public void testPatternStripping(){
+ 		bf.AddStripPattern("foo");
+ 		String rstr = bf.Process("foo! bar! baz!");
+ 		// processing should have removed "foo"
+ 		assertEquals(rstr, "! bar! baz!"); 
  	}
  

Index: TestFilterStack.java
===================================================================
RCS file: /cvsroot/owasp/filters/src/java/test/TestFilterStack.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TestFilterStack.java	7 Jan 2003 05:57:22 -0000	1.1
--- TestFilterStack.java	19 Mar 2003 17:37:52 -0000	1.2
***************
*** 36,38 ****
--- 36,51 ----
  	}
  
+ 	public void testAddStripPattern(){
+ 		BaseFilter tbf = new BaseFilter();
+ 		this.fs.AddFilter(tbf);
+ 		this.fs.AddStripPattern("foo","BaseFilter");
+ 	}
+ 
+ 	public void testPatternStripping(){
+ 		BaseFilter tbf = new BaseFilter();
+ 		fs.AddFilter(tbf);
+ 		fs.AddStripPattern("foo","BaseFilter");
+ 		String rstr = this.fs.Process("foo! bar! baz!");
+ 		assertEquals(rstr, "! bar! baz!"); 
+ 	}
  }






More information about the Owasp-filters mailing list