Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,13 @@ public void delete(City city) {
public int countCities() {
return cities.size();
}

public boolean checkEmpty(){
if (cities.size() == 0) {
return true;
}

return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import org.junit.jupiter.api.Test;


import java.util.ArrayList;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

class CityListTest {
Expand Down Expand Up @@ -93,4 +96,15 @@ void testCountCities() {

assertEquals(1, cityList.countCities());
}

@Test
void testCheckEmpty() {
CityList cityList = new CityList();
City city = new City("Victoria", "British Columbia");
cityList.add(city);
assertFalse(cityList.checkEmpty());
cityList.delete(city);
assertTrue(cityList.checkEmpty());

}
}