Presenting at Gradle Summit

In a little over a week and a half, I’ll be presenting this session at Gradle Summit in Santa Clara

Single Page JavaScript Webapps … A Gradle Story

Most people ask me why we chose to use Gradle over a JavaScript build tool.  It was a small circumstance that we took this path. Usually most companies begin their new JS project with Grunt or Gulp.  We tried the same path but it was an unfortunate case at the clients site, their firewall that prevented us from using npm to download npm modules.  We tried to get around this but since we already were using Gradle and it could get around the firewall, we put it through its paces.

In addition, the pace of JS build tool momentum is a little ridiculous. Every time I visit a JS meetup there is a new tool on the scene for managing builds. I’m not sure where to invest my time in learning a tool if the flavour of the month changes so regularly.

Many Java projects have picked up Gradle. There is low configuration required to get a build up, but you are allowed to declare more as required to customise the build for your world.  Since many JVM devs are learning Gradle, and have migrated some of their projects to the new build tool, the barrier for a Java dev to use this tool to build projects on other platforms like JavaScript isn’t too hard.

In this talk we’ll cover getting a simple build up for a simple single page JavaScript web app covering the functions that are available in Gradle for processing JavaScript & CSS resources. We’ll look at some cool features you can get by integrating Jetty so that developers can checkout and run the project in an interactive way. Other tricks and tips covered whilst developing our project will be covered.  Finally, grunt and gulp are the two main contenders in the JS build space. We’ll provide a quick overview of how they work and where you’d want to bring these into your build.

If you are in the area and can come to gradle summit, please come along to watch!



Asia Pacific Oracle User Group Leaders Summit 2014

Last week I was in Hong Kong for the APAC Oracle User Group Community Leaders Summit. The summit brings together user group leaders that support Oracle’s products to talk new strategies for the community / user group programs and announcements regarding Oracle’s product direction.  The summit is held yearly but there are others held in the United States (IOUC) and in Europe.

Luxurious venue, great location, tasty food

Ok, so first things first, this is why you really go to conferences.  The conference took place at the Langham Place hotel in Mongkok.  The hotel is well connected to the rest of Hong Kong, the MTR rail system is a short walk from the connecting mall.  Despite Hong Kong having a much more humid climate than our home town of Melbourne, you could avoid the humidity almost entirely.  From air conditioned airport, to taxi, to hotel, you are in A/C for 99% of your travel.  The hotel itself is very comfortable to stay in with great restaurants and a decent bar, ‘the backyard’, for a drink.  BTW, the Spa, Sauna, Gym and rooftop pool are all first class. And I can highly recommend getting a facial there, it will help your skin look its radiant best for when you do your 4 minute pitch later in the week (that’s my wifes recommendation)

Ok enough of the material things with just one note, it seems that one thing user group leaders have in common is that they love to travel.

IMG_0214 IMG_0212


Although I had met many user group leads at conferences like JavaOne and YOW, this was my first user group summit and I hadn’t formally met any user group leaders from this part of the world before.  I wasn’t quite sure how exactly who would be there and how it would play out.

Attendees were from the community, user group leaders and Oracle ACE experts from Taiwan, Japan, China, Hong Kong, Sri Lanka, India, New Zealand and Australia. Product managers, architects and community relations managers from Oracle also attended and gave talks.

The key distinction to make is that the summit is for all of Oracle’s products including Database, Peoplesoft, JD Edwards and Java.

Every time Oracle make an acquisition they attempt to integrate the existing communities within Oracle’s user group program.  You’d think because each product is so different there isn’t much point of having a conference all under the one roof.  But after talking to attendees you quickly realise why. What is common amongst us, apart for love of travel, is that we all lead large communities back home and face common challenges and situations.  We may even overlap the same regions as another Oracle products user group. Without these kind of events, we wouldn’t know who else is in the user group fold.  We could potentially pool resources for conferences or other one off events in future.

Quickly you start to get an appreciation of the beast that is Oracle. It’s not only a database vendor and it’s not just a steward of the JVM platform. Oracle are equally a software vendor that supplies configurable COTS (Commercial off-the-shelf) software, whose users want modern IT products supporting new technologies (BigData, Mobile, Cloud) just like DBA’s and Java programmers do. The difference being rather than provide the low level platform that developers use to build a custom solution, here they are provided a solution already that needs configuring. Governance plays a significant role in these users day to day, but like our user groups, members join to learn more, and find solutions to common problems.


Welcome Reception

Networking, networking, networking was the order of the first evening.  Oracle put on a welcome reception at ‘the backyard’ of the Langham Place where we got to meet the Oracle community team.  Some had been working for Oracle for over 30 years and they all came from different companies acquired by Oracle.  It was great to meet them and put faces to names that I only had dealt with at MelbJVM by email and occasionally phone.

In addition I realised I wasn’t the only Aussie, meeting the lead of the Higher Education User group and the Quest Asia Pacific group – aficionados for some random product called JD Edwards (no it ain’t a paper manufacturer but an ERP solution, learnt a lesson already.)

The networking event was a great way to find the other JUG leaders in the group and talk shop. Turns out that we have quite a bit in common. For example, finding speakers and attendees is one thing. Performing deep freudian psychoanalysis on our communities and the communities of other programming languages to see who would in their right mind want to come to our meetup is another. 🙂

Conference Begins Proper

Day  2 and we get down to business with introductions and a keynote. There is a more formal introduction whereby everybody introduces themselves based off a slide we each prepared a few weeks earlier.  You can tell everyone here has done some public speaking before and most people spin off a few sentences describing what they do, their likes, family and employer. I’m especially impressed with those who come from countries where English isn’t a first language and present about themselves in English (hats off to them).

The Agenda is a mix of Oracle product, upcoming SaaS abilities in their COTS software touching on PaaS and IaaS offerings, a panel discussion on Internet of Things, and then the conference breaks into two tracks – one for Java, another for Oracle Tech & Apps.


The Java track begins with a discussion of the recent Java 8 tour.  India and China have already had their Java 8 roadshows where Oracle PMs and Java Champions have come to visit or at least do remote talks.  A number of JUG leads come up and show pictures from their events and talk about their experiences so far.   Another 2 Jug leads, the Taiwanese JUG and my JUG MelbJVM already rolled our own Java 8 launch events and discuss these.  Getting content has been done by ourselves and our member base.   We’ll be having Oracle down for our formal launch event in June to talk Java 8 and provide an Internet of Things workshop however its also good to have Java product managers tell us that in future they are happy to put us in touch with Java champions to do remote presentations in future – Something we will take them up on.

We then break for lunch, more opportunity to network with Oracle employees.

4 minute pitch

Once back from lunch, we see a set of best practice 4 minute pitches.  These are lightning talks, strictly enforced time limits by punishment of an embarrassingly loud phone buzzer, about how each user group runs their community or something regarding the Oracle products they work with.

I have a 4 minute pitch to give on ‘analysing your meetup group using’.  It worked its way up to a 15 minute deep dive at one stage before being shown the delete slide treatment to get it down to within time.  It goes ok if a little rushed, but it’s a bit of fun and apart from communicating ideas, it also is a way to give the fellow leaders more insight into who you are and what you are doing.

The Colombo JUG’s 4 minute pitch on Hackathons is the standout 4 minute pitch for me that session. Defining what they are, and what they are not, is advice we’ll be taking  home to implement.IMG_0066

Back to the Java track… with a slight detour

We are then shown 55 new things in Java SE 8, which you can find online yourself.  Since I had already seen this before I step into the apps track to see a talk on Oracle’s BigData & Business Analytics. The talks are interesting though I find aimed at a different audience, more high level business focused outcomes versus developer nuts and bolts demos.  It helps me appreciate the different kinds of audiences and the members the respective user groups have in each room.

Something I hadn’t seen before was the next session on Java EE 7 and beyond.  I have to admit to not being much of an EE container user, but the focus on websockets, JSON processing and HTML 5 looks useful.  The fact you can get a lightweight web-only profile container makes me consider these APIs for throwing together a quick server side app… yes, I am still talking about JEE here.

The final talk of the day is on Embedded Java.  This one is definitely aimed at the JUG leads and giving them a perspective on Oracle’s position.  IoT has always been in Java’s DNA since day dot, and well established through JavaME.  Oracle have done a lot of focus improving this position as of late, partnering with Freescale Semiconductor and ARM. The key messaging here is that the hardware manufacturers have realised that building purpose built ICs isn’t viable long term solutions.  Embedded logic, with changeable rules are the play of the day here, and bringing as much of the decision making to the client end of a solution, perhaps evaluating in some intermediary on-premise controller, before notifying a server side/external service for help. This hasn’t been easily possible when all this is developed for single platform C++ environments.

JavaME already runs in some extremely low hardware intensive environments (think 16kB Java Cards), there are already libraries that have the right level of certification for use in secure applications – eg SATSA Security and Trust services JSR177.  Because this certification is already there it can be used in a variety of government applications without having to be done from scratch.  There is even some security application where the device will self destruct if it detects it has been tampered with. Pretty awesome.

I’ve also made a note to look at Oracle Event Processing for Java Embedded – a server-side esque solution that contains Jersey, JavaDB for use in an embedded controller so it can evaluate business logic and decide what events should be forwarded on to a real server to notify the world.

My questions about tooling moving forward are answered positively. Netbeans and ME development should be moving off windows only in the future which will make a lot of MelbJVM members happy. The number of other mobile platforms and CPU’s supported is growing. The JVM can be adapted easily enough to run on other processors.  (Edit: Just recently a MIPS platform build of Java 8 became available.)

In short JavaME – production ready, tested and certified.

The subtle lesson of the Java track for the day that keeps coming in questions and hallway chats is that keep your Java up to date to take advantage of the latest processor architectures.  If you have some app server stuck on Java 6 or 7, those JVMs can only optimise for the CPUs that were in service at the time.  If you buy new servers and deploy your old JVMs to them, even if the servers have new instructions sets, the older JVMs won’t be able to take advantage of them.  This goes for SE, ME and EE. If you want speed, the best way to optimise is to bring your JVM stack up to date.  All the JVM leaders I spoke to had stories of a significant chunk of their production software still on 7 or even 6. All were welcoming of any info that we could bring back to our communities to help our members with ammunition to convince corporate IT of the necessary upgrades.  (Special mention to Sunny of the Hong Kong JUG / Goldmann Sachs for this insight)


Oracle treated us to some delicious Cantonese at the Jumbo floating restaurant. There is a ferry to shuttle you from the pier to the barge and back again.

IMG_0044 IMG_0048 IMG_0049 IMG_0046

Day 3 – Back to the community

This was a single stream and was applicable to everyone:- What was the support offered by Oracle to application user groups and JUGs, and how could we take advantage of it.

More 4 minute pitches

Some more interesting 4 minute pitches arose.  For me the most intersting were:

  • about how the Aussie Peoplesoft/JD Edwards group arranged their exhibitor hall for their upcoming conference based on lessons learnt from a professional showroom designer.
  • Marshall from the Chinese JUG, GreenTea, talking about how JUGs can collaborate.  Their examples certainly inspired me to seek out their JUG and given MelbJVM has already used Google Hangouts to have remote presenters, having us presenting at their JUG and vice versa is a no brainer, especially now that we’ve made the connection in person.
  • Pearl from the Taiwanese Oracle UG community talking about the events they held to help build member interaction. Ukelele playing is popular over there so the ukelele will sit in my mind.  The emphasis was on social events rather than techy ones and certainly influenced me opinion on this.


Oracle can send out speakers to your user group event with enough notice, say about 4 months in advance to be able to lock the event in speakers calendars.  They prefer to find speakers that live in the region rather than fly them out from HQ (USA) where possible.  Oracle is a global company and there are a lot of experts in all corners of the globe.  I know from experience there are a number of Oracle employees with significant contributions to Java libraries and tooling based in Australia already.  That said this is not a hard and fast rule and if you do want the Java luminaries of this world to present in person at your meetup, you just need to make sure you can get enough attendees to make that worthwhile.  The more cities you can get involved the better the chance of increasing that number.  The recent Java 8 China tour was a great example, 400 people in 4 cities.  The upcoming Australia tour beginning this week should be close – at least on a per capita basis 😉

Oracle can also hold events at their facilities with enough notice.  There is some prep work to be done, 4-6 weeks notice again, and finalising the attendee list 48 hrs prior, the event can’t be co-branded with other organisations, but it is good to know it is available.

Finally Oracle can help promote the event on the User groups and community sections of the Java home pages.  That way when people go to download an update to Java or are just browsing for news, the details of the event will come up in the side bar.

The people to get in touch with are the user group events team at Oracle.

OTN and Community

The next talk was all about the Oracle Technology Network, ACE champions and Java Champions.

Oracle have the ACE program for people in the applications side. These are people nominated by Oracle that contribute to the community – writing blogs, authoring books and speaking publicly in support of Oracle and their products.

For Java though, the situation is a little sweeter.  There is the Java Champions Project that have the same level of respect from Oracle as they give to ACE’s.  Like an ACE, a potential champion has to be a leader in the community and a tech luminary. They could also have used Java technology to aid a humanitarian effort or to evangelize others. An example of someone who was down in Melbourne recently, Charles Nutter,  lead of the JRuby project, is a Java Champion for his contributions to the JVM platform (invoke dynamic and continuing work on FFI).

The neat thing that is different to the ACE program is that Oracle doesn’t have a say in who becomes a champion, the Java Champion community peer reviews and decides who to let in. Its an independent group and Oracle acknowledge that there are going to be differing opinions.  Unlike ACE’s, Java champions can write anything about Oracle be it positive, neutral or negative to Oracle’s position on any issue. I for one applaud Oracle for that.

We need you

An interesting statistic was that the AsiaPacific region has the largest number of registered OTN users outside of the USA.  However the number of Java Champions in the region is quite small, only 7% of the global champion community. We need more Java Champions here, because without them, its more difficult to nominate more from the region to add.  It was a subtle hint to all JUG leaders that we need to develop champions in our region.


Keeping in touch

Finally there is some more things Oracle will be doing in the coming months to make it easier for user group leaders to keep in touch.  In the meantime you can check out the twitter hashtag @oracleugs, and look at the user group site .

If you are a JUG lead and haven’t gotten on to it already, sign up to the Jug-leaders list (register for a account 1st), create a placemark for the global map so your JUG is searchable on the site and Oracle have visibility of you, and take a look at the getting started pages on the wiki

Big Takeaways

TL;DR version of this experience

  • I expected to meet a lot of JUG leaders in the region. They are actually nice guys and girls and I perceived them as like minded fellows – which is a nice bonus.
  • There is a world outside of Java in Oracle and we’ve got as much to learn from the applications user community as they do from ours.
  • Asia Pacific has a huge base of Java developers. There is untapped potential with lots and lots of talent that should get out to the rest of the world.
  • There is a language barrier, but its small most of the time.  Meeting people in person helps alleviate these barriers.
  • Oracle are a huge corporate entity with a big user group supporting heart. If you are still living in the past days of the corporate takeover from Sun, that process is now truly done and dusted. Oracle can and does put more effort and dollars into community than Sun ever did.
  • Java Champions get a lot of flexibility afforded to them by Oracle.
  • APAC needs Java Champions. Do you know any?
  • Oracle can help out with promotion, speakers and other things for your events so dont be a stranger and get in touch early when you are planning an event that needs their help.
  • If user groups can partner with each other to drive a tour or conference Oracle will come to the party.
  • If you aren’t on, don’t have an OTN account, not on or the JUG leaders list, then Oracle can’t include you in events like this.  So make sure you get on it!

I’m assisting with the planning for the next International Oracle User Community (IOUC) Leaders conference in September, just before OpenWorld / JavaOne in San Francisco, so to all JUG leads in the APAC region, any feedback on this event or things you want raised in future events, please let me know and I’ll do my best to make sure you’re heard.

Also, the next AsiaPac OUC will is tentatively scheduled for April next year.  I’ll post out details via the usual social networks as details are firmed up for that.

Access restriction: The constructor NotSupposedToUseThisClass() is not accessible due to restriction on required library

So following from my previous post about compiling Java 5 with a Java 6 compiler and the real reason that I am posting today, was to talk about a curly error message I got in Eclipse today.

I had the same Eclipse 3.7 project both on Windows and Mac, but only the Mac version complained with a very unusal message.

sun.misc.Base64 on mac JDK 5

The complaint was against an internal sun.misc.Base64Encoder class which every 2nd Java dev on the internet recommends replacing its internal implementation with an Apache Commons alternative.

Initially I thought it had something to do with the manifest and access restrictions preventing code outside of the jar accessing the internal code – something I recall the JavaPosse talking about from their days of Java Studio. Since it was only isolated to the Mac JDK, perhaps Apple had included these restrictions in the manifest for the classes.jar that these classes were defined.

Turns out it has to do with Eclipse.  I found out that when I add a JRE/JDK in Eclipse, it appears to add Access Rules to a bunch of select classes in the classes jar.  Its a white list.  Anything not there is forbidden.

I don’t know what defines this, and they are ‘non modifiable’ but adding in an access rule at the top leads this to go.

Java Build Path with Access Rules avoided

Looks like this has been tormenting people since Eclipse 3.3

Like rt.jar for like javac

Today I switched an Eclipse project using JDK 6 on OS X to JDK 5.

Even though there are command line tags in javac to produce 1.5 compatible source, the need to use JDK 5 comes into being when implementing interfaces that have grown in the number of methods since Java 5.  A good example is the JDBC classes.  The number of methods in Java 6 versions of the java.sql.Connection interface has grown by at least 6 (look for Since 1.6)

Having the Java 6 rt.jar or classes.jar where that interface resides will expect those new methods to be implemented and lead to a compilation error when you try to build.  On the opposite end, if you blindly start using the latest version of Java, you can easily start using new methods without realising.  Your colleagues will tell you when their 1.5 only environment stops compiling. 🙂

Building Jetty-Ant for Jetty 7

Jetty-ant for Jetty 7 is a hard find.
The documentation is all wrong, but that if you look at the Jetty Developer page they do concede that.
The split between eclipse and codehaus doesnt help either. There are a lot of options to try and search, Maven repo (, other bits in (, eclipse vs hightide release dirs (,…. aaarghh!
To make things extra sucky, the SVN URLs in the doc for where you get jetty-ant have moved too.
After a lot of searching it looks like this one is the key
instead of the one the docs refer to ( ) which 404s.

There are a lot of other resources that are required jetty-integration-project is req’d by the POM.  Its created in the main jetty-7 that I linked above.  Build that first (I only got as far as building the hightide-distribution) but it was enough to download all the required jars to build jetty-ant.  Phew!


in super short

svn co
cd jetty-7
mvn install

… builds a few different things, ultimately fails

cd jetty-ant
mvn install

… great success (now I just have to try it out – found in jetty-anttargetjetty-ant-7.5.0-SNAPSHOT.jar)

EDIT: When I last checked the documentation on the Eclipse documentation notes, it had thankfully been updated with an updated URL to download the ant target directly (18 Dec)


Rick Wagner’s Blog: How to find which .jar a class is in (easily)

Holy heck, I needed this earlier today

Rick Wagner’s Blog: How to find which .jar a class is in (easily).

Makes mention of JBoss’ tattletale utility.

The comments also mention the Java Class Finder plugin for Eclipse (I used the CTRL+SHIFT+T today personally which did the same job)

There is also LibraryFinder plugin for IntelliJ and classjarsearch command line tool to search a directory of Jars for a class.

Junit Kungfu

A great presentation with audio that talks about Junit 4, test naming and other things.  I liked this presentation because it starts expression Behaviour Driven Development concepts without actually using a Behaviour Driven Development Framework.  Additionally its one of the more in-depth presentations covering the new features of JUnit like Rules.

The presenter is John Ferguson Smart who runs testing and agile tools bootcamps around Australia and NZ (as well as elsewhere) so if you are in the vacinity you should consider looking into em.

My notes from the presentation:

Naming tests

Dont use the name testXXX – you aren’t testing methods of your code

You are testing use cases – what should your class be doing

Take out private methods, maybe extract to a separate class and test those separately if they are getting too big.

Use the word should.  Express an outcome

Class Name: When is a behaviour applicable
Method Name: When at is the behaviour testing

Tests become more readable.


Create the test collaborators – Inputs and Expected Outputs (Arrange)

Test the behaviour (Act)

Verify behaviour is correct (Assert)

Extending Hamcrest Matchers

Combine matchers together – hasItem(someOtherHasPropertyMatcherYouPreviouslyDefined)

Create a new matcher –

  1. Extend TypeSafeMatcher<type of thing you are checking against)
  2. Implement Constructor take in  a matcher of expected value
  3. Implement matchesSafely(type of thing you are checking against)
  4. Implement describeTo – decorate the existing test result/matcher description…  description.appendText(“WuzUp!”); matcher.describeTo(Description);
  5. Create a Factory Class for your matchers with static factory methods to return a new matcher
  6. Use It

Multiple asserts per test are bad (see also Integration Tests are a Scam)

You can combine hamcrest matchers into one test

assertThat(itesm, allOf(hasSize(1), hasItem(“java”)));

assertThat(itesm, hasSize(greaterThan(1)));

The error messages will be cleaner too – expect list size of one, and has item java but received <blah>

Parameterized Tests

Usually just one test per Parameterized test class – they get run once

Ways to get test data

Use an xls spreadsheet source

Use Selenium 2’s WebElement to get a webpage

@FindBy(name="HD_EN") WebElement importerName;
@FindBy(name="HD_EA") WebElement importerAddress;
@FindBy(name="HD_ER") WebElement importerRepresentative;

// getters and setters
 // getter return importerName.getValue();

// setter
public void setImporterName(String value) {
     enter(value, into(importerName));

Smoke test to make sure getters and setters are correct


Make sure the annotations aren’t wrong

JUnit Rules

Delete folders after test run

@Rule public TemporaryFolder folder = new TemporaryFolder()
folder.newFile(“a file name”);


accumulate errors rather than fail on first.  This saves having to write 20 different tests with large setup that check 20 things on the same page (eg login and load webpage table then verify each cell)

@Rule public ErrorCollector collector = new ErrorCollector();
// in your test
 collector.addError(new Throwable(“blah”));
collector.addError(new Throwable(“something else”));
collector.checkThat(result, yourMatcher);

The result will show “blah”, “something else” and the result of your failed matcher, as well as fail the test.


When you know something should have a short response time, a DAO for example should be shorter than 1 second

@Rule public MethodRule globalTimeout = new Timeout(1000);
@Test public void catchInfiniteLoopInTest() { for(;;); }

Catch any major issues before they get into production and become embarassing

Verifier Rule

Something that happens after a test is completed, like an assert

Inject behaviour to make JUnit add checks after each test…. kind of like a test post-condition or invariant from Betrand Meyers OO Software construction, but just for the tests themselves.

private List<String> systemErrorMessages = new ArrayList<String>();
public MethodRule verifier = new Verifier() {
    public void verify() {
        assertThat(systemErrorMessages.size(), is(0));

A good example I see would be using it to tie up mock verification calls in EasyMock

Watchman Rule

Called when a test fails or succeeds.  Additional logging perhaps?  How about restarting a GUI, or take a screenshot when a test fails.


Group tests in your own hierarchy based on your classification of the test rather than writing test suites.  Performance tests  that integration tests.  Slow running or fast running tests?

You can setup plain old normal interfaces for your categories, and have them extend each other via subclassing.  There is no Junit annotation here to indicate its an interface for testing, so you can potentially use any interface in your source.  I’m not sure if this is good practice or not, but say you wanted all your DAO tests that implemented a GenericDAO to be tested, you could do this…. or how about test all classes that implements Serializable?

You can annotate a test class, or tests methods with @Category(InterfaceName.class)

When running a category suite however you still need to include the classes to inspect as well as the category name.

@SuiteClasses( { CellTest.class, WhenYouCreateANewUniverse.class })
public class PerformanceTestSuite {}
You can also exclude from a Run and run a
@SuiteClasses( { CellTest.class, WhenYouCreateANewUniverse.class })
public class PerformanceTestSuite {}

But how about scanning your whole test bed?  Can we programmatically inject suite classes and use them with Categories?  At this point it is a limitation unless you want to use a classpath hack.

Parallel Tests

If you have fast IO and multicore (like my new work PC Smile) and well written tests that don’t trodd on each others data.

U use Maven’s surefire 2.5 plugin to achieve this, and say methods, classes or both in parallel.  Classes is probably safer since most people write the test slipping thru later tests in the same class depend on earlier test methods accidentally.


This is a tool for IntelliJ and Eclipse that runs tests when you save your source and tells you if you have failed runs.  I remember twittering about how cool this would be if it existed a while back, and I’m glad I wasnt the only one with this idea and that someone actually implemented it Open-mouthed smile.

Also there was a plugin for IntelliJ called Fireworks but I could never get it to run tests properly on my Windows PC; always complaining about not being able to find a JDK home Sad smile.

This tool seems pretty cheap at $29 for an individual license, I’ll check it out and give it a shot.

What would be super cool is if it worked with Categories mentioned above, to be able to exclude GUI tests from being executed.  There may be a feature in Infinitest that handles it but I’d be keen to see.


I’m traditionally an EasyMock guy but Mockito has always had good buzz.  At my new job we dont actually have a mocking framework yet so I’m keen to give it a look.

Mockito seems to have less verbose setup of tests, something that when learning EasyMock bashed me around a bit – ever forget to get out of record mode and get a green test accidentally.

As per Integration Tests are a scam ypresso recommends, you can verify interactions, verify a method is being called with certain params.

Other Stuff (comments from the Q&A of the presso)

Hibernate mappings – use an in-memory database

FEST asserts – an alternate to Hamcrest that avoids the Generic issues that plague Hamcrest!!! (boy this frustrates me a lot as a Hamcrest user)

Cobertura – a code coverage tool, alternate to Emma

Private methods shouldn’t be tested explicitly – you should be able to sufficiently test a class by its public facing API.

Testing Presentations

Their has been a presentation I watched last year that absolutely changed my opinion on how I tested and how I designed.  It was one of those presentations that just made sense and I cant believe I haven’t blogged about it until now.

Integration Tests are a Scam by Joe Rainsberger

This was my favourite presentation from last year. It talks about writing the correct type of unit tests to get get fast results and reduce the need for slower integration tests that are generally slower are require a lot of maintenance. He makes a compelling argument about the number of tests in your system don’t improve the sense of security you get from your tests by the same amount. So he talks about what needs to be unit tested from the contract class and the opposite collaborator class and how doing so gives you a better picture of what tests you need to give you a sense of security with quick feedback. The blurb explains it better

Integration tests are a scam. You’re probably writing 2-5% of the integration tests you need to test thoroughly. You’re probably duplicating unit tests all over the place. Your integration tests probably duplicate each other all over the place. When an integration test fails, who knows what’s broken? Learn the two-pronged attack that solves the problem: collaboration tests and contract tests.

TDD of Asynchronous Systems

This presentation by the author of a new book, “growing object oriented software, guided by tests” Nat Pryce, which talks about testing at the integration/functional level and techniques to get around all the painful ‘flickering tests’ & ‘false positives’ issues that occur when you have them. The examples talk about testing legacy systems, swing gui’s and JMS queues.

One of the key ideas is that one must find a point to synchronise on before executing the assertions and those assertions must wait (and retry if not true) until the state has changed or a timeout occurs (and the test then fails)

As a user of UISpec4j with its Assertions that have a timeout, and some perilious test code when someone innocently mixed junit assertions with a UI test, I could relate to this really well.