Need advice! I messed up

Long post so I’m sorry in advance! For a year and a half I had a boyfriend (for post purposes we will call him kade) that was in the airforce we started dating while he was in a different state. He got out of the airforce and came back in August 2019 and we worked out for about a month before he broke things off for personal reasons and wanting to get everything in place before he worked on a relationship. About 3 weeks later I met someone else (we will call him James) and we eneded up in a relationship about a month or so later even though I knew I wasn’t over kade. In the beginning of December kade started talking to me again and I broke it off with James. From about December 12 to December 24 I was sleeping with kade. He broke it off again and I went back to James 🤦🏼‍♀️ about January 15th I found out I was pregnant. Thought for sure it was James until my ex texted me saying he thought for sure it was his kid but “if it is give it to James because I already have a kid and now a new girlfriend and I won’t give you dna to see if it is mine”. I’m now 22 weeks but measuring around 24 to 25 weeks. The only reason I am hesitant to do a paternity test is because I’m scared of how James will react if I tell him it’s not his kid. He has a past of being hot headed and he already yells at me all the time for doing what I did in December. He is a good dad and he’s very good to me but has a temper. I need advice on what I should do, if I should get the test, and how to tell James if it isn’t his.