Skip to content

Commit

Permalink
add messageStorage to XmlReportWriterTest in XmlReportWriterTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
pstaeck committed Mar 12, 2024
1 parent b9ba93a commit b410ec0
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static org.mockito.Mockito.when;
import static org.w3c.dom.Node.ELEMENT_NODE;

import com.draeger.medical.sdccc.messages.MessageStorage;
import com.draeger.medical.sdccc.tests.annotations.TestDescription;
import com.draeger.medical.sdccc.util.TestRunObserver;
import com.draeger.medical.sdccc.util.XPathExtractor;
Expand Down Expand Up @@ -252,11 +253,12 @@ public void testBadCharSequence() throws Exception {

final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final var observer = mock(TestRunObserver.class);
final var messageStorage = mock(MessageStorage.class);
try (final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(baos, StandardCharsets.UTF_8)) {
final var factory = XMLOutputFactory.newInstance();
final var xmlWriter = factory.createXMLStreamWriter(outputStreamWriter);

final var writer = new XmlReportWriter(data, classUtil, observer);
final var writer = new XmlReportWriter(data, classUtil, observer, messageStorage);
writer.writeXmlReport(xmlWriter, Duration.ofSeconds(1));
}

Expand Down Expand Up @@ -345,11 +347,12 @@ public void testBadCharSequence() throws Exception {
public void testAdditionalTags() throws Exception {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final var observer = mock(TestRunObserver.class);
final var messageStorage = mock(MessageStorage.class);
try (final OutputStreamWriter outputStreamWriter = new OutputStreamWriter(baos, StandardCharsets.UTF_8)) {
final var factory = XMLOutputFactory.newInstance();
final var xmlWriter = factory.createXMLStreamWriter(outputStreamWriter);

final var writer = new XmlReportWriter(data, classUtil, observer);
final var writer = new XmlReportWriter(data, classUtil, observer, messageStorage);
writer.writeXmlReport(xmlWriter, Duration.ofSeconds(1));
}

Expand Down Expand Up @@ -466,7 +469,8 @@ public void testMissingTestDescription() throws Exception {
final var factory = XMLOutputFactory.newInstance();
final var xmlWriter = factory.createXMLStreamWriter(outputStreamWriter);

final var writer = new XmlReportWriter(data, classUtil, mock(TestRunObserver.class));
final var writer =
new XmlReportWriter(data, classUtil, mock(TestRunObserver.class), mock(MessageStorage.class));
final var error = assertThrows(
XMLStreamException.class,
() -> writer.writeXmlReport(xmlWriter, Duration.ofSeconds(1)),
Expand Down Expand Up @@ -517,7 +521,8 @@ public void testMissingTestIdentifier() throws Exception {
final var factory = XMLOutputFactory.newInstance();
final var xmlWriter = factory.createXMLStreamWriter(outputStreamWriter);

final var writer = new XmlReportWriter(data, classUtil, mock(TestRunObserver.class));
final var writer =
new XmlReportWriter(data, classUtil, mock(TestRunObserver.class), mock(MessageStorage.class));
final var error = assertThrows(
XMLStreamException.class,
() -> writer.writeXmlReport(xmlWriter, Duration.ofSeconds(1)),
Expand All @@ -543,7 +548,7 @@ public void testInvalidRunHasAdditionalFailedTestCase() throws Exception {
final var factory = XMLOutputFactory.newInstance();
final var xmlWriter = factory.createXMLStreamWriter(outputStreamWriter);

final var writer = new XmlReportWriter(data, classUtil, observer);
final var writer = new XmlReportWriter(data, classUtil, observer, mock(MessageStorage.class));
writer.writeXmlReport(xmlWriter, Duration.ofSeconds(1));

outputStreamWriter.close();
Expand Down Expand Up @@ -593,7 +598,7 @@ public void testValidRunHasPositiveAttribute() throws Exception {
final var factory = XMLOutputFactory.newInstance();
final var xmlWriter = factory.createXMLStreamWriter(outputStreamWriter);

final var writer = new XmlReportWriter(data, classUtil, observer);
final var writer = new XmlReportWriter(data, classUtil, observer, mock(MessageStorage.class));
writer.writeXmlReport(xmlWriter, Duration.ofSeconds(1));

outputStreamWriter.close();
Expand Down

0 comments on commit b410ec0

Please sign in to comment.