Skip to content

Commit

Permalink
Merge pull request apache#3421 from wang3820/fix-flaky
Browse files Browse the repository at this point in the history
Fixed flaky test in SvgGraphics2DTest
  • Loading branch information
hansva authored Nov 21, 2023
2 parents 25508de + c96b72a commit 96cfd6a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.13.5</version>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.hop.core.svg;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.commons.lang.SystemUtils;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -57,7 +59,10 @@ public void notOnWindows() {
@Test
public void testNewDocumentXml() throws Exception {
HopSvgGraphics2D graphics2D = HopSvgGraphics2D.newDocument();
assertEquals(BASIC_SVG_XML, graphics2D.toXml());
XmlMapper xmlMapper = new XmlMapper();
JsonNode graphic2DNode = xmlMapper.readTree(graphics2D.toXml());
JsonNode basicSVGNode = xmlMapper.readTree(BASIC_SVG_XML);
assertEquals(basicSVGNode, graphic2DNode);
}

@Test
Expand All @@ -66,6 +71,9 @@ public void testNewDocumentSimpleXml() throws Exception {

graphics2D.drawOval(50, 50, 25, 25);

assertEquals(BASIC_CIRCLE_XML, graphics2D.toXml());
XmlMapper xmlMapper = new XmlMapper();
JsonNode graphic2DNode = xmlMapper.readTree(graphics2D.toXml());
JsonNode basicSVGNode = xmlMapper.readTree(BASIC_CIRCLE_XML);
assertEquals(basicSVGNode, graphic2DNode);
}
}

0 comments on commit 96cfd6a

Please sign in to comment.