Here you can use Spring's Assert.isInstanceOf(..) which will work regardless of assert support. If the assertion fails, an IllegalArgumentException will be thrown.