Changeset 4940

Show
Ignore:
Timestamp:
06/23/08 13:33:46 (5 months ago)
Author:
magi@…
Message:

Order selected items in Tables example because the return type is a Set and we need to always have them in the same order for testing purposes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/com/itmill/toolkit/automatedtests/featurebrowser/TableExample.java

    r4138 r4940  
    66 
    77import java.util.Iterator; 
     8import java.util.LinkedList; 
     9import java.util.List; 
    810import java.util.Random; 
    911import java.util.Set; 
     
    233235            final Set selected = (Set) source.getValue(); 
    234236            int s = 0; 
    235             for (final Iterator it = selected.iterator(); it.hasNext();) { 
     237             
     238            // The set can return the items in quite any order, but 
     239            // for testing purposes they always have to be in the 
     240            // same order. 
     241            List ordered = new LinkedList(selected); 
     242            java.util.Collections.sort(ordered); 
     243             
     244            // Now move the items to the other table 
     245            for (final Iterator it = ordered.iterator(); it.hasNext();) { 
    236246                final Object id = it.next(); 
    237247                if (!saved.containsId(id)) {