Create Java Annotation Wrapper

Annotations are quite limited. Unfortunately, I don't see a way, but I might be wrong.


My original tests was like this:

@Test
@SqlGroup(
    {
        @Sql(
            executionPhase = BEFORE_TEST_METHOD,
            config = @SqlConfig(transactionMode = ISOLATED),
            scripts = {"classpath:test/sqls/_truncate_tables.sql"}
        ),
        @Sql(
            executionPhase = AFTER_TEST_METHOD,
            config = @SqlConfig(transactionMode = ISOLATED),
            scripts = {"classpath:test/sqls/_truncate_tables.sql"}
        )
    }
)
public void countTeams_countOnEmptyTable_returnsWithEmptyList() {}

And whit this base annotation I cleaned up the test files:

 @Target({ElementType.TYPE, ElementType.METHOD})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
 @Inherited
 @SqlGroup(
        {
            @Sql(
                executionPhase = BEFORE_TEST_METHOD,
                config = @SqlConfig(transactionMode = ISOLATED),
                scripts = {"classpath:test/sqls/_truncate_tables.sql"}
            ),
            @Sql(
                executionPhase = AFTER_TEST_METHOD,
                config = @SqlConfig(transactionMode = ISOLATED),
                scripts = {"classpath:test/sqls/_truncate_tables.sql"}
            )
        }
)

And finally I got this clean version:

@Test
@BaseSqlGroup
public void countTeams_countOnEmptyTable_returnsWithEmptyList(){}