### Question:
NashornScriptRunner implements Runnable { boolean areSame(String s, String re) { if ("".equals(s)) return false; if (s.equals(re)) return true; if (re.startsWith("/") && (re.endsWith("/") || re.endsWith("/i"))) { boolean ignoreCase = re.endsWith("/i"); String re2 = re.replaceAll("^/|/[i]?$", ""); Pattern pattern = ignoreCase ? Pattern.compile(re2, Pattern.CASE_INSENSITIVE) : Pattern.compile(re2); Matcher matcher2 = pattern.matcher(s); return matcher2.find(); } return false; } 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 testAreSameShouldReturnFalseIfStringIsBlank() { NashornScriptRunner scriptRunner = new NashornScriptRunner(""); assertFalse(scriptRunner.areSame("", "/.*/")); }
@Test public void testAreSame() { NashornScriptRunner scriptRunner = new NashornScriptRunner(""); assertTrue(scriptRunner.areSame("abcd", "/.*/")); assertTrue(scriptRunner.areSame("abcd", "abcd")); assertTrue(scriptRunner.areSame("1234", "/[\\d]*/")); assertTrue(scriptRunner.areSame("/abcd1234/", "/[/]abcd[\\d]*[/]/")); assertTrue(scriptRunner.areSame("ABCd", "/abcd/i")); assertTrue(scriptRunner.areSame("ABCd", "/bc/i")); assertTrue(scriptRunner.areSame("abcd", "/bc/")); assertFalse(scriptRunner.areSame("aBCd", "/bc/")); assertFalse(scriptRunner.areSame("abcd1234", "abcd")); }