Fix CTS tests broken by the switch to OpenJDK code

This commit includes a refactoring to avoids relying on the same
DateFormat instance when parsing multiple strings.
Due to bug 27760434 the Android SimpleDateFormat does not currently
reset the calendar timezone after a parse() which
can cause test state to leak from one test to another. Explicitly
creating / providing a new SimpleDateFormat instance to use for
parsing and formatting also makes the tests clearer.

Two actual fixes:

1) Explicitly creating a new format in assertParse() fixes
test_parseLjava_lang_StringLjava_text_ParsePosition, which used
to work because the timezone was reset after a parse. Bug 27760434
has been created to follow up and potentially revert the
SimpleDateFormat to the old Android behavior.

2) test_parse_W_w_dd_MMMM_yyyy_EEEE no longer tests that parsing
"3 12 10 March 2002 Monday" results in the expected date. The
pattern includes multiple indicators of day and month and the
resulting Date is an indication of the internal implementation more
than a meaningful result. There are numerous other tests that
involve similar patterns but only this one actually broke.

Bug: 26023857
Bug: 27158550
Bug: 27760434
(cherry picked from commit 1a01a6513ffe17389a1f32d4416166741a6973a4)

Change-Id: I1f333505a5d16ce23b2ff47f0189b112b34f4a3a
1 file changed