コード例 #1
0
  public void testArtifactFromJar() throws JavaModelException {
    BatchArtifactType type = BatchArtifactType.PARTITION_COLLECTOR;

    PreferredPackageManager.savePreferredPackage(project, type, JAR_PACKAGE_NAME);

    IPackageFragment suggestedPackageName =
        PreferredPackageManager.getPackageSuggestion(project, type);

    assertNull("Suggested package name should be null", suggestedPackageName);
  }
コード例 #2
0
  public void testPreferredPackageManager() throws JavaModelException {
    BatchArtifactType type = BatchArtifactType.BATCHLET;

    IJavaProject javaProject = EclipseUtil.getJavaProject(project);

    javaProject.getPackageFragmentRoots()[0].createPackageFragment(
        "batch.artifact", true, new NullProgressMonitor());

    PreferredPackageManager.savePreferredPackage(project, type, TEST_PACKAGE_NAME);

    IPackageFragment suggestedPackageName =
        PreferredPackageManager.getPackageSuggestion(project, type);

    assertEquals(
        "Unexpected suggested package name",
        TEST_PACKAGE_NAME,
        suggestedPackageName.getPath().toString());
  }