Commit d12c7d39 authored by Matthias Betz's avatar Matthias Betz
Browse files

added more CityDoctorModel tests

parent fde5999f
Pipeline #2405 passed with stage
in 2 minutes and 59 seconds
......@@ -329,7 +329,7 @@ public class CityDoctorModelTest {
}
@Test
public void testReplaceFeature() {
public void testReplaceBuilding() {
File f = Mockito.mock(File.class);
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = new CityDoctorModel(config, f);
......@@ -341,4 +341,83 @@ public class CityDoctorModelTest {
assertEquals(b2, model.getBuildings().get(0));
}
@Test(expected = IllegalStateException.class)
public void testReplaceBuildingMissing() {
File f = Mockito.mock(File.class);
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = new CityDoctorModel(config, f);
Building b1 = Mockito.mock(Building.class);
Building b2 = Mockito.mock(Building.class);
model.replaceFeature(b1, b2);
}
@Test
public void testReplaceVegetation() {
File f = Mockito.mock(File.class);
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = new CityDoctorModel(config, f);
Vegetation v1 = Mockito.mock(Vegetation.class);
Vegetation v2 = Mockito.mock(Vegetation.class);
model.addVegetation(v1);
assertEquals(v1, model.getVegetation().get(0));
model.replaceFeature(v1, v2);
assertEquals(v2, model.getVegetation().get(0));
}
@Test(expected = IllegalStateException.class)
public void testReplaceVegetationMissing() {
File f = Mockito.mock(File.class);
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = new CityDoctorModel(config, f);
Vegetation v1 = Mockito.mock(Vegetation.class);
Vegetation v2 = Mockito.mock(Vegetation.class);
model.replaceFeature(v1, v2);
}
@Test
public void testReplaceTransportation() {
File f = Mockito.mock(File.class);
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = new CityDoctorModel(config, f);
TransportationObject t1 = Mockito.mock(TransportationObject.class);
TransportationObject t2 = Mockito.mock(TransportationObject.class);
model.addTransportation(t1);
assertEquals(t1, model.getTransportation().get(0));
model.replaceFeature(t1, t2);
assertEquals(t2, model.getTransportation().get(0));
}
@Test(expected = IllegalStateException.class)
public void testReplaceTransportationMissing() {
File f = Mockito.mock(File.class);
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = new CityDoctorModel(config, f);
TransportationObject t1 = Mockito.mock(TransportationObject.class);
TransportationObject t2 = Mockito.mock(TransportationObject.class);
model.replaceFeature(t1, t2);
}
@Test
public void testReplaceWater() {
File f = Mockito.mock(File.class);
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = new CityDoctorModel(config, f);
WaterObject t1 = Mockito.mock(WaterObject.class);
WaterObject t2 = Mockito.mock(WaterObject.class);
model.addWater(t1);
assertEquals(t1, model.getWater().get(0));
model.replaceFeature(t1, t2);
assertEquals(t2, model.getWater().get(0));
}
@Test(expected = IllegalStateException.class)
public void testReplaceWaterMissing() {
File f = Mockito.mock(File.class);
ParserConfiguration config = new ParserConfiguration(8, false);
CityDoctorModel model = new CityDoctorModel(config, f);
WaterObject t1 = Mockito.mock(WaterObject.class);
WaterObject t2 = Mockito.mock(WaterObject.class);
model.replaceFeature(t1, t2);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment