From 295242e572ad08e9e80a737e4f372f990af400a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Berk=20Ba=C5=9Fo=C4=9Flu?= Date: Fri, 2 Nov 2018 00:18:07 -0400 Subject: [PATCH] added all test files --- .../olympusservices/ServiceProviderTest.java | 29 ++++++++++++++++++- .../olympus/olympusservices/ServiceTest.java | 26 +++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java index 22cc495..d28fc45 100644 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceProviderTest.java @@ -8,7 +8,34 @@ import static org.junit.Assert.*; public class ServiceProviderTest { + ServiceProvider serviceprovider = new ServiceProvider("John123", "1234567890", "John", "Doe"); + @Test - public void addService() { + public void testServiceProvider() { + assertEquals( "John123", serviceprovider.getUsername() ); + assertEquals( "1234567890", serviceprovider.getPassword() ); + assertEquals( "John", serviceprovider.getFirstname() ); + assertEquals( "Doe", serviceprovider.getLastname() ); + assertEquals( "ServiceProvider", serviceprovider.getRole() ); + serviceprovider.setUsername( "username" ); + serviceprovider.setPassword( "password" ); + serviceprovider.setFirstname( "firstname" ); + serviceprovider.setLastname( "lastname" ); + assertNotEquals("John123", serviceprovider.getUsername()); + assertNotEquals("1234567890", serviceprovider.getPassword()); + assertNotEquals("John", serviceprovider.getFirstname()); + assertNotEquals("Doe", serviceprovider.getLastname()); } + + @Test + public void addServiceTest() { + serviceprovider.addService( new Service( "KitchenCleaner", 50 ) ); + serviceprovider.addService( new Service( "FrenchMaid", 250 ) ); + serviceprovider.addService( new Service( "FrenchMaid", 250 ) ); + serviceprovider.addService( new Service( "SecretService", 150 ) ); + serviceprovider.addService( new Service( "SecretService", 150 ) ); + int numOfServices = serviceprovider.getServices().size(); + assertEquals( 3, numOfServices ); + } + } \ No newline at end of file diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java index 87aaa31..ea1d487 100644 --- a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/ServiceTest.java @@ -1,4 +1,30 @@ package com.uottawa.olympus.olympusservices; +import org.junit.Test; + +import static org.junit.Assert.*; + public class ServiceTest { + Service service = new Service( "FrenchMaid", 250 ); + + @Test + public void testService(){ + assertEquals( "FrenchMaid", service.getName() ); + assertEquals( 250, service.getRate(), 0); + service.setName( "ItalianMafia" ); + service.setRate( 200 ); + assertNotEquals( "FrenchMaid", service.getName() ); + assertNotEquals( 250, service.getRate()); + } + + @Test + public void addServiceProviderTest(){ + service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe" ) ); + service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe" ) ); + service.addServiceProvider( new ServiceProvider( "John123", "1234567890", "John", "Doe" ) ); + service.addServiceProvider( new ServiceProvider( "Jane123", "1234567890", "Jane", "Doe" ) ); + int numOfSP = service.getServiceProviders().size(); + assertEquals( 2,numOfSP ); + } + }