I am currently studying for the JLPT N3 exam and I come across the following rule that I don't really understand. んだもん
Although it is not identic, according to this link ~もん is
Used to reply dissatisfaction in very casual speech
Which kinds of makes a lot of sense according to the following example from the book：
「どうして食べないの」「だって、まずいんだもん」 (日本語総まとめ N3 p.71)
"Why didn't you eat?" "Because it tastes awful."
However, I don't see how it applies to the following example:
I didn't do well on the test today. I can't complain because I didn't study much.
What is this rule actually used for and how does it take/make sense?
Extra information and links are welcomed
Thank you for your time.
Edit 1: Corrected the mistake mentionned.