Added comments to test files

This commit is contained in:
Batuhan Berk Başoğlu 2018-11-07 13:47:06 -05:00
parent ce0ead94e0
commit 57429abb8e
5 changed files with 33 additions and 2 deletions

View file

@ -6,6 +6,10 @@ import static org.junit.Assert.*;
public class AdminTest { public class AdminTest {
/**
* Initiates an Admin account and tests if the strings match to the required inputs.
*/
@Test @Test
public void testAdmin() { public void testAdmin() {
Admin admin = new Admin(); Admin admin = new Admin();

View file

@ -6,6 +6,10 @@ import static org.junit.Assert.*;
public class HomeOwnerTest { public class HomeOwnerTest {
/**
* Initiates an Homeowner account and tests if the random strings match to the required inputs.
*/
@Test @Test
public void testHomeOwner(){ public void testHomeOwner(){
UserType user = new HomeOwner( "John123", "1234567890", "John", "Doe" ); UserType user = new HomeOwner( "John123", "1234567890", "John", "Doe" );

View file

@ -10,6 +10,10 @@ public class ServiceProviderTest {
ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe"); ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe");
/**
* Initiates an ServiceProvider account and tests if the random strings match to the required inputs.
*/
@Test @Test
public void testServiceProvider() { public void testServiceProvider() {
assertEquals( "John123", serviceprovider.getUsername() ); assertEquals( "John123", serviceprovider.getUsername() );
@ -27,13 +31,18 @@ public class ServiceProviderTest {
assertNotEquals("Doe", serviceprovider.getLastname()); assertNotEquals("Doe", serviceprovider.getLastname());
} }
/**
* adds services and tests if they match the requirements in order to function properly. Example: If a service has a same name it doesn't count as one.
*
*/
@Test @Test
public void addServiceTest() { public void addServiceTest() {
serviceprovider.addService( new Service( "KitchenCleaner", 50 ) ); serviceprovider.addService( new Service( "KitchenCleaner", 50 ) );
serviceprovider.addService( new Service( "FrenchMaid", 250 ) ); serviceprovider.addService( new Service( "FrenchMaid", 250 ) );
serviceprovider.addService( new Service( "FrenchMaid", 250 ) ); serviceprovider.addService( new Service( "FrenchMaid", 210 ) );
serviceprovider.addService( new Service( "SecretService", 150 ) );
serviceprovider.addService( new Service( "SecretService", 150 ) ); serviceprovider.addService( new Service( "SecretService", 150 ) );
serviceprovider.addService( new Service( "SecretService", 110 ) );
int numOfServices = serviceprovider.getServices().size(); int numOfServices = serviceprovider.getServices().size();
assertEquals( 3, numOfServices ); assertEquals( 3, numOfServices );
} }

View file

@ -7,6 +7,10 @@ import static org.junit.Assert.*;
public class ServiceTest { public class ServiceTest {
Service service = new Service( "FrenchMaid", 250 ); Service service = new Service( "FrenchMaid", 250 );
/**
* Initiates an Service account and tests if the random strings match to the required inputs.
*/
@Test @Test
public void testService(){ public void testService(){
assertEquals( "FrenchMaid", service.getName() ); assertEquals( "FrenchMaid", service.getName() );
@ -17,12 +21,18 @@ public class ServiceTest {
assertNotEquals( 250, service.getRate()); assertNotEquals( 250, service.getRate());
} }
/**
* adds service providers and tests if they match the requirements in order to function properly. Example: If a service has a same name it doesn't count as one.
*
*/
@Test @Test
public void addServiceProviderTest(){ public void addServiceProviderTest(){
service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe" ) ); service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe" ) );
service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe" ) ); service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe" ) );
service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe" ) ); service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe" ) );
service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe" ) ); service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe" ) );
service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "John", "Doe" ) );
int numOfSP = service.getServiceProviders().size(); int numOfSP = service.getServiceProviders().size();
assertEquals( 2,numOfSP ); assertEquals( 2,numOfSP );
} }

View file

@ -11,6 +11,10 @@ import static org.junit.Assert.*;
public class UserTypeTest { public class UserTypeTest {
/**
* Tests if the every user that is created is equal to each other or not.
*/
@Test @Test
public void userTypeComparaison() { public void userTypeComparaison() {
UserType user = new HomeOwner("John123", "1234567890", "John", "Doe"); UserType user = new HomeOwner("John123", "1234567890", "John", "Doe");