A defence lawyer has accused schoolboy of "making up a story for his mates" in the trial of a former teacher.

The man, who taught at one of the country's leading schools, has pleaded not guilty to committing an indecent act in June 2013.

He is accused of masturbating in an empty classroom at lunchtime while watching pornography on a school-issue laptop.

He was allegedly spotted by a student looking through a high window, boosted by a mate.

Advertisement

The man's lawyer, Richard Earwaker, questioned the now 17-year-old in the Auckland District Court this afternoon.

The lawyer said the boy saw the pornography on the laptop and "made an assumption" about what the teacher was doing based on that.

"You've made an assumption or made it up," Mr Earwaker said.

"Did you make a story up for your mates?"

Sitting just metres from his former teacher, the boy continually repeated that he was telling the truth.

"What I had seen was true," he said. "I did see him masturbating."

After repeated questions about the location of the classroom, the angle of the desk, the chair and the laptop, an whether the boy was telling the truth, Crown lawyer Nick Webby stepped in saying the questions should end.

The judge agreed and Mr Earwaker sat down.

Earlier today the boy told how he had been looking for the the teacher to discuss a roll issue.

He went to the classroom at lunchtime with a friend, who boosted him up to look into the high window instead of knocking on the door.

The boy, speaking quietly and clearly uncomfortable in the court, said he hadn't expected anyone to be in the room and wanted to check before going in.

When he looked in the window he saw the teacher, who he liked and respected from being in his class the previous year, sitting at the desk looking at a laptop.

"His pants were down somewhat... He was... masturbating," the boy said.

"I could see his hand going up and down," he said.

The boy said he then jumped down from the window and walked off.

"I couldn't think. I was shocked," he said. "I wanted to get away and not see people."

After his friend queried what was wrong, the boy told him. He then went to class and told other students, who advised him to tell a teacher.

The man's name is suppressed at least until the judge-alone trial at Auckland District Court is over.

He denies committing the indecent act but concedes he was watching pornography.

His defence counsel Richard Earwaker also disputes the man was in a public place despite an earlier ruling saying the classroom could be considered public.

The teacher, in his late 40s, appeared at the trial in a suit and sat next to his lawyer taking notes.

The alleged act occurred in June 2013. The man was suspended before resigning the following month.

He was also suspended from teaching by the Teachers Council.

The court heard this morning that nine witnesses will appear before Judge Anne Kiernan, including students who allegedly witnessed the act, the school principal, teachers and police.