@Test public void testBug1162183Affected() throws Exception { Map<String, String> baseAttributes = ImmutableMap.<String, String>builder() .put(Attribute.DOCUMENT_NAMESPACE, ParseUri.TELEMETRY) .put(Attribute.DOCUMENT_TYPE, "saved-session").build(); assertFalse(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "60.6.1").build())); assertFalse(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "42.1.0").build())); assertTrue(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "39.0.1").build())); assertTrue(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "40.0a2").build())); assertTrue(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "41.0").build())); assertTrue(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "41.0.2").build())); baseAttributes = ImmutableMap.<String, String>builder() .put(Attribute.DOCUMENT_NAMESPACE, ParseUri.TELEMETRY) .put(Attribute.DOCUMENT_TYPE, "first-shutdown").build(); assertFalse(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "60.6.1").build())); assertTrue(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "41.0.2").build())); baseAttributes = ImmutableMap.<String, String>builder() .put(Attribute.DOCUMENT_NAMESPACE, ParseUri.TELEMETRY).put(Attribute.DOCUMENT_TYPE, "main") .build(); assertFalse(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "60.6.1").build())); assertTrue(MessageScrubber.bug1162183Affected(ImmutableMap.<String, String>builder() .putAll(baseAttributes).put(Attribute.APP_VERSION, "41.0.2").build())); }
@VisibleForTesting static boolean bug1162183Affected(Map<String, String> attributes) { final ImmutableSet<String> affectedDocumentTypes = ImmutableSet.of("first-shutdown", "main", "saved-session"); return ParseUri.TELEMETRY.equals(attributes.get(Attribute.DOCUMENT_NAMESPACE)) && affectedDocumentTypes.contains(attributes.get(Attribute.DOCUMENT_TYPE)) && attributes.get(Attribute.APP_VERSION) != null && attributes.get(Attribute.APP_VERSION).matches("^([0-3][0-9]|4[0-1])\\..*"); }
MessageScrubber { @VisibleForTesting static boolean bug1162183Affected(Map<String, String> attributes) { final ImmutableSet<String> affectedDocumentTypes = ImmutableSet.of("first-shutdown", "main", "saved-session"); return ParseUri.TELEMETRY.equals(attributes.get(Attribute.DOCUMENT_NAMESPACE)) && affectedDocumentTypes.contains(attributes.get(Attribute.DOCUMENT_TYPE)) && attributes.get(Attribute.APP_VERSION) != null && attributes.get(Attribute.APP_VERSION).matches("^([0-3][0-9]|4[0-1])\\..*"); } }
MessageScrubber { @VisibleForTesting static boolean bug1162183Affected(Map<String, String> attributes) { final ImmutableSet<String> affectedDocumentTypes = ImmutableSet.of("first-shutdown", "main", "saved-session"); return ParseUri.TELEMETRY.equals(attributes.get(Attribute.DOCUMENT_NAMESPACE)) && affectedDocumentTypes.contains(attributes.get(Attribute.DOCUMENT_TYPE)) && attributes.get(Attribute.APP_VERSION) != null && attributes.get(Attribute.APP_VERSION).matches("^([0-3][0-9]|4[0-1])\\..*"); }  }
MessageScrubber { @VisibleForTesting static boolean bug1162183Affected(Map<String, String> attributes) { final ImmutableSet<String> affectedDocumentTypes = ImmutableSet.of("first-shutdown", "main", "saved-session"); return ParseUri.TELEMETRY.equals(attributes.get(Attribute.DOCUMENT_NAMESPACE)) && affectedDocumentTypes.contains(attributes.get(Attribute.DOCUMENT_TYPE)) && attributes.get(Attribute.APP_VERSION) != null && attributes.get(Attribute.APP_VERSION).matches("^([0-3][0-9]|4[0-1])\\..*"); }  static void scrub(Map<String, String> attributes, ObjectNode json); }
MessageScrubber { @VisibleForTesting static boolean bug1162183Affected(Map<String, String> attributes) { final ImmutableSet<String> affectedDocumentTypes = ImmutableSet.of("first-shutdown", "main", "saved-session"); return ParseUri.TELEMETRY.equals(attributes.get(Attribute.DOCUMENT_NAMESPACE)) && affectedDocumentTypes.contains(attributes.get(Attribute.DOCUMENT_TYPE)) && attributes.get(Attribute.APP_VERSION) != null && attributes.get(Attribute.APP_VERSION).matches("^([0-3][0-9]|4[0-1])\\..*"); }  static void scrub(Map<String, String> attributes, ObjectNode json);  }