Jetif v1.8.0

jetif.handler
Class RandomHandler

java.lang.Object
  extended byjetif.Handler
      extended byjetif.impl.DefaultHandler
          extended byjetif.handler.RandomHandler

public class RandomHandler
extends jetif.impl.DefaultHandler

This class RandomHandler is a handler used to generate pseudorandom integer number as test parameters. This handler only support short, int, long types yet. User should specify a random number with a range in the spec with the format "xxx ~ xxx".

 <param handler="random" type="int">-12 ~ 128</param>
 <param handler="random" type="long">-12 ~ 7234567890</param>
 

Version:
1.0
Author:
Vicky Wang

Constructor Summary
RandomHandler()
          Default Contructor
 
Method Summary
protected  Class getQualifiedClass(String type, Class clazz)
           
 boolean matches(String value, String type, Object obj)
          Indicate an object matches the expected value.
 boolean reusable()
          Indicate that if this handler can be reuse for different object.
 boolean supports(String type, Class clazz)
          Test if a type can be converted to specified class with this handler.
 Object toObject(String value, String type, Class clazz)
          Convert a string value to object of specified class.
 
Methods inherited from class jetif.impl.DefaultHandler
getClass, getWrapperClass
 
Methods inherited from class jetif.Handler
getProperty, getProperty, isInstanceClass, setProperties, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomHandler

public RandomHandler()
Default Contructor

Method Detail

toObject

public Object toObject(String value,
                       String type,
                       Class clazz)
                throws UnsupportedTypeException,
                       ConversionException
Description copied from class: Handler
Convert a string value to object of specified class.

Throws:
UnsupportedTypeException
ConversionException

supports

public boolean supports(String type,
                        Class clazz)
Description copied from class: Handler
Test if a type can be converted to specified class with this handler. Overwrite this method to custom procedure to determine if a type is supported by custom handler. The default implementation return true if the type is not specified, or the target class is assignable from the desired type.


matches

public boolean matches(String value,
                       String type,
                       Object obj)
Description copied from class: Handler
Indicate an object matches the expected value. This method is used to determine if a return value of test method matches the expected value.


reusable

public boolean reusable()
Description copied from class: Handler
Indicate that if this handler can be reuse for different object. The framework will cache all reusable handler, while create a new instance for each object if it can't be reused.
Note: It may be a performance issue if the handler is not reusable.


getQualifiedClass

protected Class getQualifiedClass(String type,
                                  Class clazz)

Jetif v1.8.0

Copyright © 2004,2005 Vicky Wang - All Rights Reserved.