public class JuUserInfoManagerImplPollCountTest extends MockitoTestCase {
@Spy
@InjectMocks
JuUserInfoManagerImpl juUserInfoManagerImpl = new JuUserInfoManagerImpl();
@Mock
TairManager tairManager; //That is a cache System
@Mock
JuUserInfoDAO juUserInfoDAO;
@Test
public void testIncrAwardPollCount() throws ManagerException, DAOException {
juUserInfoManagerImpl.incrAwardPollCount(1L, 2);
verify(juUserInfoDAO).incrUserPollCount(1L, 2, null);
verify(tairManager).delete(MyJuCacheArea.MY_USER_POLL_COUNT,JuUserInfoManager.POLL_COUNT_PREFIX + 1L);
}
}
public class JuUserInfoManagerImpl implements JuUserInfoManager {
private static final Logger log = LoggerFactory.getLogger(JuUserInfoManagerImpl.class);
@Autowired
@Resource(name="tairManager")
private TairManager tairManager;
@Override
public void incrAwardPollCount(long userId, int pollCount) throws ManagerException {
try {
juUserInfoDAO.incrUserPollCount(userId, pollCount, null);
clearPollCountCache(userId);//null
point here..................................
} catch (DAOException e) {
log.error("[JuUserInfoManagerImpl-incrAwardPollCount]");
throw new ManagerException("[JuUserInfoManagerImpl-incrAwardPollCount]",e);
}
}
private void clearPollCountCache(long userId){
tairManager.delete(MyJuCacheArea.MY_USER_POLL_COUNT, POLL_COUNT_PREFIX + userId); //null pointer here

--
You received this message because you are subscribed to the Google Groups "mockito" group.
To post to this group, send email to moc...@googlegroups.com.
To unsubscribe from this group, send email to mockito+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mockito?hl=en.