@Test public void testCustomValidation() { VtnappModule module = new VtnappModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class)); // ensure no exceptions on validation // currently this method is empty module.customValidation(); }
@Test public void testCreateInstance() throws Exception { // configure mocks DependencyResolver dependencyResolver = mock(DependencyResolver.class); BindingAwareBroker broker = mock(BindingAwareBroker.class); when(dependencyResolver.resolveInstance( eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))) .thenReturn(broker); // create instance of module with injected mocks VtnappModule module = new VtnappModule(mock(ModuleIdentifier.class), dependencyResolver); // getInstance calls resolveInstance to get the broker dependency and then calls createInstance AutoCloseable closeable = module.getInstance(); // verify that the module registered the returned provider with the broker verify(broker).registerProvider((VtnappProvider) closeable); // ensure no exceptions on close closeable.close(); }