Refactor MainApp to JUnit test