What can I do to avoid the upcoming divorce court case?

Be calm. Court cases for divorce can be anxiety provoking to say the least. You may benefit from meeting with a Psychologist to discuss your options, how to respond to certain types of questions or issues.
Try alternative... Not sure where you are in divorce process, or reason you want to avoid court. Alternative dispute resolution includes mediation, collaborative law, to settle most issues out of/before court, if both parties agree. Divorces settled thru mediation and collaboration are much more likely to result in both people feeling ok about the process and comfortable with results. Good resource: afccnet.Org.