package cz.jzitnik.game.handlers.rightclick;

import cz.jzitnik.game.annotations.RightClickLogic;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.reflections.Reflections;

import java.util.Set;
import static org.junit.jupiter.api.Assertions.*;

class RightClickHandlerProviderTest {
    @Test
    @DisplayName("All classes annotated with @RightClickLogic must implement RightClickHandler")
    void allClassesPickupImplementHandler() {
        Reflections reflections = new Reflections("cz.jzitnik.game");
        Set<Class<?>> handlerClasses = reflections.getTypesAnnotatedWith(RightClickLogic.class);

        for (Class<?> clazz : handlerClasses) {
            boolean implementsClass = RightClickHandler.class.isAssignableFrom(clazz);
            assertTrue(implementsClass, "Class " + clazz.getName() + " annotated with @RightClickLogic does not implement RightClickHandler.");
        }
    }
}
