diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..cb67bab4 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +ListyCity \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 00000000..61a9130c --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 00000000..a5f05cd8 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..d5d35ec4 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/.idea/.gitignore b/app/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/app/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/app/.idea/gradle.xml b/app/.idea/gradle.xml new file mode 100644 index 00000000..2252d95b --- /dev/null +++ b/app/.idea/gradle.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/app/.idea/misc.xml b/app/.idea/misc.xml new file mode 100644 index 00000000..f8458542 --- /dev/null +++ b/app/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/.idea/modules.xml b/app/.idea/modules.xml new file mode 100644 index 00000000..e1f9e1c0 --- /dev/null +++ b/app/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/simpleparadox/listycity/City.java b/app/src/main/java/com/example/simpleparadox/listycity/City.java index ad43a057..b4051ea7 100644 --- a/app/src/main/java/com/example/simpleparadox/listycity/City.java +++ b/app/src/main/java/com/example/simpleparadox/listycity/City.java @@ -1,8 +1,12 @@ package com.example.simpleparadox.listycity; +/** + * the lab says to add a test for functionality that will fail (later implement it, i will choose the city class and have it and set a neighbouring city field + */ public class City implements Comparable{ private String city; private String province; + private City neighbour; City(String city, String province){ this.city = city; @@ -17,6 +21,14 @@ String getProvinceName(){ return this.province; } + public City getNeighbour() { + return neighbour; + } + + public void setNeighbour(City neighbour) { + this.neighbour = neighbour; + } + @Override public int compareTo(City o) { return city.compareTo(o.getCityName()); diff --git a/app/src/test/java/com/example/simpleparadox/listycity/CityListTest.java b/app/src/test/java/com/example/simpleparadox/listycity/CityListTest.java index 787eab7e..25805c39 100644 --- a/app/src/test/java/com/example/simpleparadox/listycity/CityListTest.java +++ b/app/src/test/java/com/example/simpleparadox/listycity/CityListTest.java @@ -93,4 +93,5 @@ void testCountCities() { assertEquals(1, cityList.countCities()); } + } \ No newline at end of file diff --git a/app/src/test/java/com/example/simpleparadox/listycity/CityTest.java b/app/src/test/java/com/example/simpleparadox/listycity/CityTest.java new file mode 100644 index 00000000..0ddd8ece --- /dev/null +++ b/app/src/test/java/com/example/simpleparadox/listycity/CityTest.java @@ -0,0 +1,26 @@ +package com.example.simpleparadox.listycity; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class CityTest { + + private City mockCity() { + return new City("Edmonton", "Alberta"); + } + + private City mockCity1() { + return new City("Calgary", "Alberta"); + } + + @Test + void SetNeighbourTest(){ + + City testCity = mockCity(); + testCity.setNeighbour(mockCity1()); + + assertEquals(testCity.getNeighbour().getCityName(),"Calgary"); + } + +}