Rights activists say testing is an invasion of privacy
Two ex-officers in Zambia's air force are suing the military, saying they were tested and treated for HIV without their knowledge.
Stanley Kingaipe and Charles Chookole claim they were dismissed for being HIV positive - claims the air force denies.
Mandatory HIV screening is not legal in the military, and the government denies the two men were tested.
Their appearance at Livingstone's High Court is being viewed as a test case regarding mandatory testing for HIV.
The BBC's Jo Fidgen in Lusaka says the issue is contentious in Zambia - with human rights lawyers opposing the practice as an invasion of privacy, but the health minister and some doctors speaking out in favour.
The two men are seeking reinstatement and damages for mental and emotional anguish.
Both were put through medical tests in 2001 that they believed were routine check-ups, after which they were put on medication.
Much later, both men volunteered to be tested for HIV and claim it was only then that they were told that the drugs they had been taking were anti-retrovirals.
In their legal case they claim they were not given counselling or told about the importance of the drugs they had been given.
In court documents, the Zambian government denies the men were tested for HIV.
The papers say the men were discharged because Mr Kingaipe had cancer while Mr Chookole had developed tuberculosis.
Last month Mr Chookole, 41, told the Washington Post he had been unable to find work since his dismissal.
He said: "I was confused. Somebody is telling you you are unfit. But I was dressed in full uniform.
"I did not come before them on a stretcher."
Human rights lawyers - who oppose mandatory testing - are hoping the case will clarify the legality of the practice.
Health Minister Kapembwa Simbao and some doctors have spoken in favour.
They argue that 15% of the population are thought to be HIV-positive too few people are volunteering to be tested.