0

I am looking for a way to standarize display name in Unit Test using @DisplayName(value = "...")

I would like to create custom annotation:

@TestDisplayName(method = "testMethod", when = "input is null", expected = "should return something"

and use this custom annotation should use JUnit's @DisplayName annotation in this way (inserts @TestDisplayName's arguments between constant strings):

@DisplayName(value = "Method: " + TestDisplayName.method + " - When: " + TestDisplayName.when + " - Expected: " + TestDisplayName.expected);
lomasz
  • 67
  • 9

1 Answers1

1

From the previous stackoverflow conversations i understand that there is no way to pass the values for an Annotation dynamically. Java Annotations values provided in dynamic manner please check on this page whether you are trying the same here.

Mohan Raj
  • 23
  • 4