1515 */
1616package org .ocpsoft .rewrite .config ;
1717
18-
1918import org .junit .Assert ;
2019import org .junit .Before ;
2120import org .junit .Test ;
2423import org .ocpsoft .rewrite .event .InboundRewrite ;
2524import org .ocpsoft .rewrite .event .Rewrite ;
2625import org .ocpsoft .rewrite .mock .MockEvaluationContext ;
26+ import org .ocpsoft .rewrite .param .Constraint ;
27+ import org .ocpsoft .rewrite .param .Converter ;
28+ import org .ocpsoft .rewrite .param .ParameterConfigurator ;
29+ import org .ocpsoft .rewrite .param .Transposition ;
30+ import org .ocpsoft .rewrite .param .Validator ;
2731import org .ocpsoft .rewrite .servlet .config .Path ;
2832import org .ocpsoft .rewrite .test .MockInboundRewrite ;
2933
@@ -185,6 +189,37 @@ public void testSubsetAPI() throws Exception
185189 @ Test
186190 public void testWhereAPI () throws Exception
187191 {
192+ ParameterConfigurator configurator = new ParameterConfigurator () {};
193+ Validator <String > validator = new Validator <String >() {
194+ @ Override
195+ public boolean isValid (Rewrite event , EvaluationContext context , String value )
196+ {
197+ return false ;
198+ }
199+ };
200+ Transposition <String > transposition = new Transposition <String >() {
201+
202+ @ Override
203+ public String transpose (Rewrite event , EvaluationContext context , String value )
204+ {
205+ return null ;
206+ }
207+ };
208+ Converter <String > converter = new Converter <String >() {
209+ @ Override
210+ public String convert (Rewrite event , EvaluationContext context , Object value )
211+ {
212+ return null ;
213+ }
214+ };
215+ Constraint <String > constraint = new Constraint <String >() {
216+ @ Override
217+ public boolean isSatisfiedBy (Rewrite event , EvaluationContext context , String value )
218+ {
219+ return false ;
220+ }
221+ };
222+
188223 ConfigurationBuilder .begin ()
189224
190225 .addRule ()
@@ -202,14 +237,16 @@ public void testWhereAPI() throws Exception
202237 .perform (operation )
203238 .where ("p" ).matches ("blah" ).bindsTo (El .property ("whee.glee" ))
204239 .where ("s" ).matches ("oh" ).bindsTo (El .property ("ee.flee" ))
205- .constrainedBy (null ).convertedBy (null ).transposedBy (null ).validatedBy (null )
240+ .constrainedBy (constraint ).convertedBy (converter ).transposedBy (transposition ).validatedBy (validator )
241+ .configuredBy (configurator )
206242 .withId ("id" )
207243 .withPriority (0 )
208244
209245 .addRule ()
210246 .when (Path .matches ("/{p}/{s}" ))
211247 .otherwise (operation )
212- .where ("p" );
248+ .where ("p" )
249+ .configuredBy (constraint ).configuredBy (converter ).configuredBy (transposition ).configuredBy (validator );
213250 }
214251
215252 @ Test (expected = IllegalArgumentException .class )
0 commit comments