He was subsequently charged with indecent assault and both parties were granted name suppression.
Defence counsel major Peter Brock said the groping was completely denied by the defendant.
"He did not grab her, or slap her or touch her on the buttocks," he said.
"Someone may have; he doesn't know that. But it wasn't him."
On the night in question, the commander was responsible for the smooth running of the function and was looking after other military top brass in attendance.
Major Brock said the allegations therefore made no sense.
"It's patently implausible a senior member of the Navy . . . and host of a VIP would do something like this," he said.
But prosecutor Chris Griggs called it a case "about a failure of leadership and comradeship".
"It's about a senior officer . . . who abused his authority who indecently assaulted a junior officer at a social event."
Mr Griggs accepted the nature of the assault was at the lower end of the scale but it was significantly aggravated by the alleged repetition of the act and the disparity in rank.
"The accused's actions were a fundamental betrayal of the trust that must exist between men and women that serve in a modern defence force," Mr Griggs said.
"It strikes to the heart of what it means to be a leader."
At the start of the week the lieutenant told the court about what happened in the bar.
"The first one was quite a deep feel. The other smaller ones were pinches I guess," she said.
She told the court she was sure the defendant was the one responsible.
"There wasn't anybody else behind me . . . there wasn't anybody else that acknowledged I turned around," she said.
"I said 'hey' . . . he gave me a sly look back and a laugh."