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.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
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.assertNotSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
|
|
||||||
@ -17,12 +18,12 @@ public class CampaignTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void AllSettersGettersWorkCorrcectly() {
|
void VehicleSettersGettersWorkCorrcectly() {
|
||||||
Object[] oldVehicles = campaign.getVehicles();
|
ArrayList<Vehicle> oldVehicles = campaign.getVehicles();
|
||||||
assertArrayEquals(campaign.getVehicles(), oldVehicles);
|
assertSame(oldVehicles, campaign.getVehicles());
|
||||||
Vehicle[] newVehicles = new Bus[150];
|
ArrayList<Vehicle> newVehicles = new ArrayList<>();
|
||||||
for (int i = 0; i < 150; i++) {
|
for (int i = 0; i < 150; i++) {
|
||||||
newVehicles[i] = new Bus(5);
|
newVehicles.add(new Bus(5));
|
||||||
}
|
}
|
||||||
campaign.setVehicles(newVehicles);
|
campaign.setVehicles(newVehicles);
|
||||||
assertNotSame(oldVehicles, newVehicles);
|
assertNotSame(oldVehicles, newVehicles);
|
||||||
|
Loading…
Reference in New Issue
Block a user