Add oving 7

This commit is contained in:
Andreas Omholt Olsen
2026-03-06 10:59:33 +01:00
parent 6a27364518
commit 1deb0cc650
44 changed files with 1947 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
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");
}
}