Пример #1
0
  @Test
  public void testDuplicateEntry() throws Exception {
    // it's possible to pass twice the same file as parameter
    // the virtual folder removes the duplicate before passing to JDT
    try {
      String duplicateEntry = "src/test/resources/spoon/test/api/Foo.java";

      // check on the JDK API
      // this is later use by FileSystemFile
      assertTrue(
          new File(duplicateEntry)
              .getCanonicalFile()
              .equals(new File("./" + duplicateEntry).getCanonicalFile()));

      Launcher.main(
          new String[] {
            "-i",
            // note the nasty ./
            duplicateEntry + File.pathSeparator + "./" + duplicateEntry,
            "-o",
            "target/spooned/apitest"
          });
    } catch (IllegalArgumentException e) // from JDT
    {
      fail();
    }
  }
Пример #2
0
 public static void main(java.lang.String[] args) {
   java.lang.String[] spoonArgs =
       new java.lang.String[] {
         "-i",
         "C:/workspace/idlScrum/src/main/java",
         "-p",
         "fil.iagl.idl.processor.AnnotationProcessor",
         "-x"
       };
   try {
     spoon.Launcher.main(spoonArgs);
   } catch (java.lang.Exception e) {
     e.printStackTrace();
   }
 }
Пример #3
0
 @Test
 public void testDuplicateFilePlusFolder() throws Exception {
   // more complex case: a file is given, together with the enclosing folder
   try {
     Launcher.main(
         new String[] {
           "-i",
           "src/test/resources/spoon/test/api/"
               + File.pathSeparator
               + "src/test/resources/spoon/test/api/Foo.java",
           "-o",
           "target/spooned/apitest"
         });
   } catch (IllegalArgumentException e) // from JDT
   {
     fail();
   }
 }
Пример #4
0
 @Test
 public void testDuplicateFolder() throws Exception {
   // it's possible to pass twice the same folder as parameter
   // the virtual folder removes the duplicate before passing to JDT
   try {
     String duplicateEntry = "src/test/resources/spoon/test/api/";
     Launcher.main(
         new String[] {
           "-i",
           duplicateEntry + File.pathSeparator + "./" + duplicateEntry,
           "-o",
           "target/spooned/apitest"
         });
   } catch (IllegalArgumentException e) // from JDT
   {
     fail();
   }
 }
Пример #5
0
 @Test(expected = Exception.class)
 public void testNotValidInput() throws Exception {
   String invalidEntry = "does/not/exists//Foo.java";
   Launcher.main(new String[] {"-i", invalidEntry, "-o", "target/spooned/apitest"});
 }