Add oving 7
This commit is contained in:
28
src/test/java/oving7/train/CargoCarTest.java
Normal file
28
src/test/java/oving7/train/CargoCarTest.java
Normal 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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user