Speed Fox
Speed Fox

Reputation: 79

Annotation with parameters already filled in

In the tech stack I'm working with we have an existing Java annotation for our unit tests which gets used like

@TeamTest(size = TestSize.Medium, timeout = 5000)
void myTest() {
  // setup and asserts and stuff
}

Is there a way to setup a separate annotation that would already have the size and timeout variables stored? Ex:

@TeamTest(size = TestSize.Medium, timeout = 5000)
public static @interface MediumTest {}

That way I could just do

@MediumTest
void myTest() {
  // setup and asserts and stuff
}

Upvotes: 0

Views: 26

Answers (0)

Related Questions