Consider the following class:
public class FacadeImplTest {
/*Class to test*/
private FacadeImpl facade;
@Mock
private Test test;
@Mock
private Test1 test1;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
facade = new FacadeImpl();
test.setID("1234");
//mockprocessOrder = new ProcessOrder();
mockprocessOrder.setProcessOrderID("123455");
}
@Test
public void testOrder() throws Exception {
// Have methods to test
}
Here Test class is a pojo class which has its getters and setters for id variable. The test.setID("1234") should set the id in the Test class, but it is not setting and returning null. Am I missing something here?
But when I try instantiating the Test class and then setting the value it is working fine.
Aucun commentaire:
Enregistrer un commentaire