public static final ZonedDateTime tomorrowZonedDateTime() { return now().plus(1, ChronoUnit.DAYS); }
public static ZonedDateTime tomorrowZonedDateTime() { return now().plus(1, ChronoUnit.DAYS); }
private ZonedDateTime dateTimeAfterValidFromAndOldValidUntil(final CartDiscount cartDiscount) { return Optional.ofNullable(cartDiscount.getValidUntil()) .orElse(Optional.ofNullable(cartDiscount.getValidFrom()).orElse(SphereTestUtils.now()).plusSeconds(1000)).plusSeconds(1); } }
@Test public void getCompletedAt() throws Exception { final ZonedDateTime completedAt = SphereTestUtils.now().minusSeconds(5555); testOrderAspect(builder -> builder.completedAt(completedAt), order -> assertThat(order.getCompletedAt()).isEqualTo(completedAt)); }
@Test public void execution() throws Exception { final ZonedDateTime validFrom = SphereTestUtils.now(); final ZonedDateTime validUntil = validFrom.plusSeconds(8000); final LocalizedString name = en("discount name");
@Test public void setExpectedDelivery() throws Exception { withUpdateableInventoryEntry(client(), entry -> { final ZonedDateTime expectedDelivery = SphereTestUtils.now().plus(7, ChronoUnit.DAYS); final UpdateAction<InventoryEntry> action = SetExpectedDelivery.of(expectedDelivery); final InventoryEntry updatedEntry = client().executeBlocking(InventoryEntryUpdateCommand.of(entry, action)); assertThat(updatedEntry.getExpectedDelivery()) .isEqualTo(expectedDelivery); return updatedEntry; }); } }
@Test public void setValidFrom() throws Exception { withPersistentCartDiscount(client(), cartDiscount -> { final ZonedDateTime dateTime = SphereTestUtils.now(); assertThat(cartDiscount.getValidFrom()).isNotEqualTo(dateTime); final List<UpdateAction<CartDiscount>> updateActions = asList(SetValidUntil.of(dateTime.plus(7, ChronoUnit.DAYS)), SetValidFrom.of(dateTime)); final CartDiscount updatedDiscount = client().executeBlocking(CartDiscountUpdateCommand.of(cartDiscount, updateActions)); assertThat(updatedDiscount.getValidFrom()).isEqualTo(dateTime); }); }
@Test public void dateTimeAttribute() throws Exception { final ZonedDateTime now = SphereTestUtils.now().withZoneSameInstant(ZoneOffset.UTC); testSingleAndSet(AttributeAccess.ofDateTime(), AttributeAccess.ofDateTimeSet(), asSet(now, now.plus(3, ChronoUnit.DAYS)), DateTimeAttributeType.of(), AttributeDefinitionBuilder.of("datetime-attribute", LABEL, DateTimeAttributeType.of()).build()); }
final Reference<TaxCategory> taxCategoryRef = taxCategory.toReference(); final Reference<ShippingMethod> shippingMethodRef = shippingMethod.toReference(); final ZonedDateTime createdAt = SphereTestUtils.now().minusSeconds(4); final ParcelMeasurements parcelMeasurements = ParcelMeasurements.of(2, 3, 1, 3); final LineItemLike lineItem = new LineItemLike() {