    @Test
    public void testTransformWithHostComponentSetterReferences() throws Exception {

        when(registration.getMainInterfaceClasses()).thenReturn(new Class<?>[]{SomeInterface.class});
        List<HostComponentRegistration> registrations = new ArrayList<HostComponentRegistration>(1);
        registrations.add(registration);

        final File plugin = new PluginJarBuilder("testUpgradeOfBundledPlugin")
                .addFormattedResource("maera-plugin.xml",
                        "<maera-plugin name='Test' key='hostClass' pluginsVersion='2'>",
                        "    <plugin-info>",
                        "        <version>1.0</version>",
                        "    </plugin-info>",
                        "    <object key='hostClass' class='org.maera.plugin.osgi.HostClassUsingHostComponentSetter'/>",
                        "</maera-plugin>")
                .build();

        ScanDescriptorForHostClassesStage stage = new ScanDescriptorForHostClassesStage();
        SystemExports exports = new SystemExports("org.maera.plugin.osgi");
        final TransformContext context = new TransformContext(registrations, exports, new JarPluginArtifact(plugin),
                null, PluginAccessor.Descriptor.FILENAME, osgiContainerManager);
        stage.execute(context);
        assertEquals(1, context.getRequiredHostComponents().size());
        assertEquals(registration, context.getRequiredHostComponents().iterator().next());
    }