0

如何在 Junit 测试中的 catch 块下覆盖此 LOG 语句。

 private static final Logger LOG = LoggerFactory.getLogger(CCRedirectInfo.class);

@PostConstruct
    public void init(){
        try (ResourceResolver readerResourceResolver = resourceResolverFactory.getServiceResourceResolver(
                SERVICE_MAPPING)) {
            String originUrl = request.getParameter("origin");
            loggedinUrl = readerResourceResolver.map(originUrl);
        } catch (LoginException loginException) {
            LOG.error("Exception happened while fetching the ResourceResolver ", loginException);
        }
    }
4

0 回答 0