permaculture playing cards*
The moose likes Java in General and the fly likes unable to print annotation value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "unable to print annotation value" Watch "unable to print annotation value" New topic
Author

unable to print annotation value

Jigeshs Shahs
Greenhorn

Joined: May 28, 2009
Posts: 26
Hi All,
I am using a selenium+cuke4duke tool to perform some GUI Testing and I am facing an issue with annotations

For a particular method i am using an assertion and this method calls another method of a different class
For e.g Method1 of class 1 is using assetion1 and Method1 calls Method2 which is in class2, now when the code is getting executed in method 2 what I want is that it should print the annotation of method1 .
Is there any way through which I can do it
The code for both the files are given below
StuffSteps.java---This file contains anotation



tpcomm ---- this is a temporary file for testing pupose here i tried to print the annonation @Then("I shouldfff have stomach") which is present in method iShouldHaveNCukes()

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

Please UseCodeTags next time, and don't forget to add proper indentation to your code when posting it. I've had to add both.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jigeshs Shahs
Greenhorn

Joined: May 28, 2009
Posts: 26
thanks ....i lll take care of it next tym onwards..
is there any solution for the query that I asked
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

You're using clazz.getAnnotations(), which returns the annotations for the class - not for fields, methods, nested classes etc, but only the class itself. To get the method annotations, you'll need to loop through your methods and call getAnnotations() for each of them separately.
 
Don't get me started about those stupid light bulbs.
 
subject: unable to print annotation value