From 8ec11d9fd57be7c9c6c105c77a65cd67bc736354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Batuhan=20Berk=20Ba=C5=9Fo=C4=9Flu?= Date: Sat, 24 Nov 2018 20:24:42 -0500 Subject: [PATCH] Added the test files for final deliverable --- OlympusServices/.idea/misc.xml | 2 +- .../olympus/olympusservices/BookingTest.java | 98 +++++++++++++++++++ .../olympusservices/ServiceProviderTest.java | 18 ++-- 3 files changed, 108 insertions(+), 10 deletions(-) create mode 100644 OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/BookingTest.java diff --git a/OlympusServices/.idea/misc.xml b/OlympusServices/.idea/misc.xml index cc51e58..dc34569 100644 --- a/OlympusServices/.idea/misc.xml +++ b/OlympusServices/.idea/misc.xml @@ -25,7 +25,7 @@ - + diff --git a/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/BookingTest.java b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/BookingTest.java new file mode 100644 index 0000000..0faeded --- /dev/null +++ b/OlympusServices/app/src/test/java/com/uottawa/olympus/olympusservices/BookingTest.java @@ -0,0 +1,98 @@ +package com.uottawa.olympus.olympusservices; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class BookingTest { + HomeOwner user = new HomeOwner( "John123", "1234567890", "John", "Doe" ); + ServiceProvider serviceprovider = new ServiceProvider("Jane123", "1234567890", "Jane", "Doe", "testaddress", "8888888888", "companydotcom", true); + Service service = new Service( "FrenchMaid", 250 ); + Booking book = new Booking(13, 30, 16, 0, 0, 0, 2019, + serviceprovider, user, service); + + @Test + public void testStarth() { + assertEquals(13, book.getStarth()); + book.setStarth(10); + assertNotEquals(13, book.getStarth()); + } + + @Test + public void testStartmin() { + assertEquals(30, book.getStartmin()); + book.setStartmin(20); + assertNotEquals(30, book.getStartmin()); + } + + @Test + public void testEndh() { + assertEquals(16, book.getEndh()); + book.setEndh(14); + assertNotEquals(16, book.getEndh()); + } + + @Test + public void testEndmin() { + assertEquals(0, book.getEndmin()); + book.setEndmin(20); + assertNotEquals(0, book.getEndmin()); + } + + @Test + public void testDay() { + assertEquals(0, book.getDay()); + book.setDay(1); + assertNotEquals(0, book.getDay()); + } + + @Test + public void testMonth() { + assertEquals(0, book.getMonth()); + book.setMonth(2); + assertNotEquals(0, book.getMonth()); + } + + @Test + public void testYear() { + assertEquals(2019, book.getYear()); + book.setYear(2020); + assertNotEquals(2019, book.getYear()); + } + + @Test + public void testServiceprovider() { + assertEquals(serviceprovider, book.getServiceprovider() ); + ServiceProvider serviceprovider2 = new ServiceProvider("Joshua123", "1234567890", "Joshua", "Doe", "testoaddress", "8888888888", "whateverdotcom", true); + book.setServiceprovider(serviceprovider2); + assertNotEquals(serviceprovider, book.getServiceprovider()); + } + + @Test + public void testHomeowner() { + assertEquals(user, book.getHomeowner() ); + HomeOwner user2 = new HomeOwner( "Johnny123", "1234567890", "Johnny", "Dumas" ); + book.setHomeowner(user2); + assertNotEquals(user, book.getHomeowner()); + } + + @Test + public void testService() { + assertEquals(service, book.getService() ); + Service service2 = new Service( "ItalianMafia", 300 ); + book.setService(service2); + assertNotEquals(service, book.getService()); + } + + @Test + public void testStatus() { + book.setStatus(Booking.Status.CONFIRMED); + assertEquals(Booking.Status.CONFIRMED, book.getStatus()); + } + + @Test + public void testRating() { + book.setRating(5); + assertEquals(5, book.getRating()); + } +} \ No newline at end of file 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 7f5b5e8..89527c1 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 @@ -17,15 +17,15 @@ public class ServiceProviderTest { @Test 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" ); + 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());