// Mock only the modifyData method
ReportDao tested = createPartialMock(ReportDao.class, getReportFromTargetNameMethodName);
// Create a mock of the distributed cache.
Cache cacheMock = createMock(Cache.class);
/*
* Now that we have a mock of the cache we need to set this instance in
* the class being tested.
*/
Whitebox.setInternalState(tested, "cache", cacheMock);
/*
* Create an expectation for the private method
* "getReportFromTargetName".
*/
expectPrivate(tested, getReportFromTargetNameMethodName, reportName).andReturn(report);
// Expect the call to invalidate cache.
cacheMock.invalidateCache(report);
expectLastCall().once();
replay(tested, cacheMock);
tested.deleteReport(reportName);