在下面的类中,我有匿名的内部类,因此如何使用嘲讽对其进行测试。请检查以下代码
// Service class
@Component("someServiceClass")
public class SomeServiceClassImpl implements SomeServiceClass {
@Autowired
RepoClass repo;
LoadingCache < String, ClientDetails > clientDetailsCache =
CacheBuilder.newBuilder()
.build(new CacheLoader < String, ClientDetails > () {
@Override
public ClientDetails load(String clientId) throws Exception {
OauthClientMapping client = repo.findByClientId(clientId);
return someObject;
}
});
@Override
public void method(String id) {
String param = request.getParameter("param");
}
}