private void checkBundleImplicitTypeAndVersion(InstallArtifact installArtifact)
     throws IOException {
   assertNotNull(installArtifact);
   assertTrue(installArtifact instanceof BundleInstallArtifact);
   BundleInstallArtifact bundleInstallArtifact = (BundleInstallArtifact) installArtifact;
   assertEquals(
       "simple",
       bundleInstallArtifact.getBundleManifest().getBundleSymbolicName().getSymbolicName());
   assertEquals(new Version("0"), bundleInstallArtifact.getBundleManifest().getBundleVersion());
 }
  @Test
  public void testBundle() throws DeploymentException, IOException {
    StubBundleContext bundleContext = new StubBundleContext();
    StubBundleContext userRegionBundleContext = new StubBundleContext();
    expect(this.osgiFramework.getBundleContext()).andReturn(bundleContext).anyTimes();
    expect(this.repository.get(isA(String.class), isA(String.class), isA(VersionRange.class)))
        .andReturn(this.artifactDescriptor);
    expect(this.artifactDescriptor.getUri()).andReturn(this.bundleURI);
    expect(this.artifactDescriptor.getVersion()).andReturn(new Version(1, 2, 3));
    expect(this.artifactDescriptor.getRepositoryName()).andReturn(TEST_BUNDLE_REPOSITORY_NAME);

    replayMocks();

    StandardArtifactIdentityDeterminer artifactIdentityDeterminer =
        new StandardArtifactIdentityDeterminer(testArtifactBridges);

    StandardInstallArtifactRefreshHandler refreshHelper =
        new StandardInstallArtifactRefreshHandler(installEnvironmentFactory, refreshPipeline);

    bundleContext.registerService(
        InstallArtifactTreeFactory.class.getName(),
        new BundleInstallArtifactTreeFactory(
            this.osgiFramework,
            bundleContext,
            refreshHelper,
            this.bundleStarter,
            this.tracingService,
            this.packageAdminUtil,
            userRegionBundleContext,
            new MockEventLogger(),
            null),
        null);

    this.installArtifactFactory =
        new StandardInstallArtifactTreeInclosure(
            this.artifactStorageFactory,
            bundleContext,
            this.repository,
            new MockEventLogger(),
            artifactIdentityDeterminer);

    ArtifactSpecification specification =
        new ArtifactSpecification("bundle", "a", new VersionRange("2.0.0"));
    InstallArtifact installArtifact =
        this.installArtifactFactory.createInstallTree(specification).getValue();
    assertNotNull(installArtifact);
    assertEquals(TEST_BUNDLE_REPOSITORY_NAME, installArtifact.getRepositoryName());
    assertTrue(installArtifact instanceof BundleInstallArtifact);
    BundleInstallArtifact bundleInstallArtifact = (BundleInstallArtifact) installArtifact;
    assertEquals(
        "a", bundleInstallArtifact.getBundleManifest().getBundleSymbolicName().getSymbolicName());

    verifyMocks();
    resetMocks();
  }