*
* Assertion: creates RealmChoiceCallback object which allows
* multiple choices
*/
public void test03() {
RealmChoiceCallback rCCB;
for (int i = 0; i < prompts.length; i++) {
rCCB = new RealmChoiceCallback(prompts[i], choices, 0, true);
assertEquals("Incorrect prompt", rCCB.getPrompt(), prompts[i]);
String[] ch = rCCB.getChoices();
assertEquals("Incorrect choices length", ch.length, choices.length);
for (int j = 0; j < ch.length; j++) {
assertEquals("Incorrect choice number: " + j, ch[j], choices[j]);
}
assertTrue("Incorrect multiple", rCCB.allowMultipleSelections());
int[] ind = rCCB.getSelectedIndexes();
assertNull("Incorrect selected indexes", ind);
rCCB.setSelectedIndexes(indexes);
ind = rCCB.getSelectedIndexes();
assertEquals("Incorrect index length", ind.length, indexes.length);
for (int j = 0; j < indexes.length; j++) {
assertEquals("Incorrect index number: " + Integer.toString(j),
ind[j], indexes[j]);
}
for (int j = indexes.length - 1; j >= 0; j--) {
rCCB.setSelectedIndex(indexes[j]);
ind = rCCB.getSelectedIndexes();
assertEquals("Incorrect index length", ind.length, 1);
assertEquals("Incorrect index", ind[0], indexes[j]);
}
rCCB.setSelectedIndexes(indexes);
ind = rCCB.getSelectedIndexes();
assertEquals("Incorrect index length", ind.length, indexes.length);
for (int j = 0; j < indexes.length; j++) {
assertEquals("Incorrect index number: " + Integer.toString(j),
ind[j], indexes[j]);
}
rCCB.setSelectedIndexes(null);
assertNull("Incorrect indexes array", rCCB.getSelectedIndexes());
}
}