From cb06782c04f3c36d5212ebff516824b61129215e Mon Sep 17 00:00:00 2001 From: IvanaE Date: Fri, 16 Nov 2018 15:50:56 -0500 Subject: [PATCH] fixed bad constructor --- .../.idea/caches/build_file_checksums.ser | Bin 537 -> 537 bytes .../olympus/olympusservices/DBHelper.java | 3 ++- .../olympusservices/ServiceProvider.java | 3 +-- .../olympusservices/DBIntegrationTest.java | 24 +++++++++--------- .../olympusservices/ServiceProviderTest.java | 2 +- .../olympusservices/ServiceProviderTest2.java | 2 +- .../olympus/olympusservices/ServiceTest.java | 10 ++++---- .../olympus/olympusservices/UserTypeTest.java | 2 +- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/OlympusServices/.idea/caches/build_file_checksums.ser b/OlympusServices/.idea/caches/build_file_checksums.ser index a2f140772f320874ad602dba2f767db16f15adfd..1253c2cb9173d9cf31ec70bb61e561bbe6b0ed75 100644 GIT binary patch delta 60 zcmV-C0K@;81epYom;@e24U>_aiIZvpa3LZ7bRrr+^B Sb6iPwVQyiQGyyh~>;WyGtrg<{ delta 66 zcmV-I0KNa21epYom;@brmj#iWi4Q14I$TwAWpZ;|VqtW3Xp^=9Hj^a*a1*WPSOtKy Y?=A2okcKFiw>@+K5tF|G8t<8 diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java index 6d0e729..5cb714e 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/DBHelper.java @@ -309,9 +309,10 @@ public class DBHelper extends SQLiteOpenHelper { usertype = new Admin(); } else if (cursor.getString(4) .equals("ServiceProvider")){ - ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname, address, phonenumber, companyname, licensed, description); + ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname, address, phonenumber, companyname, licensed); getAllServicesProvidedByUser(serviceProvider); getAvailabilities(serviceProvider); + serviceProvider.setDescription(description); usertype = serviceProvider; } else { usertype = new HomeOwner(username, password, firstname, lastname); diff --git a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProvider.java b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProvider.java index 68b3612..efc36c5 100644 --- a/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProvider.java +++ b/OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/ServiceProvider.java @@ -44,7 +44,7 @@ public class ServiceProvider extends UserType { * @param lastname String of the lastname. */ ServiceProvider(String username, String password, String firstname, String lastname, String address, - String phonenumber, String companyname, boolean licensed, String description){ + String phonenumber, String companyname, boolean licensed){ super(username, password, firstname, lastname); services = new ArrayList<>(); availabilities = new int[7][4]; @@ -52,7 +52,6 @@ public class ServiceProvider extends UserType { this.phonenumber = phonenumber; this.companyname = companyname; this.licensed = licensed; - this.description = description; } /** diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/DBIntegrationTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/DBIntegrationTest.java index 3c3d982..64b4972 100644 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/DBIntegrationTest.java +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/DBIntegrationTest.java @@ -52,7 +52,7 @@ public class DBIntegrationTest { //add a ServiceProvider to database originalUser = new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman", - "testaddress", "8888888888", "companydotcom", true, null); + "testaddress", "8888888888", "companydotcom", true); addedTwo = dbHelper.addUser(originalUser); //test retrieving ServiceProvider, and confirm that user info is the same as that in object passed @@ -79,7 +79,7 @@ public class DBIntegrationTest { public void testAddAndGetServiceProvider(){ //ServiceProviders have extra fields that can be added to the DB ServiceProvider serviceProvider = new ServiceProvider("7MuF1c59XP", null, null, null, - "testaddress", "8888888888", "companydotcom", true, "Not a penguin"); + "testaddress", "8888888888", "companydotcom", true); dbHelper.addUser(serviceProvider); //retrieve ServiceProvider and test the newly added fields @@ -102,7 +102,7 @@ public class DBIntegrationTest { public void testDeleteServiceProvider(){ //make sure all the rows related to ServiceProvider in all tables are deleted ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null); + "testaddress", "8888888888", "companydotcom", true); dbHelper.addUser(serviceProvider); Service service1 = new Service("Hitman", 12358); @@ -143,7 +143,7 @@ public class DBIntegrationTest { added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "seg2105", "Miguel", "Garzon")); assertTrue(!added); added = dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman", - "testaddress", "8888888888", "companydotcom", true, null)); + "testaddress", "8888888888", "companydotcom", true)); assertTrue(!added); dbHelper.deleteUser("jbO4aBF4dC"); @@ -279,7 +279,7 @@ public class DBIntegrationTest { @Test public void testAddAndDeleteServiceProvidedByUser(){ dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null)); + "testaddress", "8888888888", "companydotcom", true)); dbHelper.addService(new Service("Hitman", 12358)); boolean added = dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "hitman"); assertTrue(added); @@ -292,7 +292,7 @@ public class DBIntegrationTest { @Test public void testGetAllServicesProvidedByUserAndDeleteService(){ ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null); + "testaddress", "8888888888", "companydotcom", true); dbHelper.addUser(serviceProvider); Service service1 = new Service("Hitman", 12358); @@ -325,9 +325,9 @@ public class DBIntegrationTest { public void testGetAllProvidersByService(){ dbHelper.addService(new Service("Exterminating flatworms", 392.457)); dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null)); + "testaddress", "8888888888", "companydotcom", true)); dbHelper.addUser(new ServiceProvider("7MuF1c59XP", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null)); + "testaddress", "8888888888", "companydotcom", true)); dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "exterminating flatworms"); dbHelper.addServiceProvidedByUser("7MuF1c59XP", "exterminating flatworms"); @@ -347,7 +347,7 @@ public class DBIntegrationTest { @Test public void testDeleteServiceProvidedByUser(){ ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null); + "testaddress", "8888888888", "companydotcom", true); dbHelper.addUser(serviceProvider); Service service1 = new Service("Hitman", 12358); @@ -377,7 +377,7 @@ public class DBIntegrationTest { @Test public void testUpdateAndGetAvailability(){ ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null); + "testaddress", "8888888888", "companydotcom", true); serviceProvider.setAvailabilities(0, 4, 18, 19, 30); serviceProvider.setAvailabilities(1, 5, 20, 21, 11); serviceProvider.setAvailabilities(3, 7, 12, 15, 14); @@ -385,7 +385,7 @@ public class DBIntegrationTest { //TODO:Perhaps implement a deep clone function for UserType? ServiceProvider serviceProvider2 = new ServiceProvider("jbO4aBF4dC", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null); + "testaddress", "8888888888", "companydotcom", true); serviceProvider2.setAvailabilities(0, 4, 18, 19, 30); serviceProvider2.setAvailabilities(1, 5, 20, 21, 11); serviceProvider2.setAvailabilities(3, 7, 12, 15, 14); @@ -414,7 +414,7 @@ public class DBIntegrationTest { @Test public void testInvalidAvailability(){ ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null, - "testaddress", "8888888888", "companydotcom", true, null); + "testaddress", "8888888888", "companydotcom", true); serviceProvider.setAvailabilities(2, 8, 14, 8, 14); serviceProvider.setAvailabilities(3, 15, 12, 8, 14); 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 4e721d3..7f5b5e8 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 @@ -9,7 +9,7 @@ import static org.junit.Assert.*; public class ServiceProviderTest { ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe", - "testaddress", "8888888888", "companydotcom", true, "LOL"); + "testaddress", "8888888888", "companydotcom", true); /** * Initiates an ServiceProvider account and tests if the random strings match to the required inputs. diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest2.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest2.java index 38353f2..bc1bb67 100644 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest2.java +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest2.java @@ -6,7 +6,7 @@ import static org.junit.Assert.*; public class ServiceProviderTest2 { ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe", - "testaddress", "8888888888", "companydotcom", true, "LOL"); + "testaddress", "8888888888", "companydotcom", true); /** * sets availabilities and tests them. 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 index 74e90d9..d2e29ff 100644 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java @@ -29,15 +29,15 @@ public class ServiceTest { @Test public void addServiceProviderTest(){ service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe", - "testaddress", "8888888888", "companydotcom", true, null) ); + "testaddress", "8888888888", "companydotcom", true) ); service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe", - "testaddress", "8888888888", "companydotcom", true, null) ); + "testaddress", "8888888888", "companydotcom", true) ); service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe", - "testaddress", "8888888888", "companydotcom", true, null) ); + "testaddress", "8888888888", "companydotcom", true) ); service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe", - "testaddress", "8888888888", "companydotcom", true, null) ); + "testaddress", "8888888888", "companydotcom", true) ); service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "John", "Doe", - "testaddress", "8888888888", "companydotcom", true, null) ); + "testaddress", "8888888888", "companydotcom", true) ); int numOfSP = service.getServiceProviders().size(); assertEquals( 2,numOfSP ); } 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 index 5f97741..8660968 100644 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/UserTypeTest.java +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/UserTypeTest.java @@ -20,7 +20,7 @@ public class UserTypeTest { UserType user = new HomeOwner("John123", "1234567890", "John", "Doe"); UserType admin = new Admin(); UserType serviceprovider = new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe", - "testaddress", "8888888888", "companydotcom", true, "I am a walrus"); + "testaddress", "8888888888", "companydotcom", true); boolean userservice = user.equals(serviceprovider); boolean useradmin = user.equals(admin); boolean serviceadmin = serviceprovider.equals(admin);