UserAgentImpl implements UserAgent, ProviderScanner { static void appendVariables(final Map<String, String> variables, final StringBuilder destination) { final String header = "# --- BEGIN ENVIRONMENT VARIABLES ---"; final String footer = "# ---- END ENVIRONMENT VARIABLES ----"; final Set<String> keys = variables.keySet(); appendPairs(keys, variables, 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 appendVariables_Typical() throws Exception { final StringBuilder sb = new StringBuilder(); final LinkedHashMap<String, String> variables = new LinkedHashMap<String, String>(); variables.put("TMPDIR", "/var/folders/2f9992f171054fccabbdb978d49a2511"); variables.put("PATH", "C:/Windows/System32;C:/Windows"); variables.put("HOME", "/hömë/éxàmplè"); UserAgentImpl.appendVariables(variables, sb); assertLinesEqual(sb.toString(), "# --- BEGIN ENVIRONMENT VARIABLES ---", "", "HOME=/h%C3%B6m%C3%AB/%C3%A9x%C3%A0mpl%C3%A8", "PATH=C:/Windows/System32;C:/Windows", "TMPDIR=/var/folders/2f9992f171054fccabbdb978d49a2511", "", "# ---- END ENVIRONMENT VARIABLES ----" ); }