Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upMocking static methods not working when initializing HttpServlet with @Tested #255
Labels
Comments
This comment has been minimized.
This comment has been minimized.
Seems like a bug; thanks for reporting. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the following code, InetAddress does not get mocked. The call of InetAddress#getByName in class Servlet.java runs the method of the real class (which fails, because of 'managementHost' is not found).
I suppose that the mock is not set up before Servlet#init is called by the routine which is used to initialize objects annotated with @tested.
With JMockit 1.19 all works well and I learned that Release 1.19 did not call Servlet#init while initializing the object servlet, but since 1.20 it does.
`
public class MockTest {
}
`
`public class Servlet extends HttpServlet {
}`