BQRuntimeChecker { @SafeVarargs public static void testModulesLoaded(BQRuntime runtime, Class<? extends BQModule>... expectedModules) { ModulesMetadata modulesMetadata = runtime.getInstance(ModulesMetadata.class); List<String> actualModules = modulesMetadata .getModules() .stream() .map(ModuleMetadata::getName) .collect(toList()); List<String> missingModules = new ArrayList<>(); Stream.of(expectedModules) .map(Class::getSimpleName) .forEach(n -> { if (!actualModules.contains(n)) { missingModules.add(n); } }); if(!missingModules.isEmpty()) { fail("The following expected modules are missing: " + missingModules); } }  @SafeVarargs static void testModulesLoaded(BQRuntime runtime, Class<? extends BQModule>... expectedModules);  }
@Test public void testTestModulesLoaded() { BQRuntime runtime = testFactory.app().createRuntime(); BQRuntimeChecker.testModulesLoaded(runtime, BQCoreModule.class); }
@Test public void testTestModulesNotLoaded() { BQRuntime runtime = testFactory.app().createRuntime(); Assertions.assertThrows(AssertionError.class, () -> BQRuntimeChecker.testModulesLoaded(runtime, NonLoadedModule.class)); }