Hello,
Testicular pain can be due to injury, infection (
Epididymitis or Orchitis) or inflammation, testicular torsion( most common in young men), excessive bicycle riding, hernia,varicocele or kidney or ureteric stones.
Since you are having testicular swelling as well as pain, so it can be epididymitis or orchitis.In cases of hernia, a prominent bulge along with testicular pain is there and in cases of kidney or ureteric stones, pain during micturition may also be there.