### Question:
NashornScriptRunner implements Runnable { protected String getDomainFromStep(String step) { return getFromStep(step, "_sahi._domain"); } NashornScriptRunner(String js);  NashornScriptRunner(SahiScript script);  NashornScriptRunner(SahiScript script, SahiTestSuite suite, TestLauncher launcher, boolean setDefaultReporters);  NashornScriptRunner(); boolean isRunning(); boolean isStopped(); Status getStatus(); void setStatus(Status status); String getBrowserException(); boolean doneStep(String lastId); void execute(); void executeAndWait(); Session getSession(); void setSession(Session session); synchronized String getStepJSON(String derivedName, String windowName, String windowTitle, String domain, String wasOpened); int setStep(String step, String debugInfo); int getMaxCyclesForPageLoad(); void setRecoveryScript(String recoveryScript); void markStepInProgress(String stepId, ResultType type); int getTimeBetweenSteps(); synchronized int setStep(String step, String debugInfo, String type); void run(); void markStepDoneFromLib(String stepId, String typeName, String failureMessage); void setStackTrace(String stackTrace); boolean needsStackTrace(); void markStepDone(String stepId, ResultType type, String failureMessage); int errorCount(); void cancelStepInProgressTimer(); void setVariable(String key, String value); String getScriptFilePath(); String getVariable(String key); boolean hasErrors(); void setStopOnError(boolean stop); int getBrowserRetries(); void setBrowserRetries(int browserRetries); String getBrowserJS(); void setBrowserJS(String browserJS); String getScriptName(); SahiScript getScript(); int getThreadNo(); Report getReport(); void log(String message, String debugInfo, String resultType); void logException(String message, String debugInfo, boolean isError); void incrementErrors(); void logExceptionWithLineNumber(String message, int lineNumber, boolean isFailure); Status getScriptStatus(); void setScriptStatus(Status scriptStatus); boolean isPartOfSuite(); void stop(); String getLogFileNameBase(); String eval(String js); ScriptEngine getEngine();  }### Answer:
@Test public void testGetDomainFromStep() { NashornScriptRunner scriptRunner = new NashornScriptRunner(""); assertEquals("a.example.com", scriptRunner.getDomainFromStep("_sahi._domain('a.example.com')._click()")); assertEquals("x.example.co.in", scriptRunner.getDomainFromStep("_sahi._domain( 'x.example.co.in')._click()")); assertEquals("a.example.com", scriptRunner.getDomainFromStep("_sahi._domain('a.example.com' )._click()")); assertEquals("a.example.com", scriptRunner.getDomainFromStep("_sahi._domain ('a.example.com')._click()")); }