Junior doctors are fighting a High Court battle over rest breaks which could cost the NHS millions of pounds.
They claim patients could be at risk and doctors might quit the profession because trusts are failing to monitor trainee medics and make arrangements for them to take breaks in line with their contracts.
In a test case supported by the British Medical Association (BMA), Dr Sarah Hallett says it is the responsibility of trusts to ensure junior doctors have a 30-minute break for every four hours they work.
Dr Hallett, deputy chairwoman of the BMA's junior doctor committee, is also bringing her case on behalf of 20 other doctors who trained with her at the Royal Derby Hospitals NHS Foundation Trust.
She is seeking declarations she says will ensure junior doctors are properly monitored and given breaks according to their contracts, but if she wins the trust could also have to pay £250,000 to her and her fellow trainees.
Lawyers representing the trust told the London court on Tuesday that the potential cost to the NHS as a whole would be dramatic if Dr Hallett's claim succeeds.
Dr Hallett's legal team said the case is of general public importance and of significance across the NHS, because the issues involved are commonplace throughout the country.
John Cavanagh QC, for Dr Hallett, said: "It is the responsibility of trusts to make sure that they do not run overly fatiguing or unsafe rotas.
"It is hoped that it is obvious why it is in the public interest this does not happen.
"Junior doctors who have to work for many hours in very stressful and high-pressure conditions without even a short break will be exhausted and this will potentially lead to risks to patient safety.
"It will also have an adverse effect on the morale and happiness of junior doctors which is both harmful in itself and likely to have negative consequences, for example in junior doctors losing heart and leaving the profession."
He argued trusts have a responsibility to make sure trainees take their regular breaks and are contractually bound to pay junior doctors more if they do not comply with the rules.
Mr Cavanagh added: "It would be quite wrong to place the responsibility on the shoulders of junior doctors, many of whom, like Dr Hallett in 2013, are just out of medical school and are working in their first job.
"If they are faced with extremely heavy workloads and very sick patients, it can be very difficult for junior doctors to take responsibility for the decision to stop what they are doing in order to take a break.
"It is for the employer to take appropriate steps to protect patients and the junior doctors themselves."
Dr Hallett's claim relates to a period in 2013 during a rotation in general surgery at the Royal Derby Hospital, when she was in her first foundation year after leaving medical school.
She accepts she was able to take all of the breaks she was entitled to, but claims the trust's monitoring process should have shown her training group as a whole did not get enough rest periods and therefore should have been paid more.
The trust is rigorously defending the case and says its approach to monitoring junior doctors' shifts complied with their contracts.
Richard Leiper QC, representing the trust, said: "The potential cost to to the trust, let alone to the NHS as a whole, would be dramatic".
He said that, if the court grants the declarations Dr Hallett is seeking, other BMA members could use the ruling to demand further payment from NHS employers.
Mr Leiper argued Dr Hallett's case was based on a misinterpretation of her training contract and the rules governing breaks.
The hearing before Mrs Justice Simler is expected to last four days.