diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java b/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java index 03b70b1..e89e99a 100644 --- a/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java +++ b/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/H2RegistrationDAOTest.java @@ -2,10 +2,17 @@ package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao; import static org.junit.Assert.*; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Employee; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Employee.EducationLevel; +import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registration; import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException; import at.ac.tuwien.sepm.assignment.groupphase.util.JDBCConnectionManager; import java.nio.charset.Charset; import java.sql.SQLException; +import java.time.Instant; +import java.time.LocalDate; +import java.util.LinkedList; +import java.util.List; import org.h2.tools.RunScript; import org.junit.After; import org.junit.Before; @@ -61,5 +68,68 @@ public class H2RegistrationDAOTest { } @Test - public void add() {} + public void addRegistrationShouldSucceed() throws PersistenceException { + List<Registration> registrations = new LinkedList<>(); + /* + Vehicle vehicle = Vehicle.builder() + .id(1) + .name("RTW-1") + .constructionType(ConstructionType.HOCHDACH) + .type(VehicleType.RTW) + .status(Status.ABGEMELDET) + .hasNef(true) + .build(); + */ + Employee employee1 = + Employee.builder() + .id(1) + .name("John Doe") + .birthday(LocalDate.now()) // incorrect, but should be irrelevant + .educationLevel(EducationLevel.RS) + .isDriver(true) + .isPilot(true) + .build(); + Employee employee2 = + Employee.builder() + .id(2) + .name("Nick \"Kage\" Verily") + .birthday(LocalDate.now()) // incorrect, but should be irrelevant + .educationLevel(EducationLevel.NKV) + .isDriver(true) + .isPilot(false) + .build(); + Employee employee3 = + Employee.builder() + .id(3) + .name("Nicht Arzt") + .birthday(LocalDate.now()) // incorrect, but should be irrelevant + .educationLevel(EducationLevel.NA) + .isDriver(false) + .isPilot(false) + .build(); + Registration registration1 = + Registration.builder() + .start(Instant.now()) // incorrect, but should be irrelevant to outcome + .end(Instant.now()) // same + .employee(employee1) + .build(); + Registration registration2 = + Registration.builder() + .start(Instant.now()) // incorrect, but should be irrelevant to outcome + .end(Instant.now()) // same + .employee(employee2) + .build(); + Registration registration3 = + Registration.builder() + .start(Instant.now()) // incorrect, but should be irrelevant to outcome + .end(Instant.now()) // same + .employee(employee3) + .build(); + registrations.add(registration1); + registrations.add(registration2); + registrations.add(registration3); + + List<Long> returnvalues = registrationDAO.add(1, registrations); + assertFalse(returnvalues.isEmpty()); // can be improved... + } } |