### Question:
NestedMetadata { static ObjectNode userAgentFromAttributes(Map<String, String> attributes) { ObjectNode userAgent = Json.createObjectNode(); attributes.entrySet().stream() .filter(entry -> entry.getKey().startsWith(USER_AGENT_PREFIX)) .forEach(entry -> userAgent.put(entry.getKey().substring(USER_AGENT_PREFIX.length()), entry.getValue())); return userAgent; } private  NestedMetadata(); static byte[] mergedPayload(byte[] payload, byte[] metadata); static ObjectNode attributesToMetadataPayload(Map<String, String> attributes); static void stripPayloadMetadataToAttributes(Map<String, String> attributes,
      ObjectNode payload);  }### Answer:
@Test public void testUserAgentFromAttributes() throws Exception { Map<String, String> attributes = ImmutableMap.of("user_agent_browser", "Firefox", "user_agent_version", "63.0", "sample_id", "3", "user_agent_os", "Macintosh"); ObjectNode expected = mapToObjectNode(ImmutableMap.of("browser", "Firefox", "version", "63.0", "os", "Macintosh")); ObjectNode userAgent = NestedMetadata.userAgentFromAttributes(attributes); assertEquals(expected, userAgent); }