package thb.jeanluc.adventure.model;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

class DirectionTest {

    @Test
    void getOpposite_pairsAreSymmetric() {
        for (Direction d : Direction.values()) {
            assertThat(d.getOpposite().getOpposite()).isEqualTo(d);
        }
    }

    @Test
    void fromString_caseInsensitive_returnsEnum() {
        assertThat(Direction.fromString("north")).isEqualTo(Direction.NORTH);
        assertThat(Direction.fromString("EAST")).isEqualTo(Direction.EAST);
        assertThat(Direction.fromString(" west ")).isEqualTo(Direction.WEST);
    }

    @Test
    void fromString_unknown_throws() {
        assertThatThrownBy(() -> Direction.fromString("up"))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessageContaining("up");
    }

    @Test
    void fromString_null_throws() {
        assertThatThrownBy(() -> Direction.fromString(null))
                .isInstanceOf(IllegalArgumentException.class);
    }

    @Test
    void getLabel_isLowercase() {
        assertThat(Direction.NORTH.getLabel()).isEqualTo("north");
    }
}
