use of cucumber.runtime.Glue in project cucumber-jvm by cucumber.
the class MethodScannerTest method loadGlue_registers_the_methods_declaring_class_in_the_object_factory.
@Test
public void loadGlue_registers_the_methods_declaring_class_in_the_object_factory() throws NoSuchMethodException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
ResourceLoader resourceLoader = new MultiLoader(classLoader);
MethodScanner methodScanner = new MethodScanner(new ResourceLoaderClassFinder(resourceLoader, classLoader));
ObjectFactory factory = Mockito.mock(ObjectFactory.class);
Glue world = Mockito.mock(Glue.class);
JavaBackend backend = new JavaBackend(factory);
Whitebox.setInternalState(backend, "glue", world);
// this delegates to methodScanner.scan which we test
methodScanner.scan(backend, BaseStepDefs.class.getMethod("m"), BaseStepDefs.class);
verify(factory, times(1)).addClass(BaseStepDefs.class);
verifyNoMoreInteractions(factory);
}
Aggregations