Finished the test files

This commit is contained in:
Batuhan Berk Başoğlu 2018-11-14 13:59:26 -05:00
parent 2eb8555ae5
commit 24b16fd8b1
3 changed files with 23 additions and 0 deletions

View file

@ -99,6 +99,7 @@ public class ServiceProvider extends UserType {
public void setAvailabilities(int[][] availabilities) {
this.availabilities = availabilities;
}
public void setServices(List<Service> services) {
this.services = services;
}

View file

@ -5,12 +5,34 @@ import org.junit.Test;
import static org.junit.Assert.*;
public class ServiceProviderTest2 {
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe",
"testaddress", "8888888888", "companydotcom", true);
@Test
public void testAvailabilities() {
int [][] availability = new int[7][4];
assertEquals( availability, serviceprovider.getAvailabilities());
serviceprovider.setAvailabilities(5, 8, 30, 12, 0);
availability[5][0] = 8;
availability[5][1] = 30;
availability[5][2] = 12;
availability[5][3] = 0;
assertEquals( availability, serviceprovider.getAvailabilities());
}
@Test
public void testOtherInstances() {
assertEquals( "testaddress", serviceprovider.getAddress() );
assertEquals( "8888888888", serviceprovider.getPhonenumber() );
assertEquals( "companydotcom", serviceprovider.getCompanyname() );
assertEquals( true, serviceprovider.isLicensed() );
serviceprovider.setAddress( "Canada, Ontario" );
serviceprovider.setPhonenumber( "+1-416-555-0182" );
serviceprovider.setCompanyname( "Google" );
serviceprovider.setLicensed( false );
assertNotEquals( "testaddress", serviceprovider.getAddress() );
assertNotEquals( "8888888888", serviceprovider.getPhonenumber() );
assertNotEquals( "companydotcom", serviceprovider.getCompanyname() );
assertNotEquals( true, serviceprovider.isLicensed() );
}
}