How to mock a java class inside a Grails unit test? - unit-testing

I have a java class, which I've added to my resources.groovy like this:
import persistentrep.ReasoningXMLLoader;
// Place your Spring DSL code here
beans = {
reasoningXMLLoader(ReasoningXMLLoader)
}
I then use this class in my GrailsService:
class XMLService
{
def reasoningXMLLoader
def someMethod()
{
reasoningXMLLoader.doSomething()
}
}
Obviously, I want to write a unit test that mocks reasoningXMLLoader and injects it into the service.
I tried using #Mock, MockFor and mockFor and I keep getting org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Cannot add Domain class [class persistentrep.ReasoningXMLLoader]. It is not a Domain! error :
org.codehaus.groovy.grails.exceptions.GrailsConfigurationException: Cannot add Domain class [class persistentrep.ReasoningXMLLoader]. It is not a Domain!
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:916)
at org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addArtefact(DefaultGrailsApplication.java:615)
at org.codehaus.groovy.grails.commons.GrailsApplication$addArtefact.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at grails.test.mixin.domain.DomainClassUnitTestMixin.mockDomain(DomainClassUnitTestMixin.groovy:131)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:226)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
at grails.test.mixin.domain.DomainClassUnitTestMixin.mockDomain(DomainClassUnitTestMixin.groovy:128)
at com.vpundit.www.XMLServiceTests.mockDomain(XMLServiceTests.groovy)
at com.vpundit.www.XMLServiceTests.setUp(XMLServiceTests.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Is there a way to mock this using the Grails built-in mocking framework, or do I need to use something like Mockito?
What is the best way to inject the mock? Is there some Grails magic that can do it for me, or do I just use the exposed property -
service.reasoningXMLLoader = mock?

I finally managed to figure out how to do this. I was getting the exception, because I was trying to use the #Mock() attribute, which apparently cannot be used for what I was trying to do.
The task is actually pretty straight forward after reading the Groovy documentation for mocking with closures and with MockFor. I should have realized earlier that Groovy's documentation is better suited for this type of information that Grails'
So here is how to accomplish what I wanted to do, using closures. It's very neat actually:
void testParseXml() {
String xml = "test string"
def mockReturnObject = {create your object to be returned here}
def loader = [parseString:{ mockReturnObject }] as ReasoningXMLLoader
service.reasoningXMLLoader = loader
def result = service.parseXML(xml)
do assertions here
}
Here is how to do the same with mocks:
void testParseXml() {
String xml = "test string"
def mockReturnObject = {create your object to be returned here}
def loader = new MockFor(ReasoningXMLLoader)
loader.demand.parseString{mockReturnObject}
service.reasoningXMLLoader = loader.proxyInstance()
def result = service.parseXML(xml)
do assertions here
}
I hope this helps someone who is new to Grails and Groovy.

Related

PowerMockito not able to mock final class

I wanted to use PowerMockito to mock couple of final class related to cloudwatch.
I am able to mock a non final class
CloudWatchLogsClient cloudWatchLogsClient = PowerMockito.mock(CloudWatchLogsClient.class);
But when i try to mock these final classes
LogGroup logGroup = PowerMockito.mock(LogGroup.class);
DescribeLogGroupsResponse describeLogGroupsResponse = PowerMockito.mock(DescribeLogGroupsResponse.class);
it gives error
MethodSource [className = 'util.LogUtilTest', methodName = 'testLogGroupPresent', methodParameterTypes = '']
[java] => org.mockito.exceptions.base.MockitoException:
[java] Cannot mock/spy class software.amazon.awssdk.services.cloudwatchlogs.model.LogGroup
[java] Mockito cannot mock/spy because :
[java] - final class
I am using
#RunWith(PowerMockRunner.class)
#PrepareForTest({CreateLogStreamRequest.class, LogGroup.class, DescribeLogGroupsResponse.class, DescribeLogGroupsRequest.class})
but still i am getting the error, anyone knows why is this happening ?

Error creating child actor

In an Actor I create a child actor like below
ActorRef sessionEventHandlerActor = getContext().actorOf(Props.create(SessionHandler.class), sessionId);
and this is SessionHandler actor:
public class SessionHandler extends UntypedActor {
public SessionHandler() {
getContext().setReceiveTimeout(Duration.create(1, TimeUnit.MINUTES));
}
#Override
public void onReceive(Object message) throws Exception {
}
}
and I get following error:
Caused by: akka.actor.ActorInitializationException: You cannot create an instance of [actors.SessionHandler] explicitly using the constructor (new). You have to use one of the 'actorOf' factory methods to create a new actor. See the documentation.
at akka.actor.ActorInitializationException$.apply(Actor.scala:165)
at akka.actor.Actor$class.$init$(Actor.scala:421)
at akka.actor.UntypedActor.<init>(UntypedActor.scala:97)
at org.esi.actors.SessionHandler.<init>(SessionHandler.java:22)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at akka.util.Reflect$.instantiate(Reflect.scala:45)
at akka.actor.NoArgsReflectConstructor.produce(Props.scala:358)
at akka.actor.Props.newActor(Props.scala:249)
at akka.actor.ActorCell.newActor(ActorCell.scala:552)
at akka.actor.ActorCell.create(ActorCell.scala:578)
I do not see any issue in how I create the actor. Does any one know what the problem can be?
Thank you
I think there's no problem anymore, but I think you need to leave out the the sessionId argument, because create will try to apply it to the constructor.
ActorRef sessionEventHandlerActor = getContext().actorOf(Props.create(SessionHandler.class));
As far as I understood the Java API. I only used it in scala.

MissingMethodException in unit test with HibernateTestMixin when using dynamic finder after upgrade to Grails 3.0.6

After upgrading a Grails 2.5.1 application to Grails 3.0.6 I am having troubles to get my unit tests working again.
I have a very simple domain class called Team.
class Team {
String name
String shortName
String image = 'noimage.jpg'
static constraints = {
name nullable: false, maxSize: 30, unique: true
shortName nullable: true, maxSize: 5
image nullable: false, maxSize: 30
}
}
and a unit test that does this
#TestMixin(HibernateTestMixin)
#Domain([Team])
class TeamSpec extends Specification {
def setup() {
new Team(name: 'Hello', shortName: 'Big').save()
}
def cleanup() {
}
void "test something"() {
expect:"fix me"
!Team.findByName('hello')
}
}
When I execute the unit test I get the following runtime error
groovy.lang.MissingMethodException: No signature of method: static abc.Team.findByName() is applicable for argument types: (java.lang.String) values: [hello]
at abc.TeamSpec.test something(TeamSpec.groovy:24)
It complains about a dynamic finder that was available in Grails 2.5.x. Can anyone help me to solve that problem? Anyone had such a thing before?
EDIT
I created a plain new Grails 3.0.6 and generated a domain class by the task create-domain-class. Then I added the three String attributes (name, shortName, image) to the class and wrote a simple assertion !Team.findByName('A') but the exception remains.
EDIT 2
I still have no clue what I am doing wrong. I reported that issue to the Grails-Core issue tracker. Example code can be found here
EDIT 3
#TestFor does the job but I would like to work with the HibernateTestMixin instead of DomainClassUnitTestMixin in favour of a H2 in memory database. Therefore I added
testCompile 'org.grails:grails-datastore-test-support:4.0.5.RELEASE'
to my build.gradle. But when I add the HibernateTestMixin I get the following exception.
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.grails.datastore.mapping.simple.SimpleMapDatastore] is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:371)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968)
at grails.test.mixin.domain.DomainClassUnitTestMixin.getSimpleDatastore(DomainClassUnitTestMixin.groovy:76)
at grails.test.mixin.domain.DomainClassUnitTestMixin.mockDomains(DomainClassUnitTestMixin.groovy:86)
at grails.test.mixin.domain.DomainClassUnitTestMixin.mockDomain(DomainClassUnitTestMixin.groovy:119)
at grails.test.mixin.domain.DomainClassUnitTestMixin.mockDomain(DomainClassUnitTestMixin.groovy:118)
at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:153)
at org.spockframework.runtime.model.MethodInfo.invoke(MethodInfo.java:84)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:88)
at org.spockframework.runtime.extension.builtin.AbstractRuleInterceptor$1.evaluate(AbstractRuleInterceptor.java:37)
at grails.test.runtime.TestRuntimeJunitAdapter$1$2.evaluate(TestRuntimeJunitAdapter.groovy:46)
at org.spockframework.runtime.extension.builtin.TestRuleInterceptor.intercept(TestRuleInterceptor.java:38)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:87)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:88)
at org.spockframework.runtime.extension.builtin.AbstractRuleInterceptor$1.evaluate(AbstractRuleInterceptor.java:37)
at grails.test.runtime.TestRuntimeJunitAdapter$3$4.evaluate(TestRuntimeJunitAdapter.groovy:73)
at org.spockframework.runtime.extension.builtin.ClassRuleInterceptor.intercept(ClassRuleInterceptor.java:38)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:87)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:64)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:50)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:106)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
It should work fine - this example is using grails 3.0.1. http://grails.github.io/grails-doc/3.0.1/guide/testing.html#unitTestingDomains
I'm guessing using #TestFor annotation may do the trick for you. It will set up whatever mixins are needed, based on what you are testing. Here's my working example, which resides at
/src/test/groovy/grails3test/TeamSpec.groovy:
package grails3test
import grails.test.mixin.TestFor
import spock.lang.Specification
/**
* See the API for {#link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
*/
#TestFor(Team)
class TeamSpec extends Specification {
def setup() {
Team t = new Team(name: 'alphabravo')
t.save()
}
def cleanup() {
}
void "test something"() {
expect:
Team.findByName('alphabravo') != null
}
}
The behaviour is officially a bug that will be fixed by the release of Grails 3.0.8
Link to the bug

using JPA2 for an entity update

I'm not really used to JPA... so this is more like a basic question
I use JPA2 - (not hibernate)
I have this function, and I want to make an update on my
#RequestScoped // (this is javax.faces.bean.RequestScoped)
#Stafeful // (this is javax.ejb.Stateful)
public class MyProvider {
#Inject
private EntityManager entityManager;
/* some variables and getters and setters */
public void setLocked(Long id, boolean locked) {
entityManager.getTransaction().begin();
user = userProvider.findUserByID(id);
user.setLocked(locked);
entityManager.persist(user);
// i also tried it with refresh instead of persist
entityManager.refresh(user);
entityManager.getTransaction().commit();
}
}
but i get this error at this point
entityManager.getTransaction().begin();
java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()
org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:996)
org.jboss.as.jpa.container.AbstractEntityManager.getTransaction(AbstractEntityManager.java:498)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)
org.jboss.weld.bean.builtin.CallableMethodHandler.invoke(CallableMethodHandler.java:51)
org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
org.jboss.weldx.persistence.EntityManager$-1570536921$Proxy$_$$_Weld$Proxy$.getTransaction(EntityManager$-1570536921$Proxy$_$$_Weld$Proxy$.java)
de.demoapp.controller.UserController.setLocked(UserController.java:452)
de.demoapp.controller.UserController.lock(UserController.java:721)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.apache.el.parser.AstValue.invoke(AstValue.java:262)
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
javax.faces.component.UICommand.broadcast(UICommand.java:315)
javax.faces.component.UIData.broadcast(UIData.java:1093)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
I have also read this article - but it doesn't really help, it still throws: javax.persistence.TransactionRequiredException: no transaction is in progress
I'm not sure if I do something essential wrong...
Yes, there is something essential wrong. You have mismatch between container managed transactions and user managed transactions. Documentation for EntityManager.getTransaction tells quite clearly what is the problem:
Throws:
IllegalStateException - if invoked on a JTA entity manager
Problem comes from entityManager.getTransaction() in your code, hacking with /flush/persist/etc does not matter because exception occurs before those lines are executed.
More details about the subject can be found from: http://en.wikibooks.org/wiki/Java_Persistence/Transactions
okay, because of the the real good answer of Mikko, i do it know right:
I import:
import javax.ejb.TransactionAttribute;
import static javax.ejb.TransactionAttributeType.REQUIRED; // this one is important!!!
my Annotations are now:
#RequestScoped
#Stateful
#TransactionAttribute(value=REQUIRED)
public class UserProvider {
public void setLocked(Long id, boolean locked) {
User user = new User();
user = findUserByID(id);
user.setLocked(locked);
entityManager.merge(user);
}
}
now it works, but the reason is the 2nd import and the anotation!

Using #Autowired with JMockit makes the #Autowired object null

I realize that there is another SO question which deals with this exact problem (here). However, it won't work in my case.
I have a maven (web/frontend) project using spring. I've added jmockit to the jvm through the pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<argLine>-javaagent:${settings.localRepository}/mockit/jmockit/0.998/jmockit-0.998.jar</argLine>
<useSystemClassLoader>true</useSystemClassLoader>
<forkMode>always</forkMode>
</configuration>
</plugin>
The SUT (abbreviated) looks like:
#Service
#RequestMapping("/bars")
public class BarsController{
[...]
#Autowired
private FooUtils fooUtils;
[...]
#RequestMapping(value = "/get", method = RequestMethod.POST)
public ModelAndView getBars(){
ModelAndView mav = new ModelAndView();
Session session = fooUtils.getSession();
[...]
Now, I would really like to mock out the FooUtils instance in my test. Following the advice given in this SO question, I tried:
#RunWith(JMockit.class)
public class BarsControllerTest {
#Autowired BarsController unitUnderTest;
#Mocked Session session;
#Before
public void setUp()
{
FooUtils foo = new MockUp <FooUtils>() {
#Mock
Session getSession() {
return session;
}
}.getMockInstance();
mockit.Deencapsulation.setField(unitUnderTest, foo);
}
Alas, the unitUnderTest as well as the foo are both null, causing this to happen:
java.lang.NullPointerException
at net.manniche.thebars.BarsControllerTest.setUp(BarsControllerTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:78)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
Which is quite unexpected, as I would expect new MockUp<...>{}.getMockInstance() to return some object.
I guess that I'm just missing out on some crucial part, but which?