Error in question:
I have tried to uninstall and install again eclipse, uninstalled and installed the Junit 5 library, and Restart Eclipse
By the way Im using Eclipse IDE for Java Developers Version: 2024-12 (4.34.0)
This is the code of the test class
package ProyectoSupervivencia;
import static .junit.jupiter.api.Assertions.assertTrue;
import .junit.jupiter.api.Test;
public class pruebas {
private Jugador jugador;
@Test
public void testDescansarConAgua() {
jugador.getAlimentos()[0] = 1; // Agua disponible
int sedInicial = jugador.getSalud();
jugador.descansar(8);
assertTrue(jugador.getSalud() > sedInicial); // Debe aumentar la sed
}
@Test
public void testDescansarSinAgua() {
jugador.getAlimentos()[0] = 0; // Sin agua
int saludInicial = jugador.getSalud();
jugador.descansar(8);
assertTrue(jugador.getSalud() < saludInicial); // Salud debe disminuir
}
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744770816a4592746.html
评论列表(0条)