### Question:
ParseUserAgent extends PTransform<PCollection<PubsubMessage>, PCollection<PubsubMessage>> { public static ParseUserAgent of() { return INSTANCE; } private  ParseUserAgent(); static ParseUserAgent of(); @Override PCollection<PubsubMessage> expand(PCollection<PubsubMessage> input);  }### Answer:
@Test public void testBrowserBestMatchFirst() { test(browserBestMatch.stream().map(v -> String.join("", v)).collect(Collectors.toList()), browserSingleMatch.entrySet().stream().map(e -> { switch (e.getKey()) { case "Safari": case "Opera": case "Opera Mini": case "Opera Mobi": return ImmutableMap.of(BROWSER, e.getKey(), VERSION, "6"); default: return e.getValue(); } }).collect(Collectors.toList())); }
@Test public void testBrowserBestMatchLast() { test(browserBestMatch.stream().map(l -> String.join("", Lists.reverse(l))) .collect(Collectors.toList()), browserSingleMatch.entrySet().stream().map(e -> { String version = null; switch (e.getKey()) { case "Safari": return ImmutableMap.of(BROWSER, e.getKey(), VERSION, "5"); case "Opera": case "Opera Mini": case "Opera Mobi": return ImmutableMap.of(BROWSER, e.getKey(), VERSION, "7"); default: return e.getValue(); } }).collect(Collectors.toList())); }