secondary constructor
This commit is contained in:
parent
2117d58685
commit
04829231e2
3 changed files with 15 additions and 4 deletions
|
@ -309,10 +309,9 @@ 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);
|
||||
ServiceProvider serviceProvider = new ServiceProvider(username, password, firstname, lastname, address, phonenumber, companyname, licensed, description);
|
||||
getAllServicesProvidedByUser(serviceProvider);
|
||||
getAvailabilities(serviceProvider);
|
||||
serviceProvider.setDescription(description);
|
||||
usertype = serviceProvider;
|
||||
} else {
|
||||
usertype = new HomeOwner(username, password, firstname, lastname);
|
||||
|
|
|
@ -52,6 +52,19 @@ public class ServiceProvider extends UserType {
|
|||
this.phonenumber = phonenumber;
|
||||
this.companyname = companyname;
|
||||
this.licensed = licensed;
|
||||
this.description = "";
|
||||
}
|
||||
|
||||
ServiceProvider(String username, String password, String firstname, String lastname, String address,
|
||||
String phonenumber, String companyname, boolean licensed, String description){
|
||||
super(username, password, firstname, lastname);
|
||||
services = new ArrayList<>();
|
||||
availabilities = new int[7][4];
|
||||
this.address = address;
|
||||
this.phonenumber = phonenumber;
|
||||
this.companyname = companyname;
|
||||
this.licensed = licensed;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@ import static org.junit.Assert.*;
|
|||
|
||||
public class ServiceProviderTest2 {
|
||||
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe",
|
||||
"testaddress", "8888888888", "companydotcom", true);
|
||||
"testaddress", "8888888888", "companydotcom", true, "LOL");
|
||||
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,6 @@ public class ServiceProviderTest2 {
|
|||
*/
|
||||
@Test
|
||||
public void testOtherInstances() {
|
||||
serviceprovider.setDescription("LOL");
|
||||
assertEquals( "testaddress", serviceprovider.getAddress() );
|
||||
assertEquals( "8888888888", serviceprovider.getPhonenumber() );
|
||||
assertEquals( "companydotcom", serviceprovider.getCompanyname() );
|
||||
|
|
Loading…
Reference in a new issue