Fixed applicationContext and added unit test