Top "Jmockit" questions

JMockit is a java framework for mocking objects in JUnit testing.

jmockit: Native library for Attach API not available in this JRE error

I was trying to use jmockit to unit test my project and got the following error: java.lang.UnsatisfiedLinkError: no …

jmockit
JMockit mock constructor

I am unit testing a class which has a complicated constructor ( with lots of parameters ). Constructor takes three arguments like : …

java unit-testing jmockit
com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded

I get AttachNotSupportedException while running jmockit tests on linux (ubuntu 64bit). Java version is 1.7.0_51. This JDK is from Oracle. Tests …

linux java-7 jmockit
How to mock JdbcTemplate.queryForObject() method

My method looks like this: public class Decompile extends JdbcDaoSupport public void getRunner(){ String val = this.getJdbcTemplate().queryForObject(sql,String.…

java mockito jmock jmockit springmockito
JMockit Expectation API : How to throw an exception upon method/constructor invocation

While using JMockit I want to throw an exception upon a constructor invocation like this: new Expectations(){ { new FirefoxDriver();//Want …

mocking jmockit expectations
Mock a private static field with JMockit?

I have a class like the following; class ClassA { private static File myDir; // myDir is created at some stage private …

java unit-testing jmockit
Using JMockit to mock autowired interface implementations

We are writing JUnit tests for a class that uses Spring autowiring to inject a dependency which is some instance …

java spring junit mocking jmockit
Return different values each time from jMockit expectation

I have a unit test where I am mocking java.net.URI class. Further, I am creating a jMockit NonStrictExpectation …

junit mocking jmockit
jMockit: How to expect constructor calls to Mocked objects?

I am unit-testing a method performing some serialization operations. I intend to mock the serialization logic. The code is as …

java junit jmockit
Is there a way in JMockit to call the original method from a mocked method?

In my mock class, I'm mocking method foo(). For some test cases, I want the mock implementation of foo() to …

java mocking jmockit