Added UML and Test file fixes, added string description to the DBHelper and SignUp. Further fixes needed

This commit is contained in:
Batuhan Berk Başoğlu 2018-11-16 14:47:26 -05:00
parent 617b75b997
commit e08f9464d1
5 changed files with 21 additions and 7 deletions

View file

@ -29,6 +29,7 @@ public class ServiceProvider extends UserType {
private String phonenumber; private String phonenumber;
private String companyname; private String companyname;
private boolean licensed; private boolean licensed;
private String description;
@ -43,7 +44,7 @@ public class ServiceProvider extends UserType {
* @param lastname String of the lastname. * @param lastname String of the lastname.
*/ */
ServiceProvider(String username, String password, String firstname, String lastname, String address, ServiceProvider(String username, String password, String firstname, String lastname, String address,
String phonenumber, String companyname, boolean licensed){ String phonenumber, String companyname, boolean licensed, String description){
super(username, password, firstname, lastname); super(username, password, firstname, lastname);
services = new ArrayList<>(); services = new ArrayList<>();
availabilities = new int[7][4]; availabilities = new int[7][4];
@ -51,6 +52,7 @@ public class ServiceProvider extends UserType {
this.phonenumber = phonenumber; this.phonenumber = phonenumber;
this.companyname = companyname; this.companyname = companyname;
this.licensed = licensed; this.licensed = licensed;
this.description = description;
} }
/** /**
@ -139,4 +141,12 @@ public class ServiceProvider extends UserType {
public void setLicensed(boolean licensed) { public void setLicensed(boolean licensed) {
this.licensed = licensed; this.licensed = licensed;
} }
public String getDescription() {
return description;
}
public void setDescription(String phonenumber) {
this.description = description;
}
} }

View file

@ -9,7 +9,7 @@ import static org.junit.Assert.*;
public class ServiceProviderTest { public class ServiceProviderTest {
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe", ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe",
"testaddress", "8888888888", "companydotcom", true); "testaddress", "8888888888", "companydotcom", true, "LOL");
/** /**
* Initiates an ServiceProvider account and tests if the random strings match to the required inputs. * Initiates an ServiceProvider account and tests if the random strings match to the required inputs.

View file

@ -6,7 +6,7 @@ import static org.junit.Assert.*;
public class ServiceProviderTest2 { public class ServiceProviderTest2 {
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe", ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe",
"testaddress", "8888888888", "companydotcom", true); "testaddress", "8888888888", "companydotcom", true, "LOL");
/** /**
* sets availabilities and tests them. * sets availabilities and tests them.
@ -33,13 +33,16 @@ public class ServiceProviderTest2 {
assertEquals( "8888888888", serviceprovider.getPhonenumber() ); assertEquals( "8888888888", serviceprovider.getPhonenumber() );
assertEquals( "companydotcom", serviceprovider.getCompanyname() ); assertEquals( "companydotcom", serviceprovider.getCompanyname() );
assertEquals( true, serviceprovider.isLicensed() ); assertEquals( true, serviceprovider.isLicensed() );
assertEquals( "LOL", serviceprovider.getDescription() );
serviceprovider.setAddress( "Canada, Ontario" ); serviceprovider.setAddress( "Canada, Ontario" );
serviceprovider.setPhonenumber( "+1-416-555-0182" ); serviceprovider.setPhonenumber( "+1-416-555-0182" );
serviceprovider.setCompanyname( "Google" ); serviceprovider.setCompanyname( "Google" );
serviceprovider.setLicensed( false ); serviceprovider.setLicensed( false );
serviceprovider.setDescription( "Nope" );
assertNotEquals( "testaddress", serviceprovider.getAddress() ); assertNotEquals( "testaddress", serviceprovider.getAddress() );
assertNotEquals( "8888888888", serviceprovider.getPhonenumber() ); assertNotEquals( "8888888888", serviceprovider.getPhonenumber() );
assertNotEquals( "companydotcom", serviceprovider.getCompanyname() ); assertNotEquals( "companydotcom", serviceprovider.getCompanyname() );
assertNotEquals( true, serviceprovider.isLicensed() ); assertNotEquals( true, serviceprovider.isLicensed() );
assertNotEquals( "LOL", serviceprovider.getDescription() );
} }
} }

View file

@ -18,6 +18,7 @@ address;
int phonenumber; int phonenumber;
companyname; companyname;
boolean licensed; boolean licensed;
description;
isA UserType; isA UserType;
} }
@ -33,7 +34,7 @@ double rate;
* -- * ServiceProvider; * -- * ServiceProvider;
} }
//$?[End_of_model]$?
class UserType class UserType
{ {
@ -57,6 +58,6 @@ class Admin
class Service class Service
{ {
position 853 422 112 75; position 854 455 112 75;
position.association Service__ServiceProvider 65,0 61,126; position.association Service__ServiceProvider 65,0 65,143;
} }//$?[End_of_model]$?

Binary file not shown.