最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Im trying to execute Junit tests in a group project but this error doesnt stop to appear in eclipse console: - Stack Over

programmeradmin1浏览0评论

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
    }
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论