Skip to content

Got a StackOverflow careers invitation.


They do a pretty cool thing: force you to tell “the truth” — no matter how subjective this term is — as opposed to emasculated official style: what you really did (whatever it means to you); what opensource/published projects did you participate in; Top Stack questions you answered; your professional reading and (sic!) writing. Here […]

Why I don’t like GMock


I don’t like GMock. It’s not as if it was badly written or designed. But it lets you to unit-test dirtier code, tying to method call structure instead of resulting data. For instance, this GMock code can be rewritten:

Couple of Grails tricks to remember: reload scaffolding and fieldValue formatting


Grails doesn’t reload scaffolding on-the-fly if you change local templates. But you can open a Groovy console inside application and run in it: org.codehaus.groovy.grails.scaffolding.view.     ScaffoldingViewResolver.scaffoldedViews.clear() In order to change default g:fieldValue formatting for, say, BigDecimal, have a CustomEditorRegistrar in your resources.groovy, and register custom PropertyEditor: registry.registerCustomEditor(BigDecimal.class, ‘myProperty’,     new OurBigDecimalEditor(BigDecimal.class))

“group by” clause in GORM/HibernateCriteriaBuilder


Just in case someone needs a code snippet. This one groups Prices by PriceProvider and was intended to pick only last 5 values for each PriceProvider – but sadly, it’s impossible without window functions. Which are not supported in Hibernate in any way.

Grails: mocking domain objects in unit tests


We’re trying Grails, Rails-like web application framework for Java. It’s fine, just that Groovy debugger support is, er, imperfect, even in the best Gruoovy IDE – IDEA. And, if you want to unit test, you won’t have fancy domain class methods addTo* – like Customer.addToOrders(). They’re generated by Grails on startup. In order to have […]