Skip to content

Commit

Permalink
Fix controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdijk committed Oct 27, 2024
1 parent d8c09c9 commit acfd24f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/java/ch/wisv/events/ControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,6 +92,10 @@ public abstract class ControllerTest {
@Autowired
protected WebhookTaskRepository webhookTaskRepository;

/** Administration Costs*/
@Value("${administrationCosts}")
private double administrationCosts;

/**
* Other.
*/
Expand Down Expand Up @@ -177,6 +182,9 @@ protected Order createOrder(Customer customer, List<Product> 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);
});
Expand Down

0 comments on commit acfd24f

Please sign in to comment.