Use grovvy scripts for integration test.

Runs way faster than bsh and there is actually IDE support.
Add more integration tests for switch behaviour.
Start refactoring the duplicate checking code.