Search code examples
javaspringjunit

How do you write a JUnit test for an empty function Pointcut


I am trying to write a JUnit test for this method. I am not familiar with Pointcut. Any advice?

 /**
     * Pointcut that matches all repositories, services and Web REST endpoints.
     */
    @Pointcut("within(@org.springframework.stereotype.Repository *)" +
        " || within(@org.springframework.stereotype.Service *)" +
        " || within(@org.springframework.web.bind.annotation.RestController *)")
    public void springBeanPointcut() {
        // Method is empty as this is just a Pointcut, the implementations are in the advices.
    }

Solution

  • Just make a new test and have it call springBeanPointcut()