[ 
https://issues.apache.org/jira/browse/WW-5334?focusedWorklogId=877151&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-877151
 ]

ASF GitHub Bot logged work on WW-5334:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Aug/23 10:51
            Start Date: 20/Aug/23 10:51
    Worklog Time Spent: 10m 
      Work Description: kusalk commented on code in PR #731:
URL: https://github.com/apache/struts/pull/731#discussion_r1299355168


##########
plugins/velocity/src/test/java/org/apache/struts2/views/velocity/result/VelocityResultTest.java:
##########
@@ -18,93 +18,100 @@
  */
 package org.apache.struts2.views.velocity.result;
 
-import com.opensymphony.xwork2.XWorkTestCase;
-import junit.framework.TestCase;
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.struts2.junit.XWorkJUnit4TestCase;
 import org.apache.struts2.result.StrutsResultSupport;
 import org.apache.velocity.Template;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
 
-import com.mockobjects.dynamic.Mock;
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.ActionProxy;
-import com.opensymphony.xwork2.util.ValueStack;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.when;
 
+public class VelocityResultTest extends XWorkJUnit4TestCase {

Review Comment:
   Converted this to JUnit4 and Mockito



##########
plugins/velocity/src/test/java/org/apache/struts2/views/velocity/VelocityManagerTest.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.views.velocity;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.util.ValueStack;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.junit.StrutsJUnit4TestCase;
+import org.apache.struts2.views.jsp.ui.OgnlTool;
+import org.apache.velocity.context.Context;
+import org.apache.velocity.tools.ToolContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Properties;
+
+import static 
org.apache.struts2.views.velocity.VelocityManager.KEY_VELOCITY_STRUTS_CONTEXT;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
+
+public class VelocityManagerTest extends StrutsJUnit4TestCase {

Review Comment:
   Doesn't cover everything but it's a start :)





Issue Time Tracking
-------------------

    Worklog Id:     (was: 877151)
    Time Spent: 3h  (was: 2h 50m)

> Misc VelocityManager code cleanup
> ---------------------------------
>
>                 Key: WW-5334
>                 URL: https://issues.apache.org/jira/browse/WW-5334
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Velocity
>            Reporter: Kusal Kithul-Godage
>            Priority: Minor
>             Fix For: 6.4.0
>
>          Time Spent: 3h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to