src/aria/jsunit/Assert.js
function (errorMsg, count) {
                var res = null;
                var logAppender = this._logAppender;
                var logs = logAppender.getLogs(), errFound = false, newLogs = [];
                if (!errorMsg) {
                    this.assertTrue(false, "assertErrorInLogs was called with a null error message.");
                }
                if (count && count > 0) {
                    res = [];
                    var localCount = 0;
                    for (var i = 0; logs.length > i; i++) {
                        if (localCount < count && logs[i].msgId == errorMsg) {
                            localCount++;
                            res.push(logs[i]);
                        } else {
                            newLogs.push(logs[i]);
                        }
                    }
                    logAppender.setLogs(newLogs);
                    this.assertTrue(localCount == count, "Expected error " + errorMsg + " found " + localCount
                            + " times in logs");
                } else {
                    for (var i = 0; logs.length > i; i++) {
                        if (logs[i].msgId == errorMsg) {
                            errFound = true;
                            res = logs[i];
                        } else {
                            newLogs.push(logs[i]);
                        }
                    }
                    logAppender.setLogs(newLogs);
                    this.assertTrue(errFound, "Expected error not found in logs: " + errorMsg);
                }
                return res;
            }
function (errorMsg, count) {
                var res = null;
                var logAppender = this._logAppender;
                var logs = logAppender.getLogs(), errFound = false, newLogs = [];
                if (!errorMsg) {
                    this.assertTrue(false, "assertErrorInLogs was called with a null error message.");
                }
                if (count && count > 0) {
                    res = [];
                    var localCount = 0;
                    for (var i = 0; logs.length > i; i++) {
                        if (localCount < count && logs[i].msgId == errorMsg) {
                            localCount++;
                            res.push(logs[i]);
                        } else {
                            newLogs.push(logs[i]);
                        }
                    }
                    logAppender.setLogs(newLogs);
                    this.assertTrue(localCount == count, "Expected error " + errorMsg + " found " + localCount
                            + " times in logs");
                } else {
                    for (var i = 0; logs.length > i; i++) {
                        if (logs[i].msgId == errorMsg) {
                            errFound = true;
                            res = logs[i];
                        } else {
                            newLogs.push(logs[i]);
                        }
                    }
                    logAppender.setLogs(newLogs);
                    this.assertTrue(errFound, "Expected error not found in logs: " + errorMsg);
                }
                return res;
            }
function ( errorMsg , count ) { var res = null ; var logAppender = this . _logAppender ; var logs = logAppender . getLogs ( ) , errFound = false , newLogs = [ ] ; if ( ! errorMsg ) { this . assertTrue ( false , "assertErrorInLogs was called with a null error message." ) ; } if ( count && count > 0 ) { res = [ ] ; var localCount = 0 ; for ( var i = 0 ; logs . length > i ; i ++ ) { if ( localCount < count && logs [ i ] . msgId == errorMsg ) { localCount ++ ; res . push ( logs [ i ] ) ; } else { newLogs . push ( logs [ i ] ) ; } } logAppender . setLogs ( newLogs ) ; this . assertTrue ( localCount == count , "Expected error " + errorMsg + " found " + localCount + " times in logs" ) ; } else { for ( var i = 0 ; logs . length > i ; i ++ ) { if ( logs [ i ] . msgId == errorMsg ) { errFound = true ; res = logs [ i ] ; } else { newLogs . push ( logs [ i ] ) ; } } logAppender . setLogs ( newLogs ) ; this . assertTrue ( errFound , "Expected error not found in logs: " + errorMsg ) ; } return res ; }
Asserts that an error should be present in the logs at least 'count' number of times. Once called,
'count' occurrences of the error will be discarded. If the parameter 'count' is not present, all
occurrences will be removed.
@param {String} errorMsg Must not be null or undefined
@param {Number} count [optional] number of times the error must be present in the logs
Asserts that an error should be present in the logs at least count number of times . Once called count occurrences of the error will be discarded . If the parameter count is not present all occurrences will be removed .