how do I explain this?!

Basically I fell pregnant when I was 15, I was very young and stupid. I was in a relationship at the time (let's call him James) but also seeing his best friend (let's call him David) behind his back, I told James everything and he decided he would step in and play the farther role knowing their is 50/50 chance. My little girl is now 4 and I've since split with James, he is now wanting to do a DNA test. I'm so scared to do one for the pure fact I might have to explain to my 4 year old that her dad isn't her dad?! How am I meant to do that? Please no nasty comments I fully understand how stupid I was back then and wish I could change how things worked out but I can't.
❌❌1)I'm definitely doing the DNA test this is simply for advice regarding my daughter. 
❌❌2) my ex James and David both knew from the start or the pregnancy. 
❌❌3)James doesn't want to be involved if the DNA test comes back she isn't his.