mercredi 23 septembre 2015

NPE while injecting mocks

I have following code but its giving me NPE while executing test method, not getting the reason why? it seems mocks are not getting injected

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = SpringockitoContextLoader.class, locations = "classpath:ApplicationContext.xml")
public class MessageServiceTest {
    @InjectMocks
    MessageServiceHelper messageServiceHelper;

    @Mock
    EmailServiceImpl emailService;

    @Test
    public void testSendMessage(){
        messageServiceHelper.sendMessage();
    }
}

Aucun commentaire:

Enregistrer un commentaire