Aspects
I have looked at Aspect-Oriented Programming (and AspectJ) before, and I’ve thought that it seems quite interesting, but also quite complicated. However, today I’ve read about one situation it seems to be really useful.
In an article at XProgramming.com called Virtual Mock Objects using AspectJ with JUNIT, Simon Monk and Stephen Hall is describing how AspectJ can be used to create virtual mock objects. With their “framework” (source code available here) you just have your test case class subclass their ComponentTestCase instead of JUnit’s TestCase. You can then create virtual mock objects by calling setMock(className, methodName, mockResult) (or a couple of alternatives). It’s that simple! You can then use assertCalled() and assertArgumentPassed() to make sure the virtual mock objects are used in a correct manner. (There are more features in there. Check out the article for more details, it’s a good read!)
I guess I have to look further into Aspect-Based Programming at some point. Perhaps when the AspectJ plug-in to Eclipse, called AJDT, is finished (it might be finished already, I’m not sure).
One comment
$75 Replica Rolex Watches sale, Our site provides Rolex replica, replica Rolex Watches, replica breitling, replica Cartier, replica Omega, Tag Heuer Watches. . .more than 100 famous rolex brands" rolex air king rolex datejust rolex day date rolex daytona rolex gmt rolex submariner rolex yachtmaster a lange sohne watches alain silberstein watches bell ross watches breguet watches breitling watches bvlgari watches cartier watches omega watches patek philippe watches