So, did God require Joseph to refrain from adultery or not?
Did God say to Joseph "thou shalt not commit adultery?"
Judah committed adultery bigly, did that remove him from the roll of God's elect?
It was Joseph himself who cried "how can I do such a thing?" He was a man touched by God, he had God's call upon his life, God's overflowing blessings, God's vision, God's dreams .... how then will such a man sin against his master Potiphorus [sic] and against God.
That's how it is with us. We have been born again, God's call is upon our lives, we have His joy, His peace, His blessings. We have God's vision, God's dreams.
How then shall we sin against our neighbour or against God?
Change your mind, the way you think ...