BAEL-5545: fixed timezone issue
This commit is contained in:
parent
0b5ffa01a7
commit
e934c96f6d
|
@ -7,9 +7,6 @@ import org.junit.jupiter.api.Test;
|
|||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -55,15 +52,19 @@ class ProductServiceUnitTest {
|
|||
.thenReturn(1, 3, 2, 0);
|
||||
when(clock.instant())
|
||||
.thenReturn(Instant.parse("2022-04-09T10:15:30.00Z"));
|
||||
when(clock.getZone())
|
||||
.thenReturn(ZoneId.of("UTC"));
|
||||
|
||||
when(clock.millis())
|
||||
.thenReturn(100L,500L);
|
||||
when(clock.getZone())
|
||||
.thenReturn(ZoneId.systemDefault());
|
||||
|
||||
long actualElapsedTime = productService.createProducts(2);
|
||||
|
||||
final long actualElapsedTime = productService.createProducts(2);
|
||||
|
||||
|
||||
assertThat(actualElapsedTime)
|
||||
.isEqualTo(400L);
|
||||
|
||||
verify(productRepository,times(1))
|
||||
.saveAll(proArgumentCaptor.capture());
|
||||
|
||||
|
@ -71,8 +72,8 @@ class ProductServiceUnitTest {
|
|||
.hasSize(2)
|
||||
.extracting("title", "createdTs", "price")
|
||||
.containsExactly(
|
||||
tuple("yacht", LocalDateTime.parse("2022-04-09T12:15:30"), new BigDecimal("8539.99")),
|
||||
tuple("car", LocalDateTime.parse("2022-04-09T12:15:30"), new BigDecimal("88894"))
|
||||
tuple("yacht", LocalDateTime.parse("2022-04-09T10:15:30"), new BigDecimal("8539.99")),
|
||||
tuple("car", LocalDateTime.parse("2022-04-09T10:15:30"), new BigDecimal("88894"))
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue