@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
    Onem2mbenchmarkModule module = new Onem2mbenchmarkModule(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((Onem2mbenchmarkProvider)closeable);
    // ensure no exceptions on close
    closeable.close();
}