Added two additional unit tests for ensuring the XmlImporter is behaving correctly.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1424 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
8d51223610
commit
ec0581e3a9
@ -65,6 +65,27 @@ public class XmlImporterTests extends RefineTest {
|
||||
Assert.assertNotNull(row.getCell(2));
|
||||
Assert.assertEquals(row.getCell(2).value, "Author 1, The");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canParseDeeplyNestedSample(){
|
||||
RunTest(getDeeplyNestedSample());
|
||||
|
||||
log(project);
|
||||
assertProjectCreated(project, 4, 6);
|
||||
|
||||
Row row = project.rows.get(0);
|
||||
Assert.assertNotNull(row);
|
||||
Assert.assertNotNull(row.getCell(2));
|
||||
Assert.assertEquals(row.getCell(2).value, "Author 1, The");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canParseSampleWithMixedElement(){
|
||||
RunTest(getMixedElementSample());
|
||||
|
||||
log(project);
|
||||
assertProjectCreated(project, 0, 0); //nothing imported
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canParseSampleWithDuplicateNestedElements(){
|
||||
@ -158,6 +179,30 @@ public class XmlImporterTests extends RefineTest {
|
||||
sb.append("</library>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getDeeplyNestedSample(){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("<?xml version=\"1.0\"?><nest><nest2><library>");
|
||||
for(int i = 1; i < 7; i++){
|
||||
sb.append(getTypicalElement(i));
|
||||
}
|
||||
sb.append("</nest2>");
|
||||
sb.append("<anElement>asdf</anElement></nest></library>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getMixedElementSample(){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("<?xml version=\"1.0\"?><nest>");
|
||||
sb.append("somemixeduptext");
|
||||
sb.append("<nest2><library>");
|
||||
for(int i = 1; i < 7; i++){
|
||||
sb.append(getTypicalElement(i));
|
||||
}
|
||||
sb.append("</nest2>");
|
||||
sb.append("<anElement>asdf</anElement></nest></library>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getSampleWithDuplicateNestedElements(){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
Loading…
Reference in New Issue
Block a user