27 lines
649 B
Java
27 lines
649 B
Java
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 TrainCarTest {
|
|
|
|
private TrainCar trainCar;
|
|
|
|
@BeforeEach
|
|
public void setUp() {
|
|
trainCar = new TrainCar(3000);
|
|
}
|
|
|
|
@Test
|
|
@DisplayName("Dead weight equals total weight")
|
|
public void testDeadWeight() {
|
|
assertEquals(3000, trainCar.getTotalWeight(), "Test initialization of dead weight");
|
|
|
|
trainCar.setDeadWeight(5000);
|
|
assertEquals(5000, trainCar.getTotalWeight(),
|
|
"Test that total weight equals set dead weight");
|
|
}
|
|
}
|