Fix Adding Class of Test Infra and Service
This commit is contained in:
parent
0e8515e06e
commit
a8750313da
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class AddressServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class CompanyServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class DimensionServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class DocumentServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class ExportFolderServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class LicenseServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,35 +0,0 @@
|
|||||||
package com.dh7789dev.xpeditis;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
|
||||||
class MenuServiceImplTest {
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private MenuRepository menuRepository;
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
private MenuServiceImpl menuService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void given_whenGetCategories_then() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
when(menuRepository.findAll()).thenReturn(List.of());
|
|
||||||
|
|
||||||
// when
|
|
||||||
List<MenuCategory> categories = menuService.getCategories();
|
|
||||||
|
|
||||||
// then
|
|
||||||
assertThat(categories).isEmpty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class NlsServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class NotificationServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class QuoteDetailsServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class QuoteServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class ShipmentTrackingServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class UserServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class VesselScheduleServiceImplTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class AddressDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class CompanyDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class DimensionDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class DocumentDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class ExportFolderDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class LicenseDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class NotificationDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class QuoteDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class QuoteDetailsDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,97 +0,0 @@
|
|||||||
package com.dh7789dev.xpeditis.dao;
|
|
||||||
|
|
||||||
import jakarta.persistence.EntityManager;
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.Disabled;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
|
|
||||||
@Disabled
|
|
||||||
@DataJpaTest
|
|
||||||
@ContextConfiguration(classes = ReservationDao.class)
|
|
||||||
class ReservationDaoTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ReservationJpaRepository reservationJpaRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
private LocalDateTime parseDate(String date) {
|
|
||||||
return LocalDateTime.parse(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Reservation getReservation(
|
|
||||||
Long id,
|
|
||||||
String customerName,
|
|
||||||
LocalDateTime date,
|
|
||||||
String email) {
|
|
||||||
|
|
||||||
Reservation reservation = new Reservation();
|
|
||||||
reservation.setId(id);
|
|
||||||
reservation.setName(customerName);
|
|
||||||
reservation.setDate(date);
|
|
||||||
reservation.setEmail(email);
|
|
||||||
reservation.setPhone("0123456");
|
|
||||||
reservation.setNbPerson(2);
|
|
||||||
|
|
||||||
return reservation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
void setUp() {
|
|
||||||
LocalDateTime date = LocalDateTime.parse("2024-01-29T10:00:00");
|
|
||||||
Reservation res1 = getReservation(1L, "Mathis", date, "user@gmail.com");
|
|
||||||
reservationJpaRepository.save(res1);
|
|
||||||
entityManager.flush();
|
|
||||||
entityManager.clear();
|
|
||||||
|
|
||||||
LocalDateTime date2 = LocalDateTime.parse("2024-01-30T15:30:00");
|
|
||||||
Reservation res2 = getReservation(2L, "Xavier", date2, "user2@gmail.com");
|
|
||||||
reservationJpaRepository.save(res2);
|
|
||||||
entityManager.flush();
|
|
||||||
entityManager.clear();
|
|
||||||
|
|
||||||
LocalDateTime date3 = LocalDateTime.parse("2024-02-02T12:00:00");
|
|
||||||
Reservation res3 = getReservation(3L, "David", date3, "elPatrone@gmail.com");
|
|
||||||
reservationJpaRepository.save(res3); //out of date range
|
|
||||||
entityManager.flush();
|
|
||||||
entityManager.clear();
|
|
||||||
|
|
||||||
// Verify entities were saved
|
|
||||||
assertNotNull(reservationJpaRepository.findById(1L).orElse(null), "Res1 should be saved");
|
|
||||||
assertNotNull(reservationJpaRepository.findById(2L).orElse(null), "Res2 should be saved");
|
|
||||||
assertNotNull(reservationJpaRepository.findById(3L).orElse(null), "Res3 should be saved");
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterEach
|
|
||||||
void tearDown() {
|
|
||||||
reservationJpaRepository.delete(reservationJpaRepository.findAll().get(0));
|
|
||||||
reservationJpaRepository.delete(reservationJpaRepository.findAll().get(1));
|
|
||||||
reservationJpaRepository.delete(reservationJpaRepository.findAll().get(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void givenIntervalDates_whenFindReservationByDates_ThenReturnReservation() {
|
|
||||||
|
|
||||||
// ------ given ---------
|
|
||||||
LocalDateTime startDate = parseDate("2024-01-29T00:00:00");
|
|
||||||
LocalDateTime endDate = parseDate("2024-02-01T00:00:00");
|
|
||||||
|
|
||||||
// ------ when ---------
|
|
||||||
List<Reservation> reservations = reservationJpaRepository.findReservationsByDates(startDate, endDate);
|
|
||||||
|
|
||||||
// ------ then ---------
|
|
||||||
assertNotNull(reservations);
|
|
||||||
assertEquals(2, reservations.size(), "There should be 2 reservations");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class ShipmentTrackingDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class VesselScheduleDaoTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class AddressJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class CompanyJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class DimensionJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class DocumentJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class ExportFolderJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class LicenseJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class NotificationJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class QuoteDetailsJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class QuoteJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,65 +0,0 @@
|
|||||||
package com.dh7789dev.xpeditis.repository;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
|
||||||
import org.mockito.InjectMocks;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
|
||||||
class ReservationJpaRepositoryTest {
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
ReservationDao reservationDao;
|
|
||||||
|
|
||||||
@InjectMocks
|
|
||||||
ReservationJpaRepository reservationJpaRepository;
|
|
||||||
|
|
||||||
private ReservationEntity getReservation(
|
|
||||||
Long id,
|
|
||||||
String customerName,
|
|
||||||
LocalDateTime date,
|
|
||||||
String email,
|
|
||||||
String phone,
|
|
||||||
int nbPerson) {
|
|
||||||
ReservationEntity reservation = new ReservationEntity();
|
|
||||||
reservation.setId(id);
|
|
||||||
reservation.setName(customerName);
|
|
||||||
reservation.setDate(date);
|
|
||||||
reservation.setEmail(email);
|
|
||||||
reservation.setPhone(phone);
|
|
||||||
reservation.setNbPerson(nbPerson);
|
|
||||||
|
|
||||||
return reservation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void givenCustomerName_whenFindByCustomerName_thenReturnCustomer() {
|
|
||||||
//-------- given ----------
|
|
||||||
String customerName = "John Doe";
|
|
||||||
|
|
||||||
LocalDateTime date = LocalDateTime.parse("2024-01-29T10:00:00");
|
|
||||||
System.out.println(date);
|
|
||||||
ReservationEntity reservation1 = getReservation(1L, customerName, date, "user@gmail.com", "0123456", 2);
|
|
||||||
|
|
||||||
when(reservationDao.findByName(customerName)).thenReturn(List.of(reservation1));
|
|
||||||
|
|
||||||
//-------- when ------------
|
|
||||||
List<Reservation> result = reservationJpaRepository.findByName(customerName);
|
|
||||||
|
|
||||||
//-------- then -------------
|
|
||||||
verify(reservationDao, times(1)).findByName(anyString());
|
|
||||||
verify(reservationDao, times(1)).findByName(customerName);
|
|
||||||
|
|
||||||
assertNotNull(result);
|
|
||||||
assertEquals(1, result.size());
|
|
||||||
assertEquals(reservation1.getId(), result.getFirst().getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class ShipmentTrackingJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class UserJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.dh7789dev.xpeditis.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
class VesselScheduleJpaRepositoryTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test(){
|
||||||
|
int test = 1 +1;
|
||||||
|
assertEquals(2,test);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user