Skip to content

Commit

Permalink
Moved DOM sibling tests to the proper package
Browse files Browse the repository at this point in the history
  • Loading branch information
ddekany committed Jan 12, 2017
1 parent aa7ab1c commit 1dcd21d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package freemarker.core;
package freemarker.ext.dom;

import java.io.IOException;

Expand All @@ -28,21 +28,21 @@
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import freemarker.ext.dom.NodeModel;
import freemarker.template.TemplateException;
import freemarker.test.TemplateTest;

public class SiblingTest extends TemplateTest {
public class DOMSiblingTest extends TemplateTest {

@Before
public void setUp() throws SAXException, IOException, ParserConfigurationException {
InputSource is = new InputSource(getClass().getResourceAsStream("siblingDataModel.xml"));
InputSource is = new InputSource(getClass().getResourceAsStream("DOMSiblingTest.xml"));
addToDataModel("doc", NodeModel.parse(is));
}

@Test
public void testBlankPreviousSibling() throws IOException, TemplateException {
assertOutput("${doc.person.name?previousSibling}", "\n ");
assertOutput("${doc.person.name?previous_sibling}", "\n ");
}

@Test
Expand All @@ -53,6 +53,7 @@ public void testNonBlankPreviousSibling() throws IOException, TemplateException
@Test
public void testBlankNextSibling() throws IOException, TemplateException {
assertOutput("${doc.person.name?nextSibling}", "\n ");
assertOutput("${doc.person.name?next_sibling}", "\n ");
}

@Test
Expand All @@ -67,14 +68,12 @@ public void testNullPreviousSibling() throws IOException, TemplateException {

@Test
public void testSignificantPreviousSibling() throws IOException, TemplateException {
String ftl = "${doc.person.name.@@previous_sibling_element}";
assertOutput(ftl, "male");
assertOutput("${doc.person.name.@@previous_sibling_element}", "male");
}

@Test
public void testSignificantNextSibling() throws IOException, TemplateException {
String ftl = "${doc.person.name.@@next_sibling_element}";
assertOutput(ftl, "12th August");
assertOutput("${doc.person.name.@@next_sibling_element}", "12th August");
}

@Test
Expand All @@ -96,4 +95,5 @@ public void testSkippingEmptyCDataNode() throws IOException, TemplateException {
public void testValidCDataNode() throws IOException, TemplateException {
assertOutput("${doc.person.phone.@@previous_sibling_element?size}", "0");
}

}
6 changes: 4 additions & 2 deletions src/test/java/freemarker/ext/dom/DOMTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
*/
package freemarker.ext.dom;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

import java.io.IOException;
import java.io.StringReader;
Expand Down

0 comments on commit 1dcd21d

Please sign in to comment.