Testicular pain can be due to injury, infection (Epididymitis or Orchitis) or inflammation, testicular torsion -- most common in young men between 10 and
20 years old, excessive bicycle riding, hernia or kidney
or ureteric stones.
In your case, infection is an important possibility and should be ruled out. The final diagnosis can only be made after a thorough physical examination including examination of the abdomen, scrotum, testicles and rectum.