我已使用缓存机制实施 REST服务,其中缓存 有效 5分钟,如下所示:
public Response findNberofPointsByUserIdCache(Long userId, Long exerciseId) {
Integer nberPoints=exerciseDao.calculateNberOfPoints(userId,exerciseId);
CacheControl cc = new CacheControl();
cc.setMaxAge(300);// for 5 minutes
cc.setPrivate(true);
ResponseBuilder builder = Response.ok(nberPoints);
builder.cacheControl(cc);
return builder.build();
}
我想用@Test
Junit进行测试。我该怎么办?