I am Paul Wilson; Mere Complexities Limited, sells my consulting, coaching, and coding services. I am passionate about Agile, particularly Test Driven Development.


Domain Specific Languages - Jmock afterthought

Jmock uses functions with side-effects to build complex expressions. The following tells the mockSingleCustomerCreatorFactory to expect the method create to be called once with the parameters "mendel" and 28; it should return the mockCustomer object:
mockSingleCustomerCreatorFactory.expects(once()).method("create")
.with(eq("mendel"), eq(28)).will(returnValue(mockCustomer));
This provides a DSL, although the limitations of the form make the syntax somewhat awkward. Here is a similar approach used to construct HTML.

0 Comments:

Post a Comment

<< Home

subscribe here subscribe

About me

picture

Conference

Scotland on Rails Organiser

Previous blog posts

Blog archive

Other links: