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:
I wonder why this was not in JDK/Groovy Collections. Just put together a Comparator for StackOverflow question – a Groovy Comparator that would sort class field names in the declaration order. Feel free to use: class PropComparator implements Comparator { private Class clazz PropComparator(Class clazz) { this.clazz = clazz } int compare(Object o1, Object o2) […]
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))
A friend of mine defended Fortran against half-literate coders on an example of Prim’s allgorithm. Good pretext for another language comparison. Let’s see Groovy vs Java vs good old Fortran. Great Fortran implementation Great Java implementation by Bruno R. Preiss, P.Eng. and scientist. Some beginner’s C+ implementation (or is it just a link farm? Whatever). […]
Hibernate bug 1895 seems to be still there since 2006. If, for instance, in Grails, such a syntax won’t work for you (it won’t): def books = Book.findAll(“FROM Book AS b JOIN Chapter AS c WHERE c.active = :isActive”) with a NullPointerException in “HqlSqlWalker.createFromJoinElement” — just use alternative join syntax, via WHERE: def books = […]
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 […]