mourning-ember / src / test / java / dev / llan / model / pieces / attributes / BaseStatsTest.java
BaseStatsTest.java
Raw
package dev.llan.model.pieces.attributes;

import dev.llan.model.pieces.attributes.stats.BaseStats;
import dev.llan.model.pieces.attributes.stats.BaseStatsBuilder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class BaseStatsTest {
  private BaseStats stats;

  @BeforeEach
  void setUp() {
    stats =
        new BaseStatsBuilder()
            .attack(5.0)
            .notificationRadius(10.0)
            .maxHealth(20.0)
            .speed(5.0)
            .build();
  }

  @Test
  void getAttack() {
    assertEquals(5.0, stats.getAttack(), 0.0001);
  }

  @Test
  void changeHealth() {
    stats.changeHealthRatio(-0.25);
    assertEquals(15.0, stats.getHealth(), 0.0001);
  }

  @Test
  void decreaseMovement() {
    stats.changeMovementRatio(-0.4);
    assertEquals(3.0, stats.getMovement());
  }

  @Test
  void getNotificationRadius() {
    assertEquals(10.0, stats.getNotificationRadius(), 0.0001);
  }
}