UserAgentImpl implements UserAgent, ProviderScanner { static void appendProperties(final Properties properties, final StringBuilder destination) { final String header = "# --- BEGIN SYSTEM PROPERTIES ---"; final String footer = "# ---- END SYSTEM PROPERTIES ----"; final Set<String> keys = properties.stringPropertyNames(); appendPairs(keys, properties, destination, header, footer); } UserAgentImpl();   UserAgentImpl(final TestableProcessFactory processFactory, final Provider provider, final List<Provider> candidateProviders); @Override Provider findCompatibleProvider(); @Override Provider findCompatibleProvider(final String userAgentProvider); @Override Map<Provider, List<String>> getUnmetProviderRequirements(); @Override boolean hasCompatibleProvider(); @Override boolean hasCompatibleProvider(final String userAgentProvider); @Override AuthorizationResponse requestAuthorizationCode(final URI authorizationEndpoint, final URI redirectUri); static StringBuilder buildUnsupportedMessage(Map<Provider, List<String>> unmetRequirements); static void describeUnmetRequirements(final Map<Provider, List<String>> unmetRequirements, final StringBuilder destination);  }
@Test public void appendProperties_Typical() throws Exception { final StringBuilder sb = new StringBuilder(); final Properties properties = new Properties(); properties.put("name", "v\\a|u/e"); properties.put("ping", "pöng"); properties.put("bing", "(b-o_n.g)"); UserAgentImpl.appendProperties(properties, sb); assertLinesEqual(sb.toString(), "# --- BEGIN SYSTEM PROPERTIES ---", "", "bing=(b-o_n.g)", "name=v\\a|u/e", "ping=p%C3%B6ng", "", "# ---- END SYSTEM PROPERTIES ----" ); }