Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing FrameworkUtil.getBundle(this.getClass()).getBundleContext();在wcm.io中返回null_Unit Testing - Fatal编程技术网

Unit testing FrameworkUtil.getBundle(this.getClass()).getBundleContext();在wcm.io中返回null

Unit testing FrameworkUtil.getBundle(this.getClass()).getBundleContext();在wcm.io中返回null,unit-testing,Unit Testing,当我们使用wcm.io框架为aem代码库编写junit时,下面一行的值将为NULL BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); 欢迎提供任何帮助。您是否使用了任何特定的模拟框架以及模拟设置如何?我们使用wcm.io框架和AemContext builder类来填充对象。请在下面找到和平的代码,它可能有助于完全公开静态AemContext newAemContext(){返回新

当我们使用wcm.io框架为aem代码库编写junit时,下面一行的值将为NULL

BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext();

欢迎提供任何帮助。

您是否使用了任何特定的模拟框架以及模拟设置如何?我们使用wcm.io框架和AemContext builder类来填充对象。请在下面找到和平的代码,它可能有助于完全公开静态AemContext newAemContext(){返回新的AemContextBuilder().resourceResolverType(resourceResolverType.JCR_MOCK).plugin(WCMIO_SLING,WCMIO_CONFIG,WCMIO_HANDLER).afterSetUp(SETUP_CALLBACK).build()}在测试类中,我们通过以下行获取AemContext对象@Rule public final AemContext context=ServletAEMContext.newAemContext();