-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Assignees
@EgorkaKulikov
Description
Description
Consider generating integration tests with application configuration from spring-boot-testing
for the method
public boolean isNotEmpty() { List<Order> orders = orderRepository.findAll(); return orders.size() > 0; }
where Order
has the following constructors:
protected Order() {} public Order(Long id, String buyer, int price, int qty) { this.id = id; this.buyer = buyer; this.price = price; this.qty = qty; }
Expected behaviour
Generated tests can be successfully compiled and run.
Actual behaviour
The following uncompilable test is generated. The problem is in line with order1 definition.
@Test @DisplayName("isNotEmpty: -> return true") public void testIsNotEmptyReturnsTrue() throws InstantiationException, IllegalAccessException, InvocationTargetException { Object[] orderConstructorArguments1 = new Object[0]; Order order1 = ((Order) orderConstructor.newInstance(orderConstructorArguments1)); entityManager1.persist(order1); entityManager1.flush(); boolean actual = orderService.isNotEmpty(); assertTrue(actual); }
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo