Monday, May 4, 2009

DDTUnit snippet to represent a HashMap containing complex objects

As a big fan of DDTUnit for Java unit testing, this gets me every time. I often need a java.util.HashMap object with complex values. Here it is for posterity (and later lookup) :

    <obj id="masterResults" type="java.util.HashMap" 
hint="map" keytype="string" valuetype="">
        <key type="java.lang.String">
            <value type="" hint="call"


The Java code to retrieve it inside the DDTUnit fixture:

    HashMap masterResults = (HashMap) getObject("masterResults");

No comments:

Post a Comment