vendredi 14 septembre 2018

Is there a way in Java to get what method you are in right now? [duplicate]

I am writing some tests and want to display what tags are on a method.

@Tag("11019")
@Tag("justin rice")
@Tag("Bug 59674: Perkins Rollover Logic for Same Values [88372]")
@Test
public void testPerkins() {
    log("this test is testing:" + list of tag data);
}

Is there any "this" data that can find the method I am in or am I stuck with sending both the class and the method name to a utility?

log("this test is testing:{}", utils.findTagData(this, "testPerkins"));

I would like to just send: utils.findTagData(this);

I have thought of skimming the "stack" but that is a bit dirty.





Aucun commentaire:

Enregistrer un commentaire