joerghoh commented on code in PR #4:
URL: 
https://github.com/apache/sling-org-apache-sling-scripting-javascript/pull/4#discussion_r1849968020


##########
src/test/java/org/apache/sling/scripting/javascript/internal/ScriptEngineHelper.java:
##########
@@ -43,19 +45,32 @@
 
 /** Helpers to run javascript code fragments in tests */
 public class ScriptEngineHelper {
+
     private static ScriptEngine engine;
-    private static ScriptCache scriptCache = mock(ScriptCache.class);
+
+    @Mock
+    private static ScriptCache scriptCache;
+
+    @Mock
+    private static RhinoJavaScriptEngineFactoryConfiguration configuration;
+
+    @InjectMocks 
+    private RhinoJavaScriptEngineFactory factory;
+
+    public ScriptEngineHelper() {
+        MockitoAnnotations.initMocks(this);
+    }
 
     public static class Data extends HashMap<String, Object> {
     }
 
-    private static ScriptEngine getEngine() {
+    private ScriptEngine getEngine() {
         if (engine == null) {
             synchronized (ScriptEngineHelper.class) {
                 final RhinoMockComponentContext componentContext = new 
RhinoMockComponentContext();
                 final RhinoJavaScriptEngineFactoryConfiguration configuration 
= mock(RhinoJavaScriptEngineFactoryConfiguration.class);
-                RhinoJavaScriptEngineFactory factory = new 
RhinoJavaScriptEngineFactory();
-                Whitebox.setInternalState(factory, "scriptCache", scriptCache);
+                // RhinoJavaScriptEngineFactory factory = new 
RhinoJavaScriptEngineFactory();
+                // Whitebox.setInternalState(factory, "scriptCache", 
scriptCache);

Review Comment:
   Please don't comment the code, but rather remove it. We have the git history 
to restore it if we ever need it again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to