Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@

package org.citrusframework.report;

import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.citrusframework.TestCase;
import org.citrusframework.TestCaseMetaInfo;
import org.citrusframework.TestResult;
Expand All @@ -36,13 +30,22 @@
import org.citrusframework.message.MessageHeaders;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import static java.util.Objects.nonNull;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.openMocks;

public class TestFlowReporterTest {

Expand All @@ -55,12 +58,22 @@ public class TestFlowReporterTest {

@Mock
private Iterate iteration;

@Mock
private Sequence sequence;

private AutoCloseable mocks;

@BeforeClass
public void setup() {
MockitoAnnotations.openMocks(this);
public void setupMocks() {
mocks = openMocks(this);
}

@AfterClass
public void teardownMocks() throws Exception {
if (nonNull(mocks)) {
mocks.close();
}
}

@Test
Expand Down Expand Up @@ -97,7 +110,7 @@ public void shouldGetJsonReport() {
reporter.onTestSuccess(test);

reporter.generate(results);
Assert.assertEquals(reporter.getJsonReport(), """
assertThat(reporter.getJsonReport()).isEqualToNormalizingNewlines("""
[
{
"name": "fooTest",
Expand Down Expand Up @@ -162,7 +175,7 @@ public void shouldGetJsonReportWithContainers() {
reporter.onTestSuccess(test);

reporter.generate(results);
Assert.assertEquals(reporter.getJsonReport(), """
assertThat(reporter.getJsonReport()).isEqualToNormalizingNewlines("""
[
{
"name": "fooTest",
Expand Down Expand Up @@ -233,7 +246,7 @@ public void shouldGetJsonReportWithFailedContainer() {
reporter.onTestSuccess(test);

reporter.generate(results);
Assert.assertEquals(reporter.getJsonReport(), """
assertThat(reporter.getJsonReport()).isEqualToNormalizingNewlines("""
[
{
"name": "fooTest",
Expand Down Expand Up @@ -310,7 +323,7 @@ public void shouldGetJsonReportWithIterations() {
reporter.onTestSuccess(test);

reporter.generate(results);
Assert.assertEquals(reporter.getJsonReport(), """
assertThat(reporter.getJsonReport()).isEqualToNormalizingNewlines("""
[
{
"name": "fooTest",
Expand Down Expand Up @@ -394,7 +407,7 @@ public void shouldGetJsonReportWithParameters() {
reporter.onTestSuccess(test);

reporter.generate(results);
Assert.assertEquals(reporter.getJsonReport(), """
assertThat(reporter.getJsonReport()).isEqualToNormalizingNewlines("""
[
{
"name": "fooTest",
Expand Down Expand Up @@ -458,7 +471,7 @@ public void shouldGetJsonReportForFailedTest() {
reporter.onTestSuccess(test);

reporter.generate(results);
Assert.assertEquals(reporter.getJsonReport(), """
assertThat(reporter.getJsonReport()).isEqualToNormalizingNewlines("""
[
{
"name": "fooTest",
Expand Down Expand Up @@ -534,7 +547,7 @@ public void shouldGetJsonReportWithMessages() {
reporter.onTestSuccess(test);

reporter.generate(results);
Assert.assertEquals(reporter.getJsonReport(), """
assertThat(reporter.getJsonReport()).isEqualToNormalizingNewlines("""
[
{
"name": "fooTest",
Expand Down
Loading