• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Does Bear's FrontMan have a mock object for CommandContext?

 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to do some JUnit testing with my FrontMan beans. So I need a minimal CommandContext to subclass for testing.
It does not have to be a full blown HTTP servlet request and respnse object, but it would be nice to have an
AbstractCommandContextForTesting
to start with.

Anybody got one?

Thanks
pat
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CommandContext was designed as an interface exactly so that mock instances could be used for testing. EFH was the person who suggested this, so maybe he has one?

You reading this Ernest?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am reading it now!

I did use that interface for mocking while developing two FrontMan-driven projects. Both times I used EasyMock, which creates the mocks for you -- you just hand it an interface, and tell it what usage pattern you expect to see. EasyMock is pretty darn... easy.
 
Pat Farrell
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hacked up some, it was easy. The CommandContext is trivial, but all of my code calls it get HttpRequest, HttpResponse, HttpSession, etc.
Its not hard, but there are a lot of parts.

Probably not realistic for Bear to provide them, as they have to be tweaked for the calls your class really uses.

After hacking with it, the beauty of Bear's design shows
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the praise, Pat. I can't grab it all for myself, though -- I got some great feedback from devos like EFH!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic