Added Invalid command exception and test cases