Fixup the code around building the test combinations to better account

for a combo option that has no actual values, in this case we just throw
that combo out and let the class default be the value used in the test.
Before the order of iteration drove the combo build which caused early
exit from the loop if the last enties in the list were empty combo
options.
This commit is contained in:
Timothy Bish 2014-08-08 10:21:19 -04:00
parent 7c2735d0f4
commit e5ab933d2d
1 changed files with 12 additions and 8 deletions

View File

@ -206,15 +206,19 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport {
LinkedList<ComboOption> l = new LinkedList<ComboOption>(optionsLeft);
ComboOption comboOption = l.removeLast();
int i = 0;
for (Iterator<Object> iter = comboOption.values.iterator(); iter.hasNext();) {
Object value = iter.next();
if (i != 0) {
map = new HashMap<String, Object>(map);
expandedCombos.add(map);
}
map.put(comboOption.attribute, value);
if (comboOption.values.isEmpty() && !l.isEmpty()) {
expandCombinations(l, expandedCombos);
i++;
} else {
for (Iterator<Object> iter = comboOption.values.iterator(); iter.hasNext();) {
Object value = iter.next();
if (i != 0) {
map = new HashMap<String, Object>(map);
expandedCombos.add(map);
}
map.put(comboOption.attribute, value);
expandCombinations(l, expandedCombos);
i++;
}
}
}
}