try {
final long beginTime_ms = System.currentTimeMillis(); // begin time
long elapsedTime_ms = 0; // total elapsed time
final long checkTimeInterval_ms = 100; // check every 100 ms
Cache cache = CacheImpl.getInstance();
LinkedList<Object> currentValues = new LinkedList<Object>();
String mismatchVariableName = null;
Object mismatchVariableValue = null;
Object mismatchVariableExpectedValue = null;
do {
// Get current values and check if they match the expected values
currentValues.clear();
Set<Map.Entry<String, Object>> list = expectedValues.entrySet();
Iterator<Map.Entry<String, Object>> i = list.iterator();
boolean allVariablesMatch = true;
while (i.hasNext()) {
Map.Entry<String, Object> entry = i.next();
String key = entry.getKey();
Object expected = entry.getValue();
// get current value and store it
Object currentValue;
try {
currentValue = cache.getLast(key).getValue();
} catch (QTasteTestFailException e) {
currentValue = null;
}
currentValues.add(currentValue);