Changed test methods to handle exceptions for invalid datatypes and JSON content