From acfd24fb13a39cb3ec4003e36dbef181d14d904e Mon Sep 17 00:00:00 2001 From: Robert van Dijk Date: Sun, 27 Oct 2024 09:48:45 +0100 Subject: [PATCH] Fix controller tests --- src/test/java/ch/wisv/events/ControllerTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/java/ch/wisv/events/ControllerTest.java b/src/test/java/ch/wisv/events/ControllerTest.java index 504154a0..eeb21742 100644 --- a/src/test/java/ch/wisv/events/ControllerTest.java +++ b/src/test/java/ch/wisv/events/ControllerTest.java @@ -35,6 +35,7 @@ import org.junit.Rule; import org.junit.rules.ExpectedException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; @@ -91,6 +92,10 @@ public abstract class ControllerTest { @Autowired protected WebhookTaskRepository webhookTaskRepository; + /** Administration Costs*/ + @Value("${administrationCosts}") + private double administrationCosts; + /** * Other. */ @@ -177,6 +182,9 @@ protected Order createOrder(Customer customer, List products, OrderStat products.forEach(product -> { OrderProduct orderProduct = new OrderProduct(product, product.getCost(), 1L); + if (product.getCost() > 0) { + order.setAdministrationCosts(administrationCosts); + } orderProductRepository.saveAndFlush(orderProduct); order.addOrderProduct(orderProduct); });