Integrity needs a reason stronger than convenience.
Joseph does not merely say no. He names what would be violated: Potiphar has withheld nothing from him except his wife, and the act would be wrong against God. The chapter gives his own words, not a full account of his inner life. Still, his refusal rests on remembered trust and a moral boundary, not on the risk of being caught.
That matters because private choices often become easier to excuse when no obvious punishment is near. Joseph has access, privacy, and a powerful person inviting him. He answers the situation by widening the frame. What can I get away with is replaced by what kind of betrayal would this be?
Leaving can be an active choice.
The pressure continues day after day. Joseph refuses to lie beside her or even be with her. Later, when she catches his garment, he leaves it in her hand and flees outside. The text does not present a clever speech that solves the danger. It presents distance.
There is a useful limit in that scene. We often praise integrity as if it means standing perfectly still in temptation. But sometimes the available act is less grand: end the conversation, leave the room, give up something you would rather keep. Joseph loses his garment before he loses his boundary.
Integrity does not control the outcome.
Joseph's escape does not protect him from harm. Potiphar's wife tells the household and then Potiphar that Joseph attacked her. She produces the garment as support. Potiphar becomes angry and puts Joseph in prison. The chapter does not say whether Potiphar investigates, doubts her, or knows more than he shows.
This is the hard part of the story. A good act can be followed by a bad outcome, and a false story can travel faster than the truth. Joseph is not shown controlling the accusation. He is shown controlling the one part still open to him: whether he will participate in the act he has refused.