GeoserverRESTTest.VERSION should never be null in integration tests.

Use it as following:

if (GSVersionDecoder.VERSION.v22.equals(GSVersionDecoder.VERSION.getVersion(VERSION))) {
   layerEncoder = new GSLayerEncoder();
} else if (GSVersionDecoder.VERSION.UNRECOGNIZED.equals(GSVersionDecoder.VERSION)) {
   layerEncoder = new GSLayerEncoder21();
}

It's not so easy but it works. When I'll have some more time I will try to add some methods to make it more comfortable.