r3922 - trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api
Author: tchemit Date: 2014-05-08 09:34:51 +0200 (Thu, 08 May 2014) New Revision: 3922 Url: http://forge.chorem.org/projects/pollen/repository/revisions/3922 Log: fix converter test Modified: trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/TopiaEntityArrayConverterTest.java Modified: trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/TopiaEntityArrayConverterTest.java =================================================================== --- trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/TopiaEntityArrayConverterTest.java 2014-05-07 16:20:20 UTC (rev 3921) +++ trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/TopiaEntityArrayConverterTest.java 2014-05-08 07:34:51 UTC (rev 3922) @@ -1,6 +1,7 @@ package org.chorem.pollen.rest.api; import org.chorem.pollen.persistence.entity.Choice; +import org.chorem.pollen.persistence.entity.ChoiceType; import org.junit.Assert; import org.junit.Test; @@ -9,15 +10,24 @@ @Test public void convertToType() throws Exception { - String choicesStr = "[ {name: \"choice1\", choiceType: \"TEXT\"}, " + - "{name: \"choice2\", choiceType: \"IMAGE\"} ]"; + String choicesStr = "[ {name: \"choice1\", choiceType: \"TEXT\", choiceOrder: 1}, " + + "{name: \"choice2\", choiceType: \"IMAGE\", choiceOrder: 2} ]"; TopiaEntityArrayConverter converter = TopiaEntityArrayConverter.newconverter(Choice.class); - TopiaEntityList<Choice> choices = converter.convert(TopiaEntityList.class, choicesStr); + Choice[] choices = converter.convert(Choice[].class, choicesStr); Assert.assertNotNull(choices); - Assert.assertEquals(2, choices.size()); + Assert.assertEquals(2, choices.length); + Assert.assertNotNull(choices[0]); + Assert.assertEquals("choice1", choices[0].getName()); + Assert.assertEquals(ChoiceType.TEXT, choices[0].getChoiceType()); + Assert.assertEquals(1, choices[0].getChoiceOrder()); + Assert.assertNotNull(choices[1]); + Assert.assertEquals("choice2", choices[1].getName()); + Assert.assertEquals(ChoiceType.IMAGE, choices[1].getChoiceType()); + Assert.assertEquals(2, choices[1].getChoiceOrder()); + } } \ No newline at end of file
participants (1)
-
tchemit@users.chorem.org