1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-08 12:01:09 +01:00

[xdata] Ensure that hidden FROM_TYPE field is first

This commit is contained in:
Florian Schmaus 2021-03-02 21:40:52 +01:00
parent 687c4f35aa
commit 33f59fd7ed
2 changed files with 37 additions and 0 deletions

View file

@ -153,4 +153,14 @@ public class DataFormTest extends SmackTestSuite {
DataForm df = pr.parse(PacketParserUtils.getParserFor(formWithFixedField));
assertEquals(Type.fixed, df.getFields().get(0).getType());
}
@Test
public void testReorderHiddenFormTypeFieldAtFirstPosition() {
DataForm dataForm = DataForm.builder()
.addField(FormField.textSingleBuilder("foo1").setValue("bar").build())
.addField(FormField.textSingleBuilder("foo2").setValue("baz").build())
.setFormType("my-form-type")
.build();
assertNotNull(dataForm.getFields().get(0).asHiddenFormTypeFieldIfPossible());
}
}