When the "name" element of either Root or Data objects either begins or ends with a space, the space is not preserved. This causes the test failure. One of two things will fix this:
1) Change the random string so that it will not begin or end with blanks.
2) Change the marshaling to preserve leading and trailing whitespace.