If an exception is thrown, but an array is passed, encode it
Remove unneeded test
Remove debug statements
Move test cases into conditions and fail assertions in case where invalid data is returned
Remove cusom exception constructor
Remove file. Add test data helper method