Following QCon presentation of Alexandru Popescu and Cedric Beust on TestNG and TDD I started switching IntellJ Eclipse Dependency Sync plugin to use TestNG.
It was very simple with TestNG IntelliJ plugin which has “Convert JUnit test to TestNG” intention.

JMock integration
One thing I struggled with was JMock integration. Although EasyMock seems to be very popular, many people prefer JMock as it provides more “fluent” interface. I think I am it this camp 🙂

The integration of JMock and TestNG turned out to be very simple:
– test class needs to extend MockObjectTestCase
– make sure that setUp() and tearDown() methods in the super class are called. So you need to override them in your test class and annotate with @BeforeMethod, @AfterMethod.

Some time ago I wrote a plugin for IntelliJ developers who work in Eclipse environment.

This plugin synchronizes content of eclipse .classpath file with IntelliJ libraries. It is quite helpful when your colleagues add/remove some new libraries to the project in Eclipse and you suddenly can not build it.

Unexpectedly in few months plugin has been downloaded over 750 times! Some people even requested new features.

Project Facilities

As project was lacking some structure – documentation, discussion forum, source repository I decided to use Google Code and Google Groups to provide all these facilities.

Heap size

-Xms256m
-Xmx512m

The more the better…

Perm size

IntelliJ likes a lot of memory for caching references and class meta information. That is why we need to make sure that cache is not purged. Cache is stored in “Old Generation” space which size is determined by the following option

-XX:MaxPermSize=200m

200m is good for the size of project I am using. General rule is to observe memory indicator after using find symbol option with include non project files selected. If it doesn’t move you have chosen enough memory.

Maximum Pause

-XX:MaxGCPauseMillis=10

We ask GC to pause the application for no more then 10 milliseconds.

Proportion of free space

-XX:MaxHeapFreeRatio=70

We ask GC to kick off when more than 30% of memory is occupied, so when we start compilation GC will not interfere because it will be enough memory free.

Concurrent Mark-Sweep (CMS) Collector

-XX:+UseConcMarkSweepGC

We want GC to run in parallel with other threads without freezing the application. This option doesn’t stop GC from freezing the application but it reduces it significantly.

Incremental Mode

–XX:+CMSIncrementalPacing

We don’t wont to freeze the application so we do GC incrementally with breaks so the application can take a breath. We use Pacing so GC can learn how to use CPU based on application CPU usage.