Hello!

Thanks for very fast response.

Alexander,
I'm currently trying to generate an aspect based from annotation
information in java source code. The generated aspect is what I wanted to
test. I use it in my personal project for android A/B
Test<https://github.com/dieend/ADIN-Android-Split-Testing-Library>.
The aspect class is really simple in general. What I wanted to test are:
 - the aspect compiles correctly
 - the pointcut really cut the method

Lets use this for sample:
Class Hello {
  void String hello() {
    return "hello";
  }
  void String aloha() {
    return "aloha";
  }
}
aspect privileged HelloAspect {
  around(Hello h): target(h), execution(void Hello.hello()) {
   if (SomeOtherClassSingleton.use()) {
     proceed(h);
   } else {
     h.aloha();
   }
  }
}

I want to check the aspect compiles correctly, and the method hello return
"aloha" if SomeOtherClassSingleton.use() returns true.


Sean,
That looks really promising! Thank you, I was also searching in SO, but
maybe my query isn't good enough or the question still not popular enough
and beaten by Spring question.

I have tried your class, but I got this error when running the test (I
modified the class so the info can be accessed when calling compile method):

directory classpath entry does not exist: C:\Program
Files\Java\jdk1.6.0_38\jre\lib\sunrsasign.jar
directory classpath entry does not exist: C:\Program
Files\Java\jdk1.6.0_38\jre\lib\modules\jdk.boot.jar
zipfile classpath entry does not exist: C:\Program
Files\Java\jdk1.6.0_38\jre\classes
Pipelining compilation
compiling /path/to/aspect.aj
compiling /path/to/Hello.java
Compiler took 507ms

and then the result return Result.ERROR. Do you have any idea?

Thanks!

--
*Muhammad Adinata*
TOKI 2009
SMAN Plus Provinsi Riau 9th
13509022 - Informatika ITB 2009


On Thu, Feb 6, 2014 at 11:07 PM, Sean Patrick Floyd <
[email protected]> wrote:

> I have asked (and answered) a similar question recently:
> http://stackoverflow.com/q/19980876/342852
>
> Sean Floyd
>
>
> On Thu, Feb 6, 2014 at 4:56 PM, Muhammad Adinata <[email protected]>wrote:
>
>> Hello,
>>
>> Is there any way to test standar aspect class (not annotation style) with
>> JUnit or other testing framework?
>>
>> I can't found any guide about it in the documentation, and the annotation
>> style generally tested for Spring.
>>
>> --
>> *Muhammad Adinata*
>> 13509022 - Informatika ITB 2009
>>
>> _______________________________________________
>> aspectj-users mailing list
>> [email protected]
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>>
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to