implemented Method getFilteredPlantListByString in PlantListModel
This commit is contained in:
@@ -146,4 +146,24 @@ class PlantListModelTest {
|
||||
assertEquals(1, plantListResult.size());
|
||||
assertEquals(examplePlantList.get(0), plantListResult.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getFilteredPlantListByString() throws HardinessZoneNotSetException, IOException {
|
||||
model.setCurrentZone(HardinessZone.ZONE_1A);
|
||||
List<Plant> plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "#2");
|
||||
assertEquals(0, plantListResult.size());
|
||||
plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "#20");
|
||||
assertEquals(1, plantListResult.size());
|
||||
assertEquals(examplePlantList.get(0), plantListResult.get(0));
|
||||
plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "#a2");
|
||||
assertEquals(0, plantListResult.size());
|
||||
plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "onion");
|
||||
assertEquals(1, plantListResult.size());
|
||||
assertEquals(examplePlantList.get(0), plantListResult.get(0));
|
||||
plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "white roots");
|
||||
assertEquals(1, plantListResult.size());
|
||||
assertEquals(examplePlantList.get(1), plantListResult.get(0));
|
||||
plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "apple");
|
||||
assertEquals(0, plantListResult.size());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user