Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test cases for entity classes #2

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.sql.Date;
import java.util.List;

@SpringBootTest
class AppointmentTest {

@Test
void createEntity() {
Pet test_pet = new Pet();
test_pet.setAppointments(List.of(new Appointment(), new Appointment(), new Appointment(), new Appointment()));

PetOwner test_pet_owner = new PetOwner();
test_pet_owner.setAppointments(List.of(new Appointment(), new Appointment(), new Appointment()));

Veterinarian test_veterinarian = new Veterinarian();
test_veterinarian.setClinic("apple clinic");
test_veterinarian.setVetID(13);
test_veterinarian.setAppointments(List.of(new Appointment(), new Appointment()));
test_veterinarian.setUser(new Customer());

Appointment test_appointment = new Appointment();
test_appointment.setAppointmentID(1773);
test_appointment.setAppointmentDate(new Date(17731731));
test_appointment.setPetID(test_pet);
test_appointment.setVetID(test_veterinarian);
test_appointment.setPetOwnerID(test_pet_owner);

assertThat(test_appointment.getAppointmentID()).isEqualTo(1773);
assertThat(test_appointment.getAppointmentDate()).isEqualTo(new Date(17731731));
assertThat(test_appointment.getPetID().getAppointments().size()).isEqualTo(4);
assertThat(test_appointment.getVetID().getAppointments().size()).isEqualTo(2);
assertThat(test_appointment.getPetOwnerID().getAppointments().size()).isEqualTo(3);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.sql.Date;
import java.util.List;

@SpringBootTest
class CustomerTest {

@Test
void createEntity() {
PetOwner test_pet_owner = new PetOwner();
test_pet_owner.setAppointments(List.of(new Appointment(), new Appointment(), new Appointment()));

Veterinarian test_veterinarian = new Veterinarian();
test_veterinarian.setClinic("apple clinic");
test_veterinarian.setVetID(13);
test_veterinarian.setAppointments(List.of(new Appointment(), new Appointment()));
test_veterinarian.setUser(new Customer());

Customer test_customer = new Customer();
test_customer.setEmail("[email protected]");
test_customer.setName("crazy taxi");
test_customer.setSurname("samsun galaksiy");
test_customer.setPassword("moldavian rhapsody");
test_customer.setUserID(5);
test_customer.setUserTypeID(new UserType());
test_customer.setVet(test_veterinarian);
test_customer.setOwner(test_pet_owner);

assertThat(test_customer.getEmail()).isEqualTo("[email protected]");
assertThat(test_customer.getName()).isEqualTo("crazy taxi");
assertThat(test_customer.getSurname()).isEqualTo("samsun galaksiy");
assertThat(test_customer.getPassword()).isEqualTo("moldavian rhapsody");
assertThat(test_customer.getUserID()).isEqualTo(5);
assertThat(test_customer.getUserTypeID()).isNotNull();
assertThat(test_customer.getVet().getClinic()).isEqualTo("apple clinic");
assertThat(test_customer.getOwner().getAppointments().size()).isEqualTo(3);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.sql.Date;
import java.util.List;

@SpringBootTest
class MedTypeTest {

@Test
void createEntity() {
MedType test_med_type = new MedType();
test_med_type.setMedType("Cirpilmis Zenginlik");
test_med_type.setMedTypeID(51);
test_med_type.setMedications(List.of(new Medication(), new Medication()));

assertThat(test_med_type.getMedType()).isEqualTo("Cirpilmis Zenginlik");
assertThat(test_med_type.getMedTypeID()).isEqualTo(51);
assertThat(test_med_type.getMedications().size()).isEqualTo(2);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.sql.Date;
import java.util.List;

@SpringBootTest
class MedicationTest {

@Test
void createEntity() {
Pet test_pet = new Pet();
test_pet.setAppointments(List.of(new Appointment(), new Appointment(), new Appointment(), new Appointment()));

MedType test_med_type = new MedType();
test_med_type.setMedType("ITUferin");

Schedule test_schedule = new Schedule();
test_schedule.setDoseCount(1773);

Medication test_medication = new Medication();
test_medication.setMedicationID(-1773);
test_medication.setMedicationName("kafanoktaitunoktaedunoktateeree");
test_medication.setMedTypeID(test_med_type);
test_medication.setPetID(test_pet);
test_medication.setScheduleID(test_schedule);

assertThat(test_medication.getMedicationID()).isEqualTo(-1773);
assertThat(test_medication.getMedicationName()).isEqualTo("kafanoktaitunoktaedunoktateeree");
assertThat(test_medication.getMedTypeID().getMedType()).isEqualTo("ITUferin");
assertThat(test_medication.getPetID().getAppointments().size()).isEqualTo(4);
assertThat(test_medication.getScheduleID().getDoseCount()).isEqualTo(1773);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.checkerframework.checker.units.qual.A;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.sql.Date;
import java.util.List;

@SpringBootTest
class PetOwnerTest {

@Test
void createEntity() {
Customer test_customer = new Customer();
test_customer.setUserID(41);

Veterinarian test_veterinarian = new Veterinarian();
test_veterinarian.setClinic("apple clinic");
test_veterinarian.setVetID(13);
test_veterinarian.setAppointments(List.of(new Appointment(), new Appointment()));
test_veterinarian.setUser(new Customer());

PetOwner test_pet_owner = new PetOwner();
test_pet_owner.setPetOwnerID(17);
test_pet_owner.setPets(List.of(new Pet(), new Pet()));
test_pet_owner.setUser(test_customer);
test_pet_owner.setVet(test_veterinarian);
test_pet_owner.setAppointments(List.of(new Appointment(), new Appointment(), new Appointment()));

assertThat(test_pet_owner.getPetOwnerID()).isEqualTo(17);
assertThat(test_pet_owner.getPets().size()).isEqualTo(2);
assertThat(test_pet_owner.getUser().getUserID()).isEqualTo(41);
assertThat(test_pet_owner.getVet().getClinic()).isEqualTo("apple clinic");
assertThat(test_pet_owner.getAppointments().size()).isEqualTo(3);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.sql.Date;
import java.util.List;

@SpringBootTest
class PetTest {

@Test
void createEntity() {
PetType test_pet_type = new PetType();
test_pet_type.setType("bukale munn");
test_pet_type.setPets(List.of(new Pet()));
test_pet_type.setPetTypeID(12);

PetOwner test_pet_owner = new PetOwner();
test_pet_owner.setAppointments(List.of(new Appointment(), new Appointment(), new Appointment()));

Pet test_pet = new Pet();
test_pet.setAppointments(List.of(new Appointment(), new Appointment(), new Appointment(), new Appointment()));
test_pet.setAge(100);
test_pet.setPetID(34);
test_pet.setPetName("Ketiii");
test_pet.setDescription("Sinav oncesi uzun gecelerin vaz gecilmezi, tek basina bir mutluluk kaynagı (kediii den bahsetmiyom)");
test_pet.setPetOwnerID(test_pet_owner);
test_pet.setMedications(List.of(new Medication()));
test_pet.setPetTypeID(test_pet_type);

assertThat(test_pet.getAppointments().size()).isEqualTo(4);
assertThat(test_pet.getAge()).isEqualTo(100);
assertThat(test_pet.getPetID()).isEqualTo(34);
assertThat(test_pet.getPetName()).isEqualTo("Ketiii");
assertThat(test_pet.getDescription()).isEqualTo("Sinav oncesi uzun gecelerin vaz gecilmezi, tek basina bir mutluluk kaynagı (kediii den bahsetmiyom)");
assertThat(test_pet.getPetOwnerID().getAppointments().size()).isEqualTo(3);
assertThat(test_pet.getMedications().size()).isEqualTo(1);
assertThat(test_pet.getPetTypeID().getType()).isEqualTo("bukale munn");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.checkerframework.checker.units.qual.A;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.parameters.P;

import java.sql.Date;
import java.util.List;

@SpringBootTest
class PetTypeTest {

@Test
void createEntity() {
PetType test_pet_type = new PetType();
test_pet_type.setPetTypeID(36);
test_pet_type.setPets(List.of(new Pet(), new Pet()));
test_pet_type.setType("micky mouse");

assertThat(test_pet_type.getPetTypeID()).isEqualTo(36);
assertThat(test_pet_type.getPets().size()).isEqualTo(2);
assertThat(test_pet_type.getType()).isEqualTo("micky mouse");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.checkerframework.checker.units.qual.A;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.parameters.P;

import java.util.Date;
import java.util.List;

@SpringBootTest
class ScheduleTest {

@Test
void createEntity() {
Schedule test_schedule = new Schedule();
test_schedule.setDoseCount(15);
test_schedule.setScheduleID(1915);
test_schedule.setBeginningDate(new Date(3451));
test_schedule.setMedications(List.of(new Medication()));
test_schedule.setDoseFrequency(20);

assertThat(test_schedule.getDoseCount()).isEqualTo(15);
assertThat(test_schedule.getScheduleID()).isEqualTo(1915);
assertThat(test_schedule.getBeginningDate()).isEqualTo(new Date(3451));
assertThat(test_schedule.getDoseFrequency()).isEqualTo(20);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.checkerframework.checker.units.qual.A;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.parameters.P;

import java.util.Date;
import java.util.List;

@SpringBootTest
class UserTypeTest {

@Test
void createEntity() {
UserType test_user_type = new UserType();
test_user_type.setType("ucakci");
test_user_type.setUsers(List.of(new Customer(), new Customer()));
test_user_type.setUserTypeID(10);

assertThat(test_user_type.getType()).isEqualTo("ucakci");
assertThat(test_user_type.getUsers().size()).isEqualTo(2);
assertThat(test_user_type.getUserTypeID()).isEqualTo(10);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.production.ehayvanbackendapi.entity_tests;

import static org.assertj.core.api.Assertions.assertThat;

import com.production.ehayvanbackendapi.Entities.*;
import org.checkerframework.checker.units.qual.A;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.parameters.P;

import java.util.Date;
import java.util.List;

@SpringBootTest
class VeterinarianTest {

@Test
void createEntity() {
Customer test_customer = new Customer();
test_customer.setEmail("[email protected]");

Veterinarian test_veterinarian = new Veterinarian();
test_veterinarian.setClinic("apple clinic");
test_veterinarian.setVetID(13);
test_veterinarian.setAppointments(List.of(new Appointment(), new Appointment()));
test_veterinarian.setUser(test_customer);

assertThat(test_veterinarian.getClinic()).isEqualTo("apple clinic");
assertThat(test_veterinarian.getVetID()).isEqualTo(13);
assertThat(test_veterinarian.getAppointments().size()).isEqualTo(2);
assertThat(test_veterinarian.getUser().getEmail()).isEqualTo("[email protected]");
}

}