2 Replies Latest reply on Apr 7, 2018 10:12 AM by desmond95

    Roaster: addAnnotation(org.JUnit.Test)

    desmond95

      Hello everybody,

       

      actually I asked a similar question before in Roaster 2.20.1.final: java.lang.NoClassDefFoundError:

      But my current Issue seems a bit different since the fix from the thread above does not work.

       

      I am trying to add the org.junit.Test annotation to one of my generated methods.

       

      When I run this code...

       

      MethodSource<JavaClassSource> method = javaClass.addMethod();

      method.setName(methodName);

      method.setPrivate();

      method.setReturnTypeVoid();

      method.setBody("");

      method.addAnnotation(Test.class);

       

      ... I get the following error:

      java.lang.NoClassDefFoundError: org/junit/Test

       

      Like mentioned in the thread above, I deleted my ~/.m2/repository/junit directory and tried again but the error is still present.

      Also I tried other annotations from external libraries like @Data by lombok and it works fine.  

       

      I'm using JUnit 4.5 but it doesn't work for any other JUnit-Version as well.

       

      Does anyone have a clue whats wrong in this case? I would really appreciate every kind of help.