Skip to content

Commit

Permalink
test(citrusframework#281): fixed test for delete all test results by …
Browse files Browse the repository at this point in the history
…adding a scenarioExecution to the test entity, now the tests fails if there is no cascade all set
  • Loading branch information
Melvin Johner committed Aug 21, 2024
1 parent 292f66b commit a7608da
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import jakarta.persistence.EntityManager;
import org.citrusframework.simulator.IntegrationTest;
import org.citrusframework.simulator.model.ScenarioExecution;
import org.citrusframework.simulator.model.TestParameter;
import org.citrusframework.simulator.model.TestResult;
import org.citrusframework.simulator.repository.TestResultRepository;
Expand All @@ -29,15 +30,13 @@
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.*;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.citrusframework.simulator.web.rest.TestUtil.sameInstant;
import static org.hamcrest.Matchers.hasItem;
import static org.mockito.Mockito.mock;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
Expand Down Expand Up @@ -98,7 +97,7 @@ public class TestResultResourceIT {
* if they test an entity which requires the current entity.
*/
public static TestResult createEntity(EntityManager entityManager) {
return TestResult.builder()
TestResult testResult = TestResult.builder()
.status(DEFAULT_STATUS)
.testName(DEFAULT_TEST_NAME)
.className(DEFAULT_CLASS_NAME)
Expand All @@ -108,6 +107,9 @@ public static TestResult createEntity(EntityManager entityManager) {
.createdDate(DEFAULT_CREATED_DATE)
.lastModifiedDate(DEFAULT_LAST_MODIFIED_DATE)
.build();
testResult.setScenarioExecution(ScenarioExecutionResourceIT.createEntity(entityManager));
return testResult;

}

/**
Expand All @@ -131,6 +133,7 @@ public static TestResult createUpdatedEntity(EntityManager entityManager) {

@BeforeEach
void beforeEachSetup() {

testResult = createEntity(entityManager);
}

Expand Down

0 comments on commit a7608da

Please sign in to comment.