The Bodhisatta was once a student. He had a world-renowned teacher and was at the top of his class. The teacher had a grown-up daughter and wanted to give her in marriage to one of his students, so he decided to test their virtue. He told his students that his daughter was getting married (without saying to who) and said he needed proper dresses and ornaments for her, so they should go steal some. He would not accept anything the owners saw being taken, only things stolen in secret.
All the students brought him things except the Bodhisatta. The teacher asked why he was not helping and the Bodhisatta answered there is no real secrecy in wrong-doing because gods can see everything everywhere. The teacher was pleased with his words and then explained to the students that he had more than enough money to prepare a wedding and this was only a test of their virtue. He told the other students to return the stolen goods and told the Bodhisatta he had won his daughter’s hand.
In the Lifetime of the Buddha
Five hundred friends had heard the Buddha discuss dharma and they renounced the world together to become his disciples. One night, thoughts of desire filled their heads. The Buddha constantly watched over his disciples, the same as a one-eyed man guards his eye, a father his son, and a yak its tail, so he knew about it. He called an assembly and lectured them, explaining there is no secrecy in wrong-doing, and he told them this story as an example. When the Buddha was finished, all five hundred disciples became arahants.
The teacher was an earlier birth of Sariputta, one of the Buddha’s top disciples.