`org.jvnet.hudson.test.MemoryAssert` would be the proper home for this. I do not think you can freely copy the code from NetBeans, however; would have to write something similar from scratch.