[ofbiz-framework] branch trunk updated: Improved: Added unit testing, using JMockit, to ensure that form macros are rendered using ids from ModelFormField#getCurrentContainerId.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Added unit testing, using JMockit, to ensure that form macros are rendered using ids from ModelFormField#getCurrentContainerId.

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 322df27  Improved: Added unit testing, using JMockit, to ensure that form macros are rendered using ids from ModelFormField#getCurrentContainerId.
322df27 is described below

commit 322df2750c2cee965159573c6de279bff82f7a06
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sat Mar 21 22:08:00 2020 +0100

    Improved: Added unit testing, using JMockit, to ensure that form macros are
    rendered using ids from ModelFormField#getCurrentContainerId.
   
    (OFBIZ-4035)
   
    Fixes a check issue (line too long)
   
    Notice: on Windows I get 20 errors when compiling:
    > Task :compileTestJava FAILED
    C:\projectsASF\Git\ofbiz-framework\framework\widget\src\test\java\org\apache\
    ofbiz\widget\renderer\macro\MacroFormRendererTest.java:134:
    error: annotation type not applicable to this kind of declaration
            @Mock
            ^
    I guess the change in build.gradle are not enough for Windows, to be seen later...
---
 .../renderer/macro/MacroFormRendererTest.java      | 34 ++++++++++++----------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java b/framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java
index 3eb10c0..6c5f60b 100644
--- a/framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java
+++ b/framework/widget/src/test/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRendererTest.java
@@ -18,14 +18,14 @@
  *******************************************************************************/
 package org.apache.ofbiz.widget.renderer.macro;
 
-import com.google.common.collect.ImmutableMap;
-import freemarker.core.Environment;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import mockit.Expectations;
-import mockit.Mock;
-import mockit.MockUp;
-import mockit.Mocked;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
 import org.apache.ofbiz.base.util.UtilCodec;
 import org.apache.ofbiz.base.util.UtilCodec.SimpleEncoder;
 import org.apache.ofbiz.base.util.UtilHttp;
@@ -34,15 +34,18 @@ import org.apache.ofbiz.webapp.control.RequestHandler;
 import org.apache.ofbiz.widget.model.ModelFormField;
 import org.apache.ofbiz.widget.model.ThemeFactory;
 import org.apache.ofbiz.widget.renderer.VisualTheme;
+import org.hibernate.jdbc.Expectations;
 import org.junit.Before;
 import org.junit.Test;
+import org.mockito.Mock;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Map;
+import com.google.common.collect.ImmutableMap;
+
+import freemarker.core.Environment;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+import mockit.MockUp;
+import mockit.Mocked;
 
 public class MacroFormRendererTest {
 
@@ -92,7 +95,8 @@ public class MacroFormRendererTest {
     }
 
     @Test
-    public void textRendererUsesContainerId(@Mocked ModelFormField.TextField textField) throws IOException, TemplateException {
+    public void textRendererUsesContainerId(@Mocked ModelFormField.TextField textField)
+            throws IOException, TemplateException {
         new Expectations() {{
             httpSession.getAttribute("delegatorName");
             result = "delegator";