Is there a phone number I can use to test sending a text message that fails each time? I am wondering whether I could test my application by sending a text message to a phone number that will always fail.

My idea is to see that my application behaves as expected when the sending of a text message fails. So I was hoping that some phone number could be considered invalid by the SMS system and using that number get a failed reply from the sendTextMessage function.

That way I can relay that error to the user. Having such a bad phone number would be cleaner than having a hack in the application since the hack could end up being a bug.
I've tried this and it's working.
This is related to changing the Message centre number.
Here's what you have to do:


Go to default Messaging app on your phone.
Open settings (generally, the  3-dots button).
Click on SIM 1 or SIM 2 SMS Center.


In Lollipop, Settings > Text Message (SMS) > SMS Service Center >
Your SIM.       
In nougat, Settings > Advanced > SIM 1/SIM 2 SMS Center.

First take a screenshot or note the default number entered and then
change it to any incomplete random number.
Save it by clicking the Tick on Top-right corner and now text
message to any number will fail. Use your numbers to check whether
message is sending or not.


Whenever you want to send text message, just change the number to default.