testing HUD

Charles Crouch ccrouch at redhat.com
Sun Aug 21 04:16:58 UTC 2011


Further to the discussion on Friday afternoon around how to test HibernateDetachUtility, it doesn't seem to need an additional mock testing framework. I've attached a 17 line patch to HibernateDetachUtility which seems to do the trick of letting you swap out implementations of hash code generation. Also attached is HDUTest which is a 23 line (main method) test which at least according to my debugging, once TestHashCodeGenerator is being used, exercises during its execution all of the different code paths under:

 } else {
            // we have a situation where multiple objects have the same identity hashcode, work with our
            // collision map to decide whether it needs to be scrubbed and add if necessary.
            // Note that this code block is infrequently hit, it is by design that we've pushed the extra
            // work, map, etc, involved for this infrequent case into its own block. The standard cases must
            // be as fast and lean as possible.
 ...
 }

Hopefully this could be useful in writing tests to confirm HibernateDetachUtility acts as we expect it to.

Thanks
Charles
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HDUTest.java
Type: text/x-java
Size: 800 bytes
Desc: not available
Url : https://fedorahosted.org/pipermail/rhq-devel/attachments/20110821/9fe036e7/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HibernateDetachUtility.patch
Type: text/x-patch
Size: 572 bytes
Desc: not available
Url : https://fedorahosted.org/pipermail/rhq-devel/attachments/20110821/9fe036e7/attachment-0003.bin 


More information about the rhq-devel mailing list