-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: cascade test parameters when persisting result
- Loading branch information
Showing
2 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
.../src/test/java/org/citrusframework/simulator/service/impl/ScenarioExecutionServiceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package org.citrusframework.simulator.service.impl; | ||
|
||
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.service.ScenarioExecutionService; | ||
import org.citrusframework.simulator.service.TestParameterService; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.parallel.Isolated; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import static java.time.Instant.now; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@Isolated | ||
@IntegrationTest | ||
class ScenarioExecutionServiceIT { | ||
|
||
@Autowired | ||
private TestParameterService testParameterService; | ||
|
||
@Autowired | ||
private ScenarioExecutionService fixture; | ||
|
||
@Nested | ||
class CompleteScenarioExecution { | ||
|
||
@Test | ||
void cascadesUpdateEvent() { | ||
var scenarioExecution = fixture.save( | ||
ScenarioExecution.builder() | ||
.scenarioName("cascadesUpdateEvent") | ||
.startDate(now()) | ||
.build() | ||
); | ||
|
||
var result = fixture.completeScenarioExecution( | ||
scenarioExecution.getExecutionId(), | ||
TestResult.builder() | ||
.testName("cascadesUpdateEvent") | ||
.className(getClass().getSimpleName()) | ||
.build() | ||
.addTestParameter( | ||
TestParameter.builder() | ||
.key("key") | ||
.value("value") | ||
.build())); | ||
|
||
assertThat(result.getTestResult().getTestParameters()) | ||
.allSatisfy( | ||
p -> assertThat(p.getTestParameterId().testResultId) | ||
.isNotNull() | ||
); | ||
} | ||
} | ||
} |