Skip to content

Commit

Permalink
Add test for default value tag. (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwinter committed Oct 7, 2021
1 parent 2e0a4c6 commit c1d58cc
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.metafacture.framework.helpers.DefaultObjectReceiver;
import org.metafacture.framework.helpers.DefaultXmlPipe;

import java.util.HashMap;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;
import org.metafacture.framework.helpers.DefaultObjectReceiver;

/**
* Tests for class {@link SimpleXmlEncoder}.
Expand Down Expand Up @@ -251,6 +253,22 @@ public void issue379_testShouldEncodeConfiguredValueLiteralsAsText() {
getResultXml());
}

@Test
public void issue379_testShouldNotEncodeUnconfiguredValueLiteralsAsText() {
simpleXmlEncoder.startRecord("");
simpleXmlEncoder.literal(DefaultXmlPipe.DEFAULT_VALUE_TAG, VALUE);
simpleXmlEncoder.endRecord();
simpleXmlEncoder.closeStream();

assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<records>" +
"<record>" +
"<value>value</value>" +
"</record>" +
"</records>",
getResultXml());
}

@Test
public void testShouldEncodeMarkedLiteralsAsAttributes() {
simpleXmlEncoder.startRecord("");
Expand Down

0 comments on commit c1d58cc

Please sign in to comment.