think i got them all
This commit is contained in:
parent
c3f35ad540
commit
bf2b4ae004
2 changed files with 18 additions and 9 deletions
|
@ -48,7 +48,8 @@ public class DBIntegrationTest {
|
||||||
assertEquals("Garzon", dbUser.getLastname());
|
assertEquals("Garzon", dbUser.getLastname());
|
||||||
|
|
||||||
|
|
||||||
originalUser = new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman");
|
originalUser = new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
addedTwo = dbHelper.addUser(originalUser);
|
addedTwo = dbHelper.addUser(originalUser);
|
||||||
dbUser = dbHelper.findUserByUsername("jbO4aBF4dC");
|
dbUser = dbHelper.findUserByUsername("jbO4aBF4dC");
|
||||||
|
|
||||||
|
@ -79,7 +80,8 @@ public class DBIntegrationTest {
|
||||||
assertTrue(added);
|
assertTrue(added);
|
||||||
added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "seg2105", "Miguel", "Garzon"));
|
added = dbHelper.addUser(new HomeOwner("jbO4aBF4dC", "seg2105", "Miguel", "Garzon"));
|
||||||
assertTrue(!added);
|
assertTrue(!added);
|
||||||
added = dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman"));
|
added = dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", "seg2105", "Juan", "Guzman",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
assertTrue(!added);
|
assertTrue(!added);
|
||||||
|
|
||||||
dbHelper.deleteUser("jbO4aBF4dC");
|
dbHelper.deleteUser("jbO4aBF4dC");
|
||||||
|
@ -212,7 +214,8 @@ public class DBIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddAndDeleteServiceProvidedByUser(){
|
public void testAddAndDeleteServiceProvidedByUser(){
|
||||||
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null));
|
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
dbHelper.addService(new Service("Hitman", 12358));
|
dbHelper.addService(new Service("Hitman", 12358));
|
||||||
boolean added = dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "hitman");
|
boolean added = dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "hitman");
|
||||||
assertTrue(added);
|
assertTrue(added);
|
||||||
|
@ -224,7 +227,8 @@ public class DBIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllServicesProvidedByUserAndDeleteService(){
|
public void testGetAllServicesProvidedByUserAndDeleteService(){
|
||||||
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null));
|
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
|
|
||||||
dbHelper.addService(new Service("Hitman", 12358));
|
dbHelper.addService(new Service("Hitman", 12358));
|
||||||
dbHelper.addService(new Service("Exterminating flatworms", 392.457));
|
dbHelper.addService(new Service("Exterminating flatworms", 392.457));
|
||||||
|
@ -253,8 +257,10 @@ public class DBIntegrationTest {
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllProvidersByService(){
|
public void testGetAllProvidersByService(){
|
||||||
dbHelper.addService(new Service("Exterminating flatworms", 392.457));
|
dbHelper.addService(new Service("Exterminating flatworms", 392.457));
|
||||||
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null));
|
dbHelper.addUser(new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
dbHelper.addUser(new ServiceProvider("7MuF1c59XP", null, null, null));
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
|
dbHelper.addUser(new ServiceProvider("7MuF1c59XP", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true));
|
||||||
|
|
||||||
dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "exterminating flatworms");
|
dbHelper.addServiceProvidedByUser("jbO4aBF4dC", "exterminating flatworms");
|
||||||
dbHelper.addServiceProvidedByUser("7MuF1c59XP", "exterminating flatworms");
|
dbHelper.addServiceProvidedByUser("7MuF1c59XP", "exterminating flatworms");
|
||||||
|
@ -272,12 +278,14 @@ public class DBIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateAndGetAvailability(){
|
public void testUpdateAndGetAvailability(){
|
||||||
ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null);
|
ServiceProvider serviceProvider = new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
serviceProvider.setAvailabilities(0, 4, 18, 19, 30);
|
serviceProvider.setAvailabilities(0, 4, 18, 19, 30);
|
||||||
serviceProvider.setAvailabilities(3, 8, 12, 15, 14);
|
serviceProvider.setAvailabilities(3, 8, 12, 15, 14);
|
||||||
|
|
||||||
//TODO:Perhaps implement a deep clone function for UserType?
|
//TODO:Perhaps implement a deep clone function for UserType?
|
||||||
ServiceProvider serviceProvider2 = new ServiceProvider("jbO4aBF4dC", null, null, null);
|
ServiceProvider serviceProvider2 = new ServiceProvider("jbO4aBF4dC", null, null, null,
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
serviceProvider2.setAvailabilities(0, 4, 18, 19, 30);
|
serviceProvider2.setAvailabilities(0, 4, 18, 19, 30);
|
||||||
serviceProvider2.setAvailabilities(3, 8, 12, 15, 14);
|
serviceProvider2.setAvailabilities(3, 8, 12, 15, 14);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@ public class UserTypeTest {
|
||||||
public void userTypeComparaison() {
|
public void userTypeComparaison() {
|
||||||
UserType user = new HomeOwner("John123", "1234567890", "John", "Doe");
|
UserType user = new HomeOwner("John123", "1234567890", "John", "Doe");
|
||||||
UserType admin = new Admin();
|
UserType admin = new Admin();
|
||||||
UserType serviceprovider = new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe");
|
UserType serviceprovider = new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe",
|
||||||
|
"testaddress", "8888888888", "companydotcom", true);
|
||||||
boolean userservice = user.equals(serviceprovider);
|
boolean userservice = user.equals(serviceprovider);
|
||||||
boolean useradmin = user.equals(admin);
|
boolean useradmin = user.equals(admin);
|
||||||
boolean serviceadmin = serviceprovider.equals(admin);
|
boolean serviceadmin = serviceprovider.equals(admin);
|
||||||
|
|
Loading…
Reference in a new issue