Skip to content

Commit

Permalink
[3940] Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dedenbangkit committed Nov 29, 2022
1 parent 4f21d6c commit a08d366
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions GAE/test/org/akvo/flow/util/FlowJsonObjectWriterTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void testWriteSimpleJsonObjectWithExcludeNonNull() {
// ignoring exception
}

String jsonStringExpected = "{\"type\":\"FREE_TEXT\",\"text\":\"First Question\",\"allowOtherFlag\":true,\"collapseable\":false,\"immutable\":false,\"personalData\":false,\"order\":0}";
String jsonStringExpected = "{\"type\":\"FREE_TEXT\",\"text\":\"First Question\",\"allowOtherFlag\":true,\"collapseable\":false,\"immutable\":false,\"personalData\":false,\"answerStats\":false,\"order\":0}";
assertEquals(jsonStringExpected, jsonString);
}

Expand Down Expand Up @@ -127,7 +127,7 @@ void testWriteSimpleJsonObjectWithTranslations() {
// ignoring exception
}

String jsonStringExpected = "{\"type\":\"FREE_TEXT\",\"tip\":\"Help\",\"text\":\"First Question\",\"translations\":[{\"languageCode\":\"es\",\"text\":\"Primera pregunta\",\"parentType\":\"QUESTION_TEXT\"},{\"languageCode\":\"es\",\"text\":\"Ayuda\",\"parentType\":\"QUESTION_TIP\"}],\"allowOtherFlag\":true,\"collapseable\":false,\"immutable\":false,\"personalData\":false,\"order\":0}";
String jsonStringExpected = "{\"type\":\"FREE_TEXT\",\"tip\":\"Help\",\"text\":\"First Question\",\"translations\":[{\"languageCode\":\"es\",\"text\":\"Primera pregunta\",\"parentType\":\"QUESTION_TEXT\"},{\"languageCode\":\"es\",\"text\":\"Ayuda\",\"parentType\":\"QUESTION_TIP\"}],\"allowOtherFlag\":true,\"collapseable\":false,\"immutable\":false,\"personalData\":false,\"answerStats\":false,\"order\":0}";
assertEquals(jsonStringExpected, jsonString);
}

Expand Down
4 changes: 3 additions & 1 deletion GAE/test/org/akvo/flow/xml/FlowXmlObjectWriterTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class FlowXmlObjectWriterTests {
"</question><question variableName=\"questionTwo\" id=\"1002\" order=\"2\" type=\"free\" mandatory=\"true\" localeNameFlag=\"false\">" +
"<validationRule validationType=\"numeric\" allowDecimal=\"false\" signed=\"false\"/>" +
"<text>This is question two</text></question>" +
"<question id=\"1003\" order=\"3\" personalData=\"true\" type=\"geoshape\" mandatory=\"false\" " +
"<question id=\"1003\" order=\"3\" personalData=\"true\" answerStats=\"false\" type=\"geoshape\" mandatory=\"false\" " +
"localeNameFlag=\"false\" allowPoints=\"false\" allowLine=\"false\" allowPolygon=\"false\">" +
"<text>This is question three</text></question>" +
"<heading>This is a group</heading>" +
Expand Down Expand Up @@ -199,6 +199,7 @@ void testSerialiseMinimalForm() throws IOException {
q3.setType(Question.Type.GEOSHAPE);
q3.setMandatoryFlag(false);
q3.setPersonalData(true);
q3.setAnswerStats(false);
qm.put(3, q3);

int questionCount = qm.size();
Expand Down Expand Up @@ -239,6 +240,7 @@ void testSerialiseMinimalForm() throws IOException {
assertEquals("This is question three", xq3.getText());
assertEquals(Boolean.FALSE, xq3.getMandatory());
assertEquals(Boolean.TRUE, xq3.getPersonalData());
assertEquals(Boolean.FALSE, xq3.getAnswerStats());
assertEquals("geoshape", xq3.getType());

//Convert Jackson tree into an XML string
Expand Down

0 comments on commit a08d366

Please sign in to comment.