@Test
    @OSGiVersionSpecs({
        @OSGiSpec(version="4.1", sections={"3.5.5"}),
        @OSGiSpec(version="4.2", sections={"3.5.5"})
    })
    public void testGetExportedPackagesByBundle() throws BundleException {
        int nrOfRuns = 50;
        int maxNrOfPackages = 4;
        boolean allOk = true;
        StringBuilder results = new StringBuilder();
        for (int j = 1; j <= maxNrOfPackages; j++) {
            for (int i = 0; i < nrOfRuns; i++) {
                Bundle b = generateMultiplePackageExporter("multi"+i+(j+1), j);
                m_admin.resolveBundles(new Bundle[] { b });
                ExportedPackage[] exportedPackages = m_admin.getExportedPackages(b);
                results.append("Run " + i + ", expected " + j + " packages, saw " + exportedPackages.length + ((exportedPackages.length != j*j)?"<--":"")+ "\n");
                if (exportedPackages.length != j) {
                    allOk = false;
                }
                b.uninstall();
                m_bu.refreshFrameworkAndWait(new Bundle[] {b});
            }
        }

        assert allOk : "Something went wrong creating multi-export packages; run output below.\n" + results.toString();
    }