Refactoring MainComponent.Java and setting up a TestUtil.