Refactors tests to work around IntelliJ IDEA build issues

Strictly speaking, this refactoring is unnecessary and undesirable, however it is required in order to work around an IntelliJ IDEA issue that prevents IntelliJ from launching Brooklyn (i.e. by launching `BrooklynJavascriptGuiLauncher`)

With these changes, you can create an IntelliJ Run/Debug configuration that launches `BrooklynJavascriptGuiLauncher`. (In order for the GUI to be available, you need to manually set the working directory of the configuration to e.g. `/Users/martin/Documents/brooklyn/usage/jsgui`)

The issues have been raised with JetBrains here: https://intellij-support.jetbrains.com/requests/38167
I'd have included a comment to say that cast is there for IntelliJ. Otherwise it risks being removed by someone (or at least distracting them) at some point in the future.