Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
d12c7d39
Commit
d12c7d39
authored
Mar 18, 2021
by
Matthias Betz
Browse files
added more CityDoctorModel tests
parent
fde5999f
Pipeline
#2405
passed with stage
in 2 minutes and 59 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/test/java/de/hft/stuttgart/citydoctor2/datastructure/CityDoctorModelTest.java
View file @
d12c7d39
...
@@ -329,7 +329,7 @@ public class CityDoctorModelTest {
...
@@ -329,7 +329,7 @@ public class CityDoctorModelTest {
}
}
@Test
@Test
public
void
testReplace
Feature
()
{
public
void
testReplace
Building
()
{
File
f
=
Mockito
.
mock
(
File
.
class
);
File
f
=
Mockito
.
mock
(
File
.
class
);
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
ParserConfiguration
config
=
new
ParserConfiguration
(
8
,
false
);
CityDoctorModel
model
=
new
CityDoctorModel
(
config
,
f
);
CityDoctorModel
model
=
new
CityDoctorModel
(
config
,
f
);
...
@@ -340,5 +340,84 @@ public class CityDoctorModelTest {
...
@@ -340,5 +340,84 @@ public class CityDoctorModelTest {
model
.
replaceFeature
(
b1
,
b2
);
model
.
replaceFeature
(
b1
,
b2
);
assertEquals
(
b2
,
model
.
getBuildings
().
get
(
0
));
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
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment