Bug 527605: update jmockit to more recent version (CQ: 14740/8545)

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/moxy/eclipselink.moxy.test/.classpath b/moxy/eclipselink.moxy.test/.classpath
index 47f3ab0..80d66a4 100644
--- a/moxy/eclipselink.moxy.test/.classpath
+++ b/moxy/eclipselink.moxy.test/.classpath
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
+	<classpathentry kind="var" path="EXTENSION_LIB_EXTERNAL/jmockit-1.35.jar" sourcepath="/EXTENSION_LIB_EXTERNAL/jmockit-1.35-sources.jar"/>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="resource"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
@@ -22,7 +23,6 @@
 	<classpathentry kind="var" path="ECLIPSELINK_HOME/plugins/javax.validation_1.1.0.v201304101302.jar"/>
 	<classpathentry kind="var" path="ECLIPSELINK_HOME/plugins/jaxb-xjc_2.2.11.v201407311112.jar" sourcepath="/ECLIPSELINK_HOME/plugins/jaxb-xjc.source_2.2.11.v201407311112.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.persistence.moxy.dynamicxjc"/>
-	<classpathentry kind="var" path="EXTENSION_LIB_EXTERNAL/jmockit-1.10.jar" sourcepath="/EXTENSION_LIB_EXTERNAL/jmockit-1.10-sources.jar"/>
 	<classpathentry kind="var" path="EXTENSION_LIB_EXTERNAL/hibernate-validator-5.1.0.Final.jar"/>
 	<classpathentry kind="output" path="classes"/>
 </classpath>
diff --git a/moxy/eclipselink.moxy.test/antbuild.properties b/moxy/eclipselink.moxy.test/antbuild.properties
index 3171034..25c9d1b 100644
--- a/moxy/eclipselink.moxy.test/antbuild.properties
+++ b/moxy/eclipselink.moxy.test/antbuild.properties
@@ -64,7 +64,7 @@
 classmate.jar=classmate-1.0.0.jar
 
 #JMockit
-jmockit.jar=jmockit-1.10.jar
+jmockit.jar=jmockit-1.35.jar
 
 #JaCoCo
 jacocoagent.jar=jacocoagent.jar
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlidref/XmlIdSystemPropertyNotSetTestCase.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlidref/XmlIdSystemPropertyNotSetTestCase.java
index 7baeb5d..cc197a3 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlidref/XmlIdSystemPropertyNotSetTestCase.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlidref/XmlIdSystemPropertyNotSetTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017 Oracle and/or its affiliates. All rights reserved.
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
  * which accompanies this distribution.
@@ -36,13 +36,13 @@
 public class XmlIdSystemPropertyNotSetTestCase {
 
     @Test
-    public void testSystemXmlIdExtensionNotSet(final @Mocked({"isXmlIdExtension", "getActualType"}) Property property, final @Mocked({"isAnnotationPresent"}) Helper helper, final @Mocked JavaClass javaClass) {
+    public void testSystemXmlIdExtensionNotSet(final @Mocked Property property, final @Mocked Helper helper, final @Mocked JavaClass javaClass) {
         new Expectations(System.class) {{
-            property.getActualType(); returns(javaClass);
-            javaClass.getQualifiedName(); returns("java.lang.Integer");
-            System.getProperty("org.eclipse.persistence.moxy.annotation.xml-id-extension"); returns("false");
-            helper.isAnnotationPresent((JavaHasAnnotations)any, XmlIDExtension.class); returns(false);
-            property.isXmlIdExtension(); returns(false);
+            property.getActualType(); result = javaClass;
+            javaClass.getQualifiedName(); result = "java.lang.Integer";
+            System.getProperty("org.eclipse.persistence.moxy.annotation.xml-id-extension"); result = "false";
+            helper.isAnnotationPresent((JavaHasAnnotations)any, XmlIDExtension.class); result = false;
+            property.isXmlIdExtension(); result = false;
         }};
 
         AnnotationsProcessor processor = new AnnotationsProcessor(helper);
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlidref/XmlIdSystemPropertyTestCase.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlidref/XmlIdSystemPropertyTestCase.java
index 12bf189..a41fbea 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlidref/XmlIdSystemPropertyTestCase.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlidref/XmlIdSystemPropertyTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017 Oracle and/or its affiliates. All rights reserved.
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
  * which accompanies this distribution.
@@ -31,11 +31,11 @@
 public class XmlIdSystemPropertyTestCase {
 
     @Test
-    public void testSystemXmlIdExtensionSet(final @Mocked Property property, final @Mocked({"isAnnotationPresent"}) Helper helper, final @Mocked JavaClass javaClass) {
+    public void testSystemXmlIdExtensionSet(final @Mocked Property property, final @Mocked Helper helper, final @Mocked JavaClass javaClass) {
         new Expectations(System.class) {{
-            property.getActualType(); returns(javaClass);
-            javaClass.getQualifiedName(); returns("java.lang.Integer");
-            System.getProperty("org.eclipse.persistence.moxy.annotation.xml-id-extension"); returns("true");
+            property.getActualType(); result = javaClass;
+            javaClass.getQualifiedName(); result = "java.lang.Integer";
+            System.getProperty("org.eclipse.persistence.moxy.annotation.xml-id-extension"); result = "true";
         }};
 
         AnnotationsProcessor processor = new AnnotationsProcessor(helper);
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlvalue/XmlValueSystemPropertyNotSetTestCase.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlvalue/XmlValueSystemPropertyNotSetTestCase.java
index 4fbd96b..64ffbcb 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlvalue/XmlValueSystemPropertyNotSetTestCase.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlvalue/XmlValueSystemPropertyNotSetTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017 Oracle and/or its affiliates. All rights reserved.
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
  * which accompanies this distribution.
@@ -40,13 +40,13 @@
 public class XmlValueSystemPropertyNotSetTestCase {
 
     @Test
-    public void testSystemXmlValuextensionNotSet(final @Mocked({"isXmlValueExtension", "getActualType"}) Property property, final @Mocked({"isAnnotationPresent"}) Helper helper, final @Mocked JavaClass javaClass) {
+    public void testSystemXmlValuextensionNotSet(final @Mocked Property property, final @Mocked Helper helper, final @Mocked JavaClass javaClass) {
         new Expectations(System.class) {{
-            System.getProperty("org.eclipse.persistence.moxy.annotation.xml-value-extension"); returns("false");
+            System.getProperty("org.eclipse.persistence.moxy.annotation.xml-value-extension"); result = "false";
         }};
         new Expectations() {{
-            helper.isAnnotationPresent((JavaHasAnnotations)any, XmlValueExtension.class); returns(false);
-            property.isXmlValueExtension(); returns(false);
+            helper.isAnnotationPresent((JavaHasAnnotations)any, XmlValueExtension.class); result = false;
+            property.isXmlValueExtension(); result = false;
         }};
 
         AnnotationsProcessor processor = new AnnotationsProcessor(helper);
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlvalue/XmlValueSystemPropertyTestCase.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlvalue/XmlValueSystemPropertyTestCase.java
index 6a9dabb..19541d4 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlvalue/XmlValueSystemPropertyTestCase.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/annotations/xmlvalue/XmlValueSystemPropertyTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015  Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017  Oracle and/or its affiliates. All rights reserved.
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
  * which accompanies this distribution.
@@ -35,9 +35,9 @@
 public class XmlValueSystemPropertyTestCase {
 
     @Test
-    public void testSystemXmlValueExtensionSet(final @Mocked({""}) Property property, final @Mocked({""}) Helper helper) {
+    public void testSystemXmlValueExtensionSet(final @Mocked Property property, final @Mocked Helper helper) {
         new Expectations(System.class) {{
-            System.getProperty("org.eclipse.persistence.moxy.annotation.xml-value-extension"); returns("true");
+            System.getProperty("org.eclipse.persistence.moxy.annotation.xml-value-extension"); result = "true";
         }};
 
         AnnotationsProcessor processor = new AnnotationsProcessor(helper);
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/beanvalidation/BeanValidationHelperTestCase.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/beanvalidation/BeanValidationHelperTestCase.java
index ce3a968..383a366 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/beanvalidation/BeanValidationHelperTestCase.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/beanvalidation/BeanValidationHelperTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2015  Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
  * which accompanies this distribution.
@@ -66,9 +66,9 @@
                                            final @Mocked ValidationXMLReader reader) throws NamingException {
         new Expectations() {{
             ValidationXMLReader.isValidationXmlPresent(); result = true;
-            new InitialContext();
-            initialContext.lookup("java:comp/env/concurrent/ThreadPool"); returns(managedExecutorService);
-            new ValidationXMLReader();
+            new InitialContext(); result = initialContext;
+            initialContext.lookup("java:comp/env/concurrent/ThreadPool"); result = managedExecutorService;
+            new ValidationXMLReader(); result = reader;
             managedExecutorService.submit((Callable) any);
             managedExecutorService.shutdown(); times=0;
         }};
@@ -93,9 +93,9 @@
         new Expectations() {
             {
                 ValidationXMLReader.isValidationXmlPresent(); result = true;
-                new InitialContext();
+                new InitialContext(); result = initialContext;
                 initialContext.lookup("java:comp/env/concurrent/ThreadPool"); result = new NamingException();
-                new ValidationXMLReader();
+                new ValidationXMLReader(); result = reader;
                 jdkExecutorService.submit((Callable) any);
                 jdkExecutorService.shutdown();
             }
@@ -118,7 +118,7 @@
 
         new Expectations() {{
             ValidationXMLReader.isValidationXmlPresent(); result = true;
-            new ValidationXMLReader();
+            new ValidationXMLReader(); result = reader;
             reader.call();
         }};
 
@@ -143,12 +143,11 @@
         new Expectations() {
             {
                 ValidationXMLReader.isValidationXmlPresent(); result = true;
-                new InitialContext();
+                new InitialContext(); result = initialContext;
                 initialContext.lookup("java:comp/env/concurrent/ThreadPool"); result = new NamingException();
-                new ValidationXMLReader();
+                new ValidationXMLReader(); result = reader;
                 jdkExecutorService.submit((Callable) any); result = new OutOfMemoryError();
                 jdkExecutorService.shutdown();
-                new ValidationXMLReader();
                 reader.call();
             }
         };
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/MOXySystemPropertiesTestCase.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/MOXySystemPropertiesTestCase.java
index 8e29d1d..6ad84b8 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/MOXySystemPropertiesTestCase.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/MOXySystemPropertiesTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
  * which accompanies this distribution.
@@ -16,6 +16,8 @@
 import static org.junit.Assert.assertTrue;
 import mockit.Deencapsulation;
 import mockit.Expectations;
+import mockit.Mock;
+import mockit.MockUp;
 import mockit.Mocked;
 import mockit.integration.junit4.JMockit;
 
@@ -38,9 +40,15 @@
 
         final String propertyName = "propertyName";
 
-        new Expectations(PrivilegedAccessHelper.class, MOXySystemProperties.class) {{
+        new MockUp<MOXySystemProperties>() {
+            @Mock
+            private Boolean runDoPrivileged(final String propertyName) {
+                return true;
+            }
+        };
+
+        new Expectations(PrivilegedAccessHelper.class) {{
             PrivilegedAccessHelper.shouldUsePrivilegedAccess(); result = true;
-            Deencapsulation.invoke(MOXySystemProperties.class, "runDoPrivileged", propertyName); result = true;
         }};
 
         Boolean result = Deencapsulation.invoke(MOXySystemProperties.class, "getBoolean", propertyName);
@@ -54,9 +62,15 @@
 
         final String propertyName = "propertyName";
 
-        new Expectations(PrivilegedAccessHelper.class, MOXySystemProperties.class) {{
+        new MockUp<MOXySystemProperties>() {
+            @Mock
+            private Boolean getSystemPropertyValue(final String propertyName) {
+                return true;
+            }
+        };
+
+        new Expectations(PrivilegedAccessHelper.class) {{
             PrivilegedAccessHelper.shouldUsePrivilegedAccess(); result = false;
-            Deencapsulation.invoke(MOXySystemProperties.class, "getSystemPropertyValue", propertyName); result = true;
         }};
 
         Boolean result = Deencapsulation.invoke(MOXySystemProperties.class, "getBoolean", propertyName);
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/TransformerPropertyBuilderTestCase.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/TransformerPropertyBuilderTestCase.java
index e5790ee..58e5d0e 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/TransformerPropertyBuilderTestCase.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/TransformerPropertyBuilderTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
  * which accompanies this distribution.
@@ -24,6 +24,7 @@
 
 import mockit.Deencapsulation;
 import mockit.Expectations;
+import mockit.Invocation;
 import mockit.Mock;
 import mockit.MockUp;
 import mockit.Mocked;
@@ -71,19 +72,24 @@
         final Property property1 = new Property();
         final Property property2 = new Property();
 
-        new Expectations(TransformerPropertyBuilder.class) {{
+        new MockUp<TransformerPropertyBuilder>() {
+            @Mock
+            private String getPropertyName(Invocation invocation, Property property, XmlWriteTransformer writeTransformer) {
+                return property.getPropertyName() + invocation.getInvocationCount();
+            }
+
+            @Mock
+            private Property buildPropertyFromTransformer(Invocation invocation, String pname, TypeInfo typeInfo, XmlWriteTransformer writeTransformer) {
+                return invocation.getInvocationCount() == 1 ? property1 : property2;
+            }
+        };
+
+        new Expectations() {{
             property.getXmlTransformation(); result = xmlTransformation;
             List<XmlWriteTransformer> transformers = new ArrayList<>();
             transformers.add(transformer1);
             transformers.add(transformer2);
             xmlTransformation.getXmlWriteTransformer(); result = transformers;
-            String property1Name = "property1";
-            Deencapsulation.invoke(builder, "getPropertyName", property, transformer1); result = property1Name;
-            Deencapsulation.invoke(builder, "buildPropertyFromTransformer", property1Name, typeInfo, transformer1); result = property1;
-
-            String property2Name = "property2";
-            Deencapsulation.invoke(builder, "getPropertyName", property, transformer2); result = property2Name;
-            Deencapsulation.invoke(builder, "buildPropertyFromTransformer", property2Name, typeInfo, transformer2); result = property2;
         }};
 
         List<Property> properties = builder.buildProperties();
@@ -110,13 +116,21 @@
     }
 
     @Test
-    public void buildPropertyFromTransformer(final @Mocked String pname, final @Mocked TypeInfo typeInfo, final @Mocked XmlWriteTransformer transformer, final @Mocked JavaClass type, final @Mocked Property propety) {
+    public void buildPropertyFromTransformer(final @Mocked TypeInfo typeInfo, final @Mocked XmlWriteTransformer transformer, final @Mocked JavaClass type, final @Mocked Property propety) {
 
         final String xmlPath = "xmlPath";
+        final String pname = "customPname";
 
-        new Expectations(TransformerPropertyBuilder.class) {{
+        new MockUp<TransformerPropertyBuilder>() {
+            @Mock
+            private JavaClass getReturnTypeFromTransformer(TypeInfo typeInfo, XmlWriteTransformer writeTransformer) {
+                return type;
+            }
+
+        };
+
+        new Expectations() {{
             transformer.getXmlPath(); result = xmlPath;
-            Deencapsulation.invoke(builder, "getReturnTypeFromTransformer", typeInfo, transformer); result = type;
         }};
 
         final Property resultProperty = Deencapsulation.invoke(builder, "buildPropertyFromTransformer", pname, typeInfo, transformer);
@@ -131,12 +145,20 @@
 
     @Test
     public void getReturnTypeFromTransformer_isSetTransformerClass(final @Mocked TypeInfo typeInfo, final @Mocked XmlWriteTransformer transformer, final @Mocked JavaClass javaClass, final @Mocked TransformerReflectionHelper transformerReflectionHelper, final @Mocked JavaClass resultJavaClass) {
+        new MockUp<TransformerPropertyBuilder>() {
+            @Mock
+            private JavaClass getTransformerJavaClass(TypeInfo typeInfo, XmlWriteTransformer writeTransformer) {
+                return javaClass;
+            }
 
-        new Expectations(TransformerPropertyBuilder.class) {{
-            Deencapsulation.invoke(builder, "getTransformerJavaClass", typeInfo, transformer); result = javaClass;
+            @Mock
+            private TransformerReflectionHelper getTransformerReflectionHelper() {
+                return transformerReflectionHelper;
+            }
+        };
+
+        new Expectations() {{
             transformer.isSetTransformerClass(); result = true;
-
-            Deencapsulation.invoke(builder, "getTransformerReflectionHelper"); result = transformerReflectionHelper;
             transformerReflectionHelper.getReturnTypeForWriteTransformationMethodTransformer(javaClass); result = resultJavaClass;
         }};
 
diff --git a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/helper/TransformerReflectionHelperTestCase.java b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/helper/TransformerReflectionHelperTestCase.java
index b1c56b2..e1e003d 100644
--- a/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/helper/TransformerReflectionHelperTestCase.java
+++ b/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/moxy/unit/jaxb/compiler/builder/helper/TransformerReflectionHelperTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
  * which accompanies this distribution.
@@ -21,6 +21,8 @@
 
 import mockit.Deencapsulation;
 import mockit.Expectations;
+import mockit.Mock;
+import mockit.MockUp;
 import mockit.Mocked;
 import mockit.Tested;
 import mockit.integration.junit4.JMockit;
@@ -54,11 +56,22 @@
 
     @Test
     public void getReturnTypeForWriteTransformationMethodTransformer(final @Mocked TransformerHelper transformerHelper, final @Mocked JavaClass writerClass, final @Mocked JavaClass expectedReturnType) {
-        new Expectations(TransformerReflectionHelper.class) {{
-            Deencapsulation.invoke(transformerReflectionHelper, "getTransformerHelper"); result = transformerHelper;
-            String transformerMethodName = "transformerMethodName";
+        final String transformerMethodName = "transformerMethodName";
+
+        new MockUp<TransformerReflectionHelper>() {
+            @Mock
+            protected TransformerHelper getTransformerHelper() {
+                return transformerHelper;
+            }
+
+            @Mock
+            private JavaClass getReturnTypeForWriteTransformationMethod(String methodName, JavaClass writerClass, boolean isSetTransformerClass) throws JAXBException {
+                return expectedReturnType;
+            }
+        };
+
+        new Expectations() {{
             transformerHelper.getTransformerMethodName(); result = transformerMethodName;
-            Deencapsulation.invoke(transformerReflectionHelper, "getReturnTypeForWriteTransformationMethod", transformerMethodName, writerClass, true); result = expectedReturnType;
         }};
 
         JavaClass returnType = Deencapsulation.invoke(transformerReflectionHelper, "getReturnTypeForWriteTransformationMethodTransformer", writerClass);
@@ -71,9 +84,12 @@
 
         final String methodName = "methodName";
 
-        new Expectations(TransformerReflectionHelper.class) {{
-            Deencapsulation.invoke(transformerReflectionHelper, "getReturnTypeForWriteTransformationMethod", methodName, writerClass, false); result = expectedReturnType;
-        }};
+        new MockUp<TransformerReflectionHelper>() {
+            @Mock
+            private JavaClass getReturnTypeForWriteTransformationMethod(String methodName, JavaClass writerClass, boolean isSetTransformerClass) throws JAXBException {
+                return expectedReturnType;
+            }
+        };
 
         JavaClass returnType = Deencapsulation.invoke(transformerReflectionHelper, "getReturnTypeForWriteTransformationMethod", methodName, writerClass);