Annotation with parameters already filled in

24 Views Asked by At

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
}
0

There are 0 best solutions below