Wednesday, 27 April 2016

Debugging Mockito Stubs

I recently ran into an issue whereby the Unit Tests were failing after a raft of dev changes to some of our manager code. My IDE was giving me rather cryptic error messages.

It can be quite tricky to figure out what you have correctly stubbed when using mockito. Doing some digging in the debugger I was able to find the list of methods that have been stubbed out which vastly assists in debugging.

If you follow the tree
CGLIB$CALLBACK_0> handler>mockHandler>invocationContainerImpl>stubbed

You can see the valid stubs.

Tuesday, 31 May 2011

Eclipse: Hints and Tips: Local History : Finding those lost changes

True story ..

Recently I was working on a series of shared files within perforce - the source control system we use in our project. I made a series of changes to some files including a file that I hadn't added to a change-list - oops! A quick sync to update my repository so I can test our app and eclipse starts going mental wavy red underlines all over the place. Yep, I've gone and synced over a file I'd been working on grrr !

I started wondering surely there is a nice in-build way to restore my changes ... enter Eclipse's "Local History".

Then we get the usual diff that you'd expect coming from any version system.

There are lots of other options on configuring how many versions to keep etc.. Happy exploring !

Thursday, 26 May 2011

Eclipse: Hints and Tips: Debugger: NTail - Tailing a log within eclipse

I've been working with a tomcat based web app recently which generates its own logs. Working from within windows I'd be stuck using cygwin to tail my server logs. I found myself wondering if there was a better way to do it. A bit of research later and I can across NTail for eclipse.

Available from certiv its actually quite useful

A point to note once you get the window added to eclipse you need to do the following to configure. It might just be me but I didn't think this was immediately obvious.

There you go lovely logging in the console window !

Wednesday, 25 May 2011

Eclipse: Hints and Tips: Debugger: Logical View

While still getting to know some of the more advanced features of the eclipse debugger I posted an question on stackoverflow.  I was finding when in debug mode I was unable to get an accurate picture of my objects ie anything more complex than a simple primitive.

For example I had the following ..

Map<String, ArrayList<Object>> links

which was being displayed as such

This doesn't make it the easiest way to debug. Thankfully the nice helpful people at SO clued me into the "display logical view". Much better !

Hello O'Reilly

O'Reilly im really interested in helping you guys out with reviews and when I have something to review I'll glady post to here.