diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/UserType.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/UserType.java index 8c8cbeb..7539a2a 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/UserType.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/UserType.java @@ -69,8 +69,6 @@ public abstract class UserType { } - - public boolean equals(UserType other){ if(this.username.equals(other.username)&&this.password.equals(other.password)&& this.firstname.equals(other.firstname)&&this.lastname.equals(other.lastname)){ diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/AdminTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/AdminTest.java new file mode 100644 index 0000000..2eabc9d --- /dev/null +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/AdminTest.java @@ -0,0 +1,23 @@ +package com.uottawa.olympus.olympusservices; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class AdminTest { + + @Test + public void testAdmin() { + Admin admin = new Admin(); + String username = admin.getUsername(); + String password = admin.getPassword(); + String firstname = admin.getFirstname(); + String lastname = admin.getLastname(); + String role = admin.getRole(); + assertEquals("Admin", role); + assertEquals("admin", username); + assertEquals("admin", password); + assertEquals("Admin", firstname); + assertEquals("Admin", lastname); + } +} \ No newline at end of file diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/HomeOwnerTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/HomeOwnerTest.java new file mode 100644 index 0000000..1453b21 --- /dev/null +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/HomeOwnerTest.java @@ -0,0 +1,27 @@ +package com.uottawa.olympus.olympusservices; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class HomeOwnerTest { + + @Test + public void testHomeOwner(){ + UserType user = new HomeOwner( "John123", "1234567890", "John", "Doe" ); + String role = user.getRole(); + assertEquals("HomeOwner", role); + assertEquals("John123", user.getUsername()); + assertEquals("1234567890", user.getPassword()); + assertEquals("John", user.getFirstname()); + assertEquals("Doe", user.getLastname()); + user.setUsername( "username" ); + user.setPassword( "password" ); + user.setFirstname( "firstname" ); + user.setLastname( "lastname" ); + assertNotEquals("John123", user.getUsername()); + assertNotEquals("1234567890", user.getPassword()); + assertNotEquals("John", user.getFirstname()); + assertNotEquals("Doe", user.getLastname()); + } +} diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/LogInTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/LogInTest.java deleted file mode 100644 index 572d402..0000000 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/LogInTest.java +++ /dev/null @@ -1,5 +0,0 @@ -import static org.junit.Assert.*; - -public class LogInTest { - -} \ No newline at end of file diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java index 23a9997..22cc495 100644 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java @@ -1,5 +1,14 @@ +package com.uottawa.olympus.olympusservices; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + import static org.junit.Assert.*; public class ServiceProviderTest { + @Test + public void addService() { + } } \ No newline at end of file diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java new file mode 100644 index 0000000..87aaa31 --- /dev/null +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java @@ -0,0 +1,4 @@ +package com.uottawa.olympus.olympusservices; + +public class ServiceTest { +} diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/SignUpTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/SignUpTest.java deleted file mode 100644 index c349949..0000000 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/SignUpTest.java +++ /dev/null @@ -1,5 +0,0 @@ -import static org.junit.Assert.*; - -public class SignUpTest { - -} \ No newline at end of file diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/UserTypeTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/UserTypeTest.java new file mode 100644 index 0000000..1934f15 --- /dev/null +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/UserTypeTest.java @@ -0,0 +1,30 @@ +package com.uottawa.olympus.olympusservices; + +import android.view.View; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class UserTypeTest { + + @Test + public void userTypeComparaison() { + UserType user = new HomeOwner("John123", "1234567890", "John", "Doe"); + UserType admin = new Admin(); + UserType serviceprovider = new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe"); + boolean userservice = user.equals(serviceprovider); + boolean useradmin = user.equals(admin); + boolean serviceadmin = serviceprovider.equals(admin); + assertNotEquals( true, useradmin ); + assertNotEquals( true, serviceadmin ); + assertNotEquals( true, userservice ); + user.setFirstname(serviceprovider.getFirstname()); + user.setUsername(serviceprovider.getUsername()); + userservice = user.equals(serviceprovider); + assertEquals( true, userservice ); + } +} \ No newline at end of file