I was able to solve like this using the escape characters for br, it is missing the ; because it translates it back to
var doc = sample.replace("<br>", "<br>");
Then
var expectedDoc = xmlMapper.readTree(doc);