You may wish to tell him/her that it came as a surprise, that he/she should have explained what was going on. Doctors have to be good at the medicine and the communication (and business and law and...). That's why they get paid the big bucks.
Since his or her concern is the entire alimentary canal all the way to the anus, it would not be entirely unexpected to have a gastroenterologist check the testicles to be sure there is not something wrong with them that is impacting the anal area. As the above poster says, if a doctor is checking you for abdominal aches and GI problems, if it *were* testicular cancer, you would want to know and would have every right to be angry if the doc hadn't bothered to rule it out. Sorry it was a surprise.
Abdominal ache and GI problems can be symptoms of testicular cancer, which in itself is generally painless. So if the exam concerned stomach pain in a male 15-40, that may have been the reason for it.