Tuesday, February 5, 2013

Verifying void methods with Mockito

I had the following problem with Mockito


class MyClass{
 void logSupportingServiceWarn(File dummyFile, String aString){
 }
}

MyClass task = Mockito.spy(new MyClass())
Mockito.never(task.logSupportingServiceWarn(dummyFile, null));

> Java gives the following error :
'void' type not allowed here

Well, this is an issue with Java because it does not allow you to pass in void as a parameter.
Actually it's documented on the website, but I could still not find the exact syntax.

Instead do this :


Mockito.verify(task, Mockito.never()).logSupportingServiceWarn(dummyFile, null);



Monday, February 4, 2013

Java and your security

Over the past few months Java has had some really bad press about security. The good news is you need to have Java running on your machine for most of the security vulnerabilities to be exploited. Applications on servers should not be effected.

Windows, Linux and Mac with Java installed are effected.

It is very important for you and your customers that have Java installed on their machine to have the latest version of Java installed as it contains a lot of patches.

If your customer / you is still running Java 6 please updated to at least Java 6 update 39.
And Java 7 at least update 13.


You can check the version of Java installed here :
http://www.java.com/en/download/installed.jsp