I have a class A which has a private integer member b. Here is the structure of the class:
public class A {
private int b= Integer.parseInt(C.getValue(anyString));
public int getB() {
return b;
}
public void setB(int b) {
this.b= b;
}
}
I am testing some method of this class using jmockit with junit4 `
public class ATest {
@Tested
A a;
@BeforeClass
public void setUp() {
//mock C.getValue
}
@Test public void test1() {
//some test code
}
}
but I am unable to mock the call (C.getValue(anyString)
) thus the test fails while building the project. I have tried using @Before
and @BeforeClass
but none of those executed even once. Please suggest a way out.
Considering I can't change the main class A
.