### Question:
SolarisScriptOnConnector { public static String quoteForDCLWhenNeeded(String unquoted) { boolean quote = !ANY_WORD_CHARACTER_PATTERN.matcher(unquoted).matches(); if (unquoted.length() == 0) { quote = true; } if (!quote) { return unquoted; } return quoteAndEscape(unquoted, '\'', ESCAPE_CHARS, QUOTING_TRIGGER_CHARS, "'\\%s'", true); } SolarisScriptOnConnector(SolarisConnector solarisConnector); @SuppressWarnings("fallthrough") Object runScriptOnResource(ScriptContext request, OperationOptions options); static String quoteForDCLWhenNeeded(String unquoted); static String quoteAndEscape(String source, char quoteChar, final char[] escapedChars,
            final char[] quotingTriggers, String escapePattern, boolean force); static String escape(String source, final char[] escapedChars, String escapePattern);  }### Answer:
@Test public void testQuoteForDCLWhenNeeded() throws Exception { assertEquals(quoteForDCLWhenNeeded("poweroff"), "poweroff"); assertEquals(quoteForDCLWhenNeeded("`poweroff`"), "'`poweroff`'"); assertEquals(quoteForDCLWhenNeeded("poweroff' && poweroff && export ARG='poweroff"), "'poweroff'\\'' && poweroff && export ARG='\\''poweroff'"); assertEquals(quoteForDCLWhenNeeded("'1' && poweroff && B='2'"), "''\\''1'\\'' && poweroff && B='\\''2'\\'''"); }