When Joseph found out about Mary's pregnancy, he must not have believed that she was pregnant by the Holy Spirit but that she had been unfaithful to him. Even though they were engaged and not married, to break up the relationship, Joseph would have had to divorce Mary. But in a dream, an angel appeared to Joseph and told him to trust Mary. The angel also told Joseph that the child should be called Jesus. Having a vision in a dream from God was a sign of God's approval, so this would have made Joseph pay attention and do what the angel had said!