Could someone tell me more about the ABLUnit OpenEdge.Core.Assert:isType() method?
The documentation in the Progress Developer Studio doesn't mention this type at all. It only mentions the equals, IsType and isFalse.
Is there an ABLUnit sample project out there that can gives the examples of the use for:
IsType(Input HANDLE, INPUT Openedge.core.datatypeEnum)
IsType(Input Progress.Lang.object[], Input Progress.Lang.Class)
Thanks,
PB
The Assert class contains a bunch of general assertions, some of which are used in places other than the ABLUnit framework, and for other reasons that unit tests. The main other reason is to validation input parameter values.
There are a number of procedure libraries (PL files) in the $DLC/src directory and its children, which contain source that may use various assertions for validation checks. Check out the constructors in the DecisionService class in the OpenEdge.BusinessRules.pl for a quick example. This other use is why these aren't doc'ed.
The IsType and their NotType work either on object references or handles. The former case is possibly simpler to deal with in code via the TYPE-OF() statement or the IsA() method on Progress.Lang.Class, but use the Assert class because it encapsulates the code and the errors thrown if the assertion fails.
The handle types does the same but for handles - this is a little less 'strong' if you will, because of the weak-type nature of handle.
The signatures and comments of the various IsType and NotType methods are
/** Asserts that a handle is valid and of a particular datatype @param phArgument The handle being checked. @param poCheckType The type the handle/variable being checked should be. @param pcName The name of the variable/handle. @throws AssertionFailedError Error thrown if the handle is not valid or not of a particular datatype.*/ method public static void IsType(input phArgument as handle, input poCheckType as DataTypeEnum, input pcName as character): /** Asserts that a handle is valid and of a particular datatype @param phArgument The handle being checked. @param poCheckType The type the handle/variable being checked should be. @throws AssertionFailedError Error thrown if the handle is not valid or not of a particular datatype*/ method public static void IsType(input phArgument as handle, input poCheckType as DataTypeEnum): /** Asserts that a object is valid and of a particular type @param poArgument The Object being checked. @param poType The type the being checked. @throws AssertionFailedError Error thrown if the object is not valid and not of particular type.*/ method public static void IsType(input poArgument as Object, poType as Progress.Lang.Class): /** Asserts that a object extent is valid and of a particular type for each array item @param poArgument The Object being checked. @param poType The type the being checked. @throws AssertionFailedError Error thrown if the object array is not valid any of the array item is not of particular type.*/ method public static void IsType(input poArgument as Object extent, poType as Progress.Lang.Class): /** Asserts that a object is valid and not of a particular type @param poArgument The Object being checked. @param poType The type the being checked. @throws AssertionFailedError Error thrown if the object is not valid and of particular type.*/ method public static void NotType(input poArgument as Object, poType as Progress.Lang.Class): /** Asserts that a handle is valid and not of a particular datatype @param phArgument The handle being checked. @param poCheckType The type the handle/variable being checked should be. @param pcName the identifying name for the AssertionFailedError. @throws AssertionFailedError Error thrown if the handle is not valid or of a particular datatype*/ method public static void NotType(input phArgument as handle, input poCheckType as DataTypeEnum, input pcName as character): /** Asserts that a handle is valid and not of a particular datatype @param phArgument The handle being checked. @param poCheckType The type the handle/variable being checked should be. @throws AssertionFailedError Error thrown if the handle is not valid or of a particular datatype*/ method public static void NotType(input phArgument as handle, input poCheckType as DataTypeEnum):
hth
Is the DataTypeEnum the handle of the type? Or is it the actual type like INT or CHAR?
Is the DataTypeEnum the handle of the type? Or is it the actual type like INT or CHAR?
Flag this post as spam/abuse.