Compare commits
No commits in common. "6c00b7f182f55b70bd829bacd39b508c692c9e9e" and "f452b73233b47652879496b9daae9ccfe079ce04" have entirely different histories.
6c00b7f182
...
f452b73233
|
@ -110,9 +110,7 @@ public class PlantListModel {
|
||||||
* @throws IOException If the database cannot be accessed
|
* @throws IOException If the database cannot be accessed
|
||||||
*/
|
*/
|
||||||
public List<Plant> getFilteredPlantListByString(HardinessZone zone, String searchString) throws HardinessZoneNotSetException, IOException {
|
public List<Plant> getFilteredPlantListByString(HardinessZone zone, String searchString) throws HardinessZoneNotSetException, IOException {
|
||||||
if(searchString.length() == 0){
|
if(searchString.charAt(0) == '#') {
|
||||||
return getPlantList(zone);
|
|
||||||
} else if(searchString.charAt(0) == '#') {
|
|
||||||
try {
|
try {
|
||||||
return getFilteredPlantListById(zone, Long.parseLong(searchString.substring(1)));
|
return getFilteredPlantListById(zone, Long.parseLong(searchString.substring(1)));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
|
|
@ -173,8 +173,6 @@ class PlantListModelTest {
|
||||||
assertEquals(examplePlantList.get(1), plantListResult.get(0));
|
assertEquals(examplePlantList.get(1), plantListResult.get(0));
|
||||||
plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "apple");
|
plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "apple");
|
||||||
assertEquals(0, plantListResult.size());
|
assertEquals(0, plantListResult.size());
|
||||||
plantListResult = model.getFilteredPlantListByString(HardinessZone.ZONE_8A, "");
|
|
||||||
assertEquals(3, plantListResult.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue