This repository has been archived by the owner on Apr 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a regression test and fix by catching the NPE (#790)
- Loading branch information
Showing
6 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...takit/briefcase/export/ExportToCsvExplodeChoiceListWithRelativePredicateInRepeatTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.opendatakit.briefcase.export; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class ExportToCsvExplodeChoiceListWithRelativePredicateInRepeatTest { | ||
private ExportToCsvScenario scenario; | ||
|
||
@Before | ||
public void setUp() { | ||
scenario = ExportToCsvScenario.setUp("choice-lists-predicate-relative-repeat"); | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
scenario.tearDown(); | ||
} | ||
|
||
@Test | ||
public void exports_forms_with_all_data_types() { | ||
scenario.runExportExplodedChoiceLists(); | ||
scenario.assertSameContent(); | ||
scenario.assertSameContentRepeats("", "group"); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...rg/opendatakit/briefcase/export/choice-lists-predicate-relative-repeat-group.csv.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
category,item,PARENT_KEY,KEY,SET-OF-group | ||
1,1,uuid:a21ca0ad-db7e-4ef5-b7ea-d73dd4a42bf0,uuid:a21ca0ad-db7e-4ef5-b7ea-d73dd4a42bf0/group[1],uuid:a21ca0ad-db7e-4ef5-b7ea-d73dd4a42bf0/group |
9 changes: 9 additions & 0 deletions
9
...es/org/opendatakit/briefcase/export/choice-lists-predicate-relative-repeat-submission.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<data id="choice-lists-predicate-relative-repeat" instanceID="uuid:a21ca0ad-db7e-4ef5-b7ea-d73dd4a42bf0" submissionDate="2019-03-17T10:14:18.820Z" isComplete="true" markedAsCompleteDate="2019-03-17T10:14:18.820Z" xmlns="http://opendatakit.org/submissions"> | ||
<group> | ||
<category>1</category> | ||
<item>1</item> | ||
</group> | ||
<n0:meta xmlns:n0="http://openrosa.org/xforms"> | ||
<n0:instanceID>uuid:a21ca0ad-db7e-4ef5-b7ea-d73dd4a42bf0</n0:instanceID> | ||
</n0:meta> | ||
</data> |
2 changes: 2 additions & 0 deletions
2
...rces/org/opendatakit/briefcase/export/choice-lists-predicate-relative-repeat.csv.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SubmissionDate,SET-OF-group,meta-instanceID,KEY | ||
"Mar 17, 2019 10:14:18 AM",uuid:a21ca0ad-db7e-4ef5-b7ea-d73dd4a42bf0/group,uuid:a21ca0ad-db7e-4ef5-b7ea-d73dd4a42bf0,uuid:a21ca0ad-db7e-4ef5-b7ea-d73dd4a42bf0 |
95 changes: 95 additions & 0 deletions
95
test/resources/org/opendatakit/briefcase/export/choice-lists-predicate-relative-repeat.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:jr="http://openrosa.org/javarosa"> | ||
<h:head> | ||
<h:title>Populate dynamic choices in repeat groups with relative paths</h:title> | ||
<model> | ||
<instance> | ||
<data id="choice-lists-predicate-relative-repeat"> | ||
<group jr:template=""> | ||
<category/> | ||
<item/> | ||
</group> | ||
<meta> | ||
<instanceID/> | ||
</meta> | ||
</data> | ||
</instance> | ||
<instance id="items"> | ||
<root> | ||
<item> | ||
<name>1</name> | ||
<category>1</category> | ||
</item> | ||
<item> | ||
<name>2</name> | ||
<category>1</category> | ||
</item> | ||
<item> | ||
<name>3</name> | ||
<category>1</category> | ||
</item> | ||
<item> | ||
<name>4</name> | ||
<category>1</category> | ||
</item> | ||
<item> | ||
<name>5</name> | ||
<category>2</category> | ||
</item> | ||
<item> | ||
<name>6</name> | ||
<category>2</category> | ||
</item> | ||
<item> | ||
<name>7</name> | ||
<category>2</category> | ||
</item> | ||
<item> | ||
<name>8</name> | ||
<category>3</category> | ||
</item> | ||
<item> | ||
<name>9</name> | ||
<category>3</category> | ||
</item> | ||
<item> | ||
<name>10</name> | ||
<category>3</category> | ||
</item> | ||
</root> | ||
</instance> | ||
<bind nodeset="/data/group/category" required="true()" type="select1"/> | ||
<bind nodeset="/data/group/item" required="true()" type="select1"/> | ||
<bind nodeset="/data/meta/instanceID" jr:preload="uid" readonly="true()" type="string"/> | ||
</model> | ||
</h:head> | ||
<h:body> | ||
<group ref="/data/group"> | ||
<label>Repeat group</label> | ||
<repeat nodeset="/data/group"> | ||
<select1 ref="/data/group/category"> | ||
<label>Category</label> | ||
<item> | ||
<label>1</label> | ||
<value>1</value> | ||
</item> | ||
<item> | ||
<label>2</label> | ||
<value>2</value> | ||
</item> | ||
<item> | ||
<label>3</label> | ||
<value>3</value> | ||
</item> | ||
</select1> | ||
<select1 ref="/data/group/item"> | ||
<label>Item</label> | ||
<itemset nodeset="instance('items')/root/item[category= current()/../category ]"> | ||
<value ref="name"/> | ||
<label ref="name"/> | ||
</itemset> | ||
</select1> | ||
</repeat> | ||
</group> | ||
</h:body> | ||
</h:html> |