package oving7.train; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; public class CargoCarTest { private CargoCar cargoCar; @BeforeEach public void setUp() { cargoCar = new CargoCar(3000, 2000); } @Test @DisplayName("Check total weight") public void testWeight() { assertEquals(5000, cargoCar.getTotalWeight(), "Test total weight after initialization"); cargoCar.setCargoWeight(4000); assertEquals(7000, cargoCar.getTotalWeight(), "Test total weight after changing cargo weight"); assertEquals(4000, cargoCar.getCargoWeight(), "Test cargo weight after changing the weight"); } }