Whether a law is fair or just is in the eye of the beholder -- it's a matter of opinion. Therefore, when someone violates a law they are subject to whatever punishment the law specifies. It does not matter whether they think the law is just or unjust.
Many people (like Henry David Thoreau or Martin Luther King, Jr) have argued that people should violate laws that they think are unjust. However, such people still must be punished if laws are to have any meaning. If you could break a law just because you say it is unjust, we would be left in a situation of anarchy.
So the short answer to your question is that you get punished just the same no matter whether the law is just or not.