I would recommend you see your primary care doctor
. This pain can be a sign of a minor issue, or can be a sign of significant problems. Your doctor can take a more thorough history of your illness
as well as perform a physical exam in order to better evaluate this situation.
The first consideration of your symptoms would be a hernia
, as you suggest. A hernia occurs when there is a defect in the abdominal wall so that there is a bulging of the intestines from the abdomen into the scrotum. This can occur as either a direct or indirect hernia (which simply refers to where the defect is). This can occur quite often.
Midsection pain can also be caused by other organs in the area. Kidney stones commonly cause the pain you are describing that also goes from flank to testicle. Often bloody urine is associated with this. Gallstones can cause similar problems. The stomach, pancreas, liver and intestines are also all in the area and could be causing your symptoms. These can all have minor or major ailments.
Talk to your primary care doctor. A quick history, exam and potentially blood tests or imaging of the abdomen can help diagnosis what is causing your symptoms. Good luck!