Results 1 to 5 of 5

Thread: Please, I 'd like an explanation regarding the Roo annotations (for testing)

  1. #1
    Join Date
    May 2006
    Location
    Madrid
    Posts
    383

    Default Please, I 'd like an explanation regarding the Roo annotations (for testing)

    Hello,

    I have an integration test, with the limit for the find all expanded in the Roo annotation:

    Code:
    @RooIntegrationTest(entity = Account.class, findAllMaximum=500)
    public class AccountIntegrationTest {
    I need another test and I'd like to use the value from this annotation, but it doesn't work:

    Code:
        @Test
        public void testFindAccountsByAmountGreaterThan() {
            //...
            long count = Account.countAccounts();
            //It doesn't work either with this.getClass().getAnnotation...
            int findAllMaximum = AccountIntegrationTest .class.getAnnotation(RooIntegrationTest.class).findAllMaximum();
    It seems the Roo annotations doesnt' belong to the class, the red line throws a NullPointerException.

    Debugging (AccountIntegrationTest.class.getAnnotations()) I can see this class has:
    @org.junit.runner.RunWith
    @org.springframework.test.context.ContextConfigura tion
    @org.springframework.transaction.annotation.Transa ctional
    @org.springframework.beans.factory.annotation.Conf igurable

    Am I doing something wrong, or is this the expected behavour?

  2. #2
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    668

    Default

    Roo annotations have compile-time retention, which means you can't read their values at runtime.

  3. #3
    Join Date
    May 2006
    Location
    Madrid
    Posts
    383

    Default

    Thank you very much.

    I have to pay more attention to the things I'm doing (I'm afraid yesterday was a bad day for me)

    Greetings

  4. #4
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    668

    Default

    It's OK, we all have days like that! I did think it was an odd question coming from a user as experienced as you!

  5. #5
    Join Date
    May 2006
    Location
    Madrid
    Posts
    383

    Default

    Thank you very much, indeed.

    It's really a pleasure to participate in the Spring community.

    Greetings.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •