Questions tagged [jmockit]

JMockit is a java framework for mocking objects in JUnit testing. It uses the instrumentation apis that modify the bytecode during run time to dynamically create classes. It allows developers to write unit tests without the testability issues typically found with other mocking APIs. Tests can be written that will mock final classes, static methods, constructors, and so on. The API also provides advanced support for integration tests and code coverage tool.

JMockit is a Java mocking API with expressive recording & verification syntax in JUnit/TestNG testing.

It provides mocking by using instrumentation APIs that modify class bytecode during runtime, allowing developers to write unit tests without the testability issues typically found with other mocking APIs.

Tests can be written to mock final classes, static methods, constructors, and so on. The API also provides advanced support for out-of-container integration testing for Java EE and Spring-based apps and code coverage tool with line and path metrics.

816 questions
-1
votes
2 answers

Jmockit: Verify call method of interface field

Version of JMockit that was used: 1.21 I have interface like this. TestInterface: public interface TestInterface { boolean callMethod(); } A TestClass have field is a instance of that interface TestClass: public class TestClass { private…
Long Nguyen
  • 9,898
  • 5
  • 53
  • 52
-1
votes
2 answers

How to mock inherited method using JMockit

Below is my code and I am writting Junit test case for method perform. I want method getList to return dummy values as DB is not available. Please suggest how I can do the same using JMockit. class BaseClass { public List<> getList() { …
user1520277
  • 59
  • 2
  • 11
-2
votes
1 answer

Using JMockit and TestNG with Spring framework

Spring framework has great integration with jUnit and EasyMock. Does anyone have experience using JMockit and TestNG with Spring framework?
Amin Emami
  • 497
  • 2
  • 5
  • 12
-2
votes
1 answer

extends vs implements visibility in child class

public interface A{ public void doSomething(); } public abstract class B{ public void doSomething(){ //implementation... } } public abstract class C extends B implements A{ } public class D extends C{ ... //doSomething() is not…
123_xyz
  • 13
  • 5
-3
votes
1 answer

Mockit -- is this code over-riding all instances in the code?

I am looking at the following code import mockit.Mock; import mockit.MockUp; new MockUp() { @Mock delete(final String fooId) { assertEquals(fooId, "foo123"); } }; I note that this is not being assigned to any…
Jeff
  • 1,513
  • 4
  • 18
  • 34
-3
votes
1 answer

Junit test case for 'if' condition in code

I am getting null pointer exception at if condition in the below method.Here is my method and junit test class i am working. METHOD @Override public Event getDisplayEventDetails(String ceccid, String ceocid) { Event evnt = null; …
SMITH
  • 65
  • 1
  • 3
  • 8
1 2 3
54
55