Refactored some tests and add Tests for Application and ShutdownHook