Exemple #1
0
  @Test
  public void getChild() {
    packageExplorer
        .getProject(ProjectItemTest.PROJECT_NAME)
        .getProjectItem(ProjectItemTest.PROJECT_ITEM_TEXT)
        .select();

    final String javaClassName = "TestClass";
    createJavaClass(javaClassName);

    ProjectItem piDefaultPackage =
        packageExplorer
            .getProject(ProjectItemTest.PROJECT_NAME)
            .getProjectItem(ProjectItemTest.PROJECT_ITEM_TEXT)
            .getChild(ProjectItemTest.DEFAULT_PACKAGE_TEXT);

    assertTrue(
        "Found Project Item has to have text "
            + ProjectItemTest.DEFAULT_PACKAGE_TEXT
            + " but is "
            + piDefaultPackage.getText(),
        piDefaultPackage.getText().equals(ProjectItemTest.DEFAULT_PACKAGE_TEXT));

    /* select default package */
    piDefaultPackage.select();
    assertTrue(
        "Project item " + ProjectItemTest.DEFAULT_PACKAGE_TEXT + " is not selected",
        piDefaultPackage.isSelected());
  }
Exemple #2
0
 @Test
 public void select() {
   projectItem.select();
   assertTrue(
       "Project item " + ProjectItemTest.PROJECT_ITEM_TEXT + " is not selected",
       projectItem.isSelected());
 }
Exemple #3
0
  @Test
  public void getChildren() {
    packageExplorer
        .getProject(ProjectItemTest.PROJECT_NAME)
        .getProjectItem(ProjectItemTest.PROJECT_ITEM_TEXT)
        .select();

    final String[] javaClassNames = new String[] {"TestClass01", "TestClass02"};

    createJavaClass(javaClassNames[0]);
    createJavaClass(javaClassNames[1]);

    List<ProjectItem> srcChildrens = projectItem.getChildren();

    /* src folder has to contain default package*/
    assertTrue(
        PROJECT_ITEM_TEXT
            + " has to contain only 1 Project Item"
            + " but there are "
            + srcChildrens.size()
            + " Project Items",
        srcChildrens.size() == 1);

    ProjectItem piDefaultPackage = srcChildrens.get(0);
    assertTrue(
        "Found Project Item has to have text "
            + ProjectItemTest.DEFAULT_PACKAGE_TEXT
            + " but is "
            + piDefaultPackage.getText(),
        piDefaultPackage.getText().equals(DEFAULT_PACKAGE_TEXT));

    /* default package has to contain created classes */
    List<ProjectItem> defaultPackageChildrens = piDefaultPackage.getChildren();
    assertTrue(
        PROJECT_ITEM_TEXT
            + " has to contain "
            + javaClassNames.length
            + " Project Items"
            + " but there are "
            + defaultPackageChildrens.size()
            + " Project Items",
        defaultPackageChildrens.size() == javaClassNames.length);

    for (int i = 0; i < javaClassNames.length; i++) {
      ProjectItem pi = defaultPackageChildrens.get(i);
      String javaClassFileName = javaClassNames[i] + ".java";
      assertTrue(
          "Found Project Item has to have text " + javaClassFileName + " but is " + pi.getText(),
          pi.getText().equals(javaClassFileName));
    }
  }
Exemple #4
0
 @Test
 public void delete() {
   projectItem.delete();
   assertFalse(
       "Project "
           + ProjectItemTest.PROJECT_NAME
           + " contains project item "
           + ProjectItemTest.PROJECT_ITEM_TEXT
           + " but it should be deleted.",
       packageExplorer
           .getProject(ProjectItemTest.PROJECT_NAME)
           .containsItem(ProjectItemTest.PROJECT_ITEM_TEXT));
 }