For anyone interested in using DNA for genealogy, I can go into as much detail as you want.But the short answer is that the part of the DNA that we test for genealogy surname projects is called the Y-DNA, and it's only passed down from father to son. That is why it works with surname groups - only the males with that surname have the Y-DNA of their lineage.
So for our genealogy purposes, it makes no difference who Josiah married - her DNA will not show up on the Y-DNA tests.The people who have Josiah's Y-DNA are all of his direct male (BARTLETT) ancestors, and all of their direct male (BARTLETT) descenants - down to the living BARTLETTs from whom we get the Y-DNA.
If two living BARTLETT men have the same Y-DNA results, then they have a common BARTLETT ancestor.If the Y-DNA results are different, then they cannot have a common BARTLETT ancestor. It makes no difference who any of the men in the lines married.
Now if you're curious about Mary BARTLETT, you'd need to trace her daughters and, their daughters, and their daughters, etc., down to living folks that we can test.In this case we'd use the mtDNA, which is only passed from the females to their children - so similar to the Y-DNA, it doesn't matter who these women marry, it only matters that you follow an all female line down to a living person from whom you get the mtDNA sample for testing. Again: if two mtDNA results match, then they share an ancestor, if it doesn't match, they don't.
I'd be happy to answer any specific questions anyone might have about DNA testing.