@Override
    public ModelMBean assemble(Object obj, ObjectName name) throws JMException {
        ModelMBeanInfo mbi = null;

        // use the default provided mbean which has been annotated with JMX annotations
        LOGGER.trace("Assembling MBeanInfo for: {} from @ManagedResource object: {}", name, obj);
        mbi = assembler.getMBeanInfo(obj, null, name.toString());

        if (mbi == null) {
            return null;
        }

        RequiredModelMBean mbean = new RequiredModelMBean(mbi);

        try {
            mbean.setManagedResource(obj, "ObjectReference");
        } catch (InvalidTargetObjectTypeException e) {
            throw new JMException(e.getMessage());
        }

        // Allows the managed object to send notifications
        if (obj instanceof NotificationSenderAware) {
            ((NotificationSenderAware) obj).setNotificationSender(new NotificationSenderAdapter(mbean));
        }

        return mbean;
    }
@Test
    public void testNotificationAware() throws MalformedObjectNameException, JMException {
        NotificationSenderAware mockedNotificationAwareMbean = mock(NotificationSenderAware.class);
        ModelMBean modelBean = defaultManagementMBeanAssembler.assemble(mockedNotificationAwareMbean, new ObjectName("org.flowable.jmx.Mbeans:type=something"));
        assertThat(modelBean).isNotNull();
        ArgumentCaptor<NotificationSender> argument = ArgumentCaptor.forClass(NotificationSender.class);
        verify(mockedNotificationAwareMbean).setNotificationSender(argument.capture());
        assertThat(argument).isNotNull();
        assertThat(argument.getValue()).isNotNull();

    }