Update CampTest to match vehicles type
This commit is contained in:
parent
8ff0477873
commit
df214053bd
@ -1,7 +1,8 @@
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
|
||||
@ -17,12 +18,12 @@ public class CampaignTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void AllSettersGettersWorkCorrcectly() {
|
||||
Object[] oldVehicles = campaign.getVehicles();
|
||||
assertArrayEquals(campaign.getVehicles(), oldVehicles);
|
||||
Vehicle[] newVehicles = new Bus[150];
|
||||
void VehicleSettersGettersWorkCorrcectly() {
|
||||
ArrayList<Vehicle> oldVehicles = campaign.getVehicles();
|
||||
assertSame(oldVehicles, campaign.getVehicles());
|
||||
ArrayList<Vehicle> newVehicles = new ArrayList<>();
|
||||
for (int i = 0; i < 150; i++) {
|
||||
newVehicles[i] = new Bus(5);
|
||||
newVehicles.add(new Bus(5));
|
||||
}
|
||||
campaign.setVehicles(newVehicles);
|
||||
assertNotSame(oldVehicles, newVehicles);
|
||||
|
Loading…
Reference in New Issue
Block a user