I am having a problem on my query object, it becomes null even though I stub it with a query mock object.. This is the code
Query query = getEntityManager().createNativeQuery(queryString, SomeRandom.class);
return query.getResultList(); //-->This is where I get the error, the query object is null.
my Test method is
Query query = mock(Query.class);
when(entityManager.createNativeQuery("", SomeRandom.class)).thenReturn(query);
List<SomeRandom> someList = requestDao.getSomeList(parameter, parameter, parameter, parameter);