Spring Framework’s ModelAndView word
I was a doing a little Spring MVC a few weeks ago, reading the docs, yet again. One thing that irked me a bit with Spring is the “ModelAndView” term. Couldn’t they have found a better word to capture...
View ArticleSimple Java Data File
In a prior post “A very simple data file metaformat” I presented an idea for an INI type of file and used an example implementation in the Groovy language. I rewrote it in Java. One change was the use...
View ArticleJava JMockIt mocks via Spring DI
How to use Dependency Injected mock objects to allow Integration Testing of a Java application. When working with some legacy code bases, the introduction of Dependency Injection has limitations. Thus,...
View ArticleJava Generics Example: Jar Manifest
How do you write a generic filter that can be used while iterating a data file? On the way to listing the Jar manifest file I decided to hone my skills with Generics. Jar metadata A Java jar file is...
View ArticleList sorting using topological ordering of a digraph
By creating a pseudo weighted directed graph on a list of elements, it is possible to apply graph algorithms to the sorting problem. This offers an alternative to approaches such as QuickSort or Merge...
View ArticleSemantic Versioning of software components?
Saw that Apache Isis is adopting “Semantic Versioning” The SamVer doc states that, of course, it is not a new thing, just more rigor. Interesting that OSGI already had a Semantic Versioning position....
View ArticleJava testing using XStream, AspectJ, Vsdf
Problem A unit or integration test may require the creation of complex object structures. This is even more problematic in legacy systems that were not created with testability in mind. Faced with...
View ArticleJava Reflection Method Invoke Using Fluent Interface
Here is an example of creating a fluent builder interface for invoking a method via Java Reflection. While the code to invoke Java methods via reflection is not complex, it can be improved. We can...
View ArticleIn Eclipse, search for all text in current file?
Many good editors, especially graphical based ones, allow the user to search the current file for all occurrences of a text string. Some will offer to highlight the text, others will use a search...
View ArticleJMockIt method not found in type when using Invocation arg
Strange I was writing a very simple JUnit test using JMockIt. But, it has a compile error. I wanted to also invoke the original mocked target object in the test. In the state based Mockup API one does...
View ArticleChanging Java Logging Levels At Runtime
How to control Java Logger runtime levels? There are many approaches and each logging framework has their own peculiarities. This information is readily available, but surprisingly not many examples...
View ArticleTesting Groovy with Nested Test Classes
The Groovy language allows testing with inline code, it provides the built-in JUnit, Mock, stubs, and other support. Presented here are two simple ways of embedding a JUnit test class inside a Groovy...
View ArticleParsing files using Groovy closures
At work I recently created a Groovy automation script that parsed FTP log files and generated a web based report. This script was then added as a scheduled job in the open-source Jenkins continuous...
View ArticleUse truthy falsey booleans in Java
Some scripting languages such as PHP, JavaScript, and Groovy allow the use of object reference in a conditional context. They have a standard boolean coercion for certain objects or references,...
View ArticleJGit Examples?
On a StackOverflow question asking about example source code, one answer pointed to a very good resource: jgit-cookbook. JGit is a lightweight pure Java library implementing the Git version control...
View ArticleJava ‘hello world’ using RxJava library
A simple RxJava example that uses an array of strings and combines them to create the traditional first program. RxJava is a NetFlix open source library that they developed as part of optimizing their...
View ArticleSet Java console output to “fine” logging level
While coding a Java module I used java.util.logging output at the INFO level in the code to help development. This info is useful only during development. Are these output statements removed when...
View ArticleUnable to dock detached Eclipse Console window
When the Eclipse IDE ‘breaks’ it seems to be unfixable. Like right now. I detached the Console view window via dragging onto another monitor. Done with it. Now I can’t dock the Console again inside the...
View ArticleEnum to Switch on Class types in Java and Groovy
The Java Switch statement is usually considered a code smell since it’s use can be eliminated by better use of Object Oriented Programming (OOP) design. Nowhere is this more apparent than with a...
View ArticleGroovy template fails if language keywords used
While using the SimpleTemplateEngine to process a template with a “$package” expression I got an error. Rename this expression to “$pack” and it works. Puzzling. Then I looked at the source code for...
View Article