/**
  * Tests that making Javadoc changes to the source file TestClass2 cause the workspace baseline to
  * be updated.
  *
  * <p>This test adds a @noinstantiate tag to the source file TestClass2
  */
 public void testWPUpdateSourceTypeChanged() throws Exception {
   IJavaProject project = getTestingProject();
   assertNotNull("The testing project must exist", project);
   IPackageFragmentRoot root =
       project.findPackageFragmentRoot(
           new Path(project.getElementName()).append(ProjectUtils.SRC_FOLDER).makeAbsolute());
   assertNotNull("the 'src' package fragment root must exist", root);
   NullProgressMonitor monitor = new NullProgressMonitor();
   IPackageFragment fragment = root.getPackageFragment("a.b.c");
   FileUtils.importFileFromDirectory(
       SRC_LOC.append("TestClass2.java").toFile(), fragment.getPath(), monitor);
   ICompilationUnit element =
       (ICompilationUnit) project.findElement(new Path("a/b/c/TestClass2.java"));
   assertNotNull("TestClass2 must exist in the test project", element);
   updateTagInSource(element, "TestClass2", null, "@noinstantiate", false);
   IApiDescription desc = getTestProjectApiDescription();
   assertNotNull("the testing project api description must exist", desc);
   IApiAnnotations annot = desc.resolveAnnotations(Factory.typeDescriptor("a.b.c.TestClass2"));
   assertNotNull("the annotations for a.b.c.TestClass2 cannot be null", annot);
   assertTrue(
       "there must be a noinstantiate setting for TestClass2",
       (annot.getRestrictions() & RestrictionModifiers.NO_INSTANTIATE) != 0);
   assertTrue(
       "there must be a noextend setting for TestClass2",
       (annot.getRestrictions() & RestrictionModifiers.NO_EXTEND) != 0);
 }
 /**
  * Asserts if the given restriction is on the specified source
  *
  * @param packagename
  * @param sourcename
  */
 public void assertSourceResctriction(String packagename, String sourcename, int restriction)
     throws CoreException {
   IApiDescription desc = getTestProjectApiDescription();
   assertNotNull("the testing project api description must exist", desc);
   IApiAnnotations annot =
       desc.resolveAnnotations(Factory.typeDescriptor(packagename + "." + sourcename));
   assertNotNull(
       "the annotations for " + packagename + "." + sourcename + " cannot be null", annot);
   assertTrue(
       "there must be a noinstantiate setting for TestClass1",
       annot.getRestrictions() == restriction);
 }
 /**
  * Tests that removing a source file from an API aware project causes the workspace description to
  * be updated
  */
 public void testWPUpdateSourceRemoved() throws Exception {
   IJavaProject project = getTestingProject();
   assertNotNull("The testing project must exist", project);
   IPackageFragmentRoot root =
       project.findPackageFragmentRoot(
           new Path(project.getElementName()).append(ProjectUtils.SRC_FOLDER).makeAbsolute());
   assertNotNull("the 'src' package fragment root must exist", root);
   assertTestSource(root, TESTING_PACKAGE, "TestClass1");
   IJavaElement element = project.findElement(new Path("a/b/c/TestClass1.java"));
   assertNotNull("the class a.b.c.TestClass1 must exist in the project", element);
   element.getResource().delete(true, new NullProgressMonitor());
   IApiDescription desc = getTestProjectApiDescription();
   assertNotNull("the testing project api description must exist", desc);
   IApiAnnotations annot = desc.resolveAnnotations(Factory.typeDescriptor("a.b.c.TestClass1"));
   assertNull("the annotations for a.b.c.TestClass1 should no longer be present", annot);
 }
 /**
  * Tests that removing a tag from a type updates the workspace baseline
  *
  * <p>This test removes a @noinstantiate tag to an inner class in TestClass3
  */
 public void testWPUpdateSourceTypeRemoveTag() throws Exception {
   IJavaProject project = getTestingProject();
   assertNotNull("The testing project must exist", project);
   IPackageFragmentRoot root =
       project.findPackageFragmentRoot(
           new Path(project.getElementName()).append(ProjectUtils.SRC_FOLDER).makeAbsolute());
   assertNotNull("the 'src' package fragment root must exist", root);
   assertTestSource(root, TESTING_PACKAGE, "TestClass3");
   ICompilationUnit element =
       (ICompilationUnit) project.findElement(new Path("a/b/c/TestClass3.java"));
   assertNotNull("TestClass3 must exist in the test project", element);
   updateTagInSource(element, "InnerTestClass3", null, "@noextend", true);
   IApiDescription desc = getTestProjectApiDescription();
   assertNotNull("the testing project api description must exist", desc);
   IApiAnnotations annot =
       desc.resolveAnnotations(Factory.typeDescriptor("a.b.c.TestClass3$InnerTestClass3"));
   assertNotNull("the annotations for 'InnerTestClass3' cannot be null", annot);
   assertTrue(
       "there must be a no restrictions for 'InnerTestClass3'",
       (annot.getRestrictions() & RestrictionModifiers.NO_INSTANTIATE) == 0);
 }