I am getting a null value when i am trying to Inject the Dao interface. Sample of code here when i am writing a test cases.
@Mock
private ServiceUriLocator serviceLocator;
@Mock
private SessionDao sessionDao;
ActiveSession session;
AccountData accountdata;
@InjectMocks
Account account
This Above code when i am using inside Method like
@Test
public void testActivate()
{
Response response=account.activate(accountdata).
}
private Accountdata accountdata(){
accountdata.setFirstName("Employee_name");
accountdata.LastName("Employee_Last_Name");
return accountdata;
}
In above code account value is null that's why i am getting null pointer exception. Anybody can calrify why i am getting null value for injecting the mock value.
Aucun commentaire:
Enregistrer un commentaire