Run the test with this method.
The data is input for the {@link Record}.
@param input input {@link Record}
@param output result of {@link Record} {@link List}
9169
public void run(Record input, List<Record> output) {
        driver.withInput(input.getKey(), input.getValue());

        if (output != null) {
            for (Record r : output) {
                driver.withOutput(r.getKey(), r.getValue());
            }
        }

        driver.runTest();
    }
1040654
@Override
	public void collect(IT record) {
		try {
			this.numRecordsIn.inc();
			this.outputCollector.collect(this.mapper.map(record));
		} catch (Exception ex) {
			throw new ExceptionInChainedStubException(this.taskName, ex);
		}
	}
1330427
private void init( List<T> list ) {
		this.list = list;
		indexes = new int[ list.size() ];
		counters = new int[ list.size() ];

		for( int i = 0; i < indexes.length ; i++ ) {
			counters[i] = indexes[i] = i;
		}

		total = 1;
		for( int i = 2; i <= indexes.length ; i++ ) {
			total *= i;
		}

		permutation = 0;
	}
820122
@Override
    public void write(DataOutput out) throws IOException {
        if (record != null) record.write(out);
    }
941224
@Override
    public List<InputRecord> generate() throws Exception {
        List<InputRecord> result = new ArrayList<InputRecord>();
        // Generated valid string
        Generex generex = new Generex(this.getInput().getValue());
        String value = "";
        InputRecord testRecord = this.getInput();
        for (int i = 0; i < 2; i++) {
            value = generex.random(1);
            result.add(
                    new InputRecord(
                            testRecord.getName(),
                            testRecord.getType(),
                            value,
                            testRecord.getCondition(),
                            value.matches(testRecord.getValue()))
            );
        }
        // Empty string
        value = "";
        result.add(
                new InputRecord(
                        testRecord.getName(),
                        testRecord.getType(),
                        value,
                        testRecord.getCondition(),
                        value.matches(testRecord.getValue()))
        );
        // Doubled string (repetitive pattern)
        value = generex.random(1);
        value = value.concat(value);
        result.add(
                new InputRecord(
                        testRecord.getName(),
                        testRecord.getType(),
                        value,
                        testRecord.getCondition(),
                        value.matches(testRecord.getValue()))
        );
        // Pattern itself
        result.add(
                new InputRecord(
                    testRecord.getName(),
                    testRecord.getType(),
                    testRecord.getValue(),
                    testRecord.getCondition(),
                    testRecord.getValue().matches(testRecord.getValue()))
                );
        return result;
    }
918379
public void processRecord(Record record) {
		
		//超过10行空白就不处理了
		if(blankRowNum == 10)return;
		
		int thisRow = -1;
		int thisColumn = -1;
		String thisStr = null;

		switch (record.getSid())
		{
		case BoundSheetRecord.sid:
			boundSheetRecords.add((BoundSheetRecord)record);
			break;
		case BOFRecord.sid:
			BOFRecord br = (BOFRecord)record;
			if(br.getType() == BOFRecord.TYPE_WORKSHEET) {
				// Create sub workbook if required
				if(workbookBuildingListener != null && stubWorkbook == null) {
					stubWorkbook = workbookBuildingListener.getStubHSSFWorkbook();
				}
				
				// Output the worksheet name
				// Works by ordering the BSRs by the location of
				//  their BOFRecords, and then knowing that we
				//  process BOFRecords in byte offset order
				sheetIndex++;
				if(orderedBSRs == null) {
					orderedBSRs = BoundSheetRecord.orderByBofPosition(boundSheetRecords);
				}
				//sheetName
				//System.out.println(orderedBSRs[sheetIndex].getSheetname() + " [" + (sheetIndex+1) + "]:" );
				String sheetname = orderedBSRs[sheetIndex].getSheetname();
				results.add(ExcelValidator.SHEET_NAME_PREFIX + sheetname);
			}
			break;

		case SSTRecord.sid:
			sstRecord = (SSTRecord) record;
			break;

		case BlankRecord.sid:
			BlankRecord brec = (BlankRecord) record;

			thisRow = brec.getRow();
			thisColumn = brec.getColumn();
			thisStr = "";
			break;
		case BoolErrRecord.sid:
			BoolErrRecord berec = (BoolErrRecord) record;

			thisRow = berec.getRow();
			thisColumn = berec.getColumn();
			thisStr = "";
			break;

		case FormulaRecord.sid:
			FormulaRecord frec = (FormulaRecord) record;

			thisRow = frec.getRow();
			thisColumn = frec.getColumn();

			if(outputFormulaValues) {
				if(Double.isNaN( frec.getValue() )) {
					// Formula result is a string
					// This is stored in the next record
					outputNextStringRecord = true;
					nextRow = frec.getRow();
					nextColumn = frec.getColumn();
				} else {
					thisStr = formatListener.formatNumberDateCell(frec);
				}
			} else {
				thisStr = HSSFFormulaParser.toFormulaString(stubWorkbook, frec.getParsedExpression());
			}
			break;
		case StringRecord.sid:
			if(outputNextStringRecord) {
				// String for formula
				StringRecord srec = (StringRecord)record;
				thisStr = srec.getString();
				thisRow = nextRow;
				thisColumn = nextColumn;
				outputNextStringRecord = false;
			}
			break;

		case LabelRecord.sid:
			LabelRecord lrec = (LabelRecord) record;

			thisRow = lrec.getRow();
			thisColumn = lrec.getColumn();
			thisStr = lrec.getValue();
			break;
		case LabelSSTRecord.sid:
			LabelSSTRecord lsrec = (LabelSSTRecord) record;

			thisRow = lsrec.getRow();
			thisColumn = lsrec.getColumn();
			if(sstRecord == null) {
				thisStr = "(No SST Record, can't identify string)";
			} else {
				thisStr = sstRecord.getString(lsrec.getSSTIndex()).toString();
			}
			break;
		case NoteRecord.sid:
			NoteRecord nrec = (NoteRecord) record;

			thisRow = nrec.getRow();
			thisColumn = nrec.getColumn();
			// TODO: Find object to match nrec.getShapeId()
			thisStr = "(TODO)";
			break;
		case NumberRecord.sid:
			NumberRecord numrec = (NumberRecord) record;

			thisRow = numrec.getRow();
			thisColumn = numrec.getColumn();

			// Format
			thisStr = formatListener.formatNumberDateCell(numrec);
			break;
		case RKRecord.sid:
			RKRecord rkrec = (RKRecord) record;

			thisRow = rkrec.getRow();
			thisColumn = rkrec.getColumn();
			thisStr = "(TODO)";
			break;
		default:
			break;
		}

		// Handle new row
		if(thisRow != -1 && thisRow != lastRowNumber) {
			lastColumnNumber = -1;
		}

		// Handle missing column
		if(record instanceof MissingCellDummyRecord) {
			MissingCellDummyRecord mc = (MissingCellDummyRecord)record;
			thisRow = mc.getRow();
			thisColumn = mc.getColumn();
			thisStr = "";
		}


		if(thisStr != null) {
			if(thisColumn > 0) {
				_resultRowTmp.append(ExcelValidator.FIELD_SPLIT);
			}
			_resultRowTmp.append(thisStr);
		}

		// Update column and row count
		if(thisRow > -1)
			lastRowNumber = thisRow;
		if(thisColumn > -1)
			lastColumnNumber = thisColumn;

		// Handle end of row
		if(record instanceof LastCellOfRowDummyRecord) {
			// Print out any missing commas if needed
			if(minColumns > 0) {
				// Columns are 0 based
				if(lastColumnNumber == -1) { lastColumnNumber = 0; }
				for(int i=lastColumnNumber; i<(minColumns); i++) {
					_resultRowTmp.append(',');
				}
			}

			// We're onto a new row
			lastColumnNumber = -1;

			// End the row
			if(!ExcelValidator.isBlankCSVRow(_resultRowTmp.toString())){				
				results.add(_resultRowTmp.toString());
			}else{
				blankRowNum = blankRowNum + 1;
			}
			_resultRowTmp.setLength(0);
		}
	}
1163134
@Override
	public void collect(Record record)
	{
		try {
			for (int i = 0; i < writers.length; i++) {
				this.writers[i].emit(record);
			}
		}
		catch (IOException e) {
			throw new RuntimeException("Emitting the record caused an I/O exception: " + e.getMessage(), e);
		}
		catch (InterruptedException e) {
			throw new RuntimeException("Emitting the record was interrupted: " + e.getMessage(), e);
		}
	}
1217161
public void setData(TByteList list) {
        this.buffer = CausticUtil.createByteBuffer(list.size());
        this.buffer.put(list.toArray());
    }
1152055
public static void writeList(Collection<?> lines,
                                 OutputStream output) throws IOException {
        writeList(lines, output, Charset.defaultCharset());
    }
1064912
private void appendList(StringBuffer buffer, List<Object> list) {

        Iterator<Object> iter = list.iterator();
        while (iter.hasNext()) {
            Object entry = iter.next();
            buffer.append(entry).append("<br/>\n");
        }
    }
1125531
protected void run(Pattern separator,
                       String input,
                       List<Record> output) throws IOException, URISyntaxException {
        run(null, separator.pattern(), true, false, input, output);
    }
564926
public void addRecord(Rec record, boolean bMainQuery)
    {
        if (record == null)
            return;
        if (this.contains(record))
        {     // Don't add this twice.
            if (!bMainQuery)
                return;
            this.removeRecord(record);  // Change order
        }
        if (bMainQuery)
            this.insertElementAt(record, 0);
        else
            this.addElement(record);
    }
680835
@Override
    public List<InputRecord> generate() throws Exception {
        List<InputRecord> result = new ArrayList<InputRecord>();
        this.validate();

        InputRecord inputValue = (InputRecord) this.getInput().clone();
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat format = new SimpleDateFormat(this.formatString);
        DateTime start = new DateTime(lower);
        DateTime end = new DateTime(upper);

        // Valid in range value
        int range = Days.daysBetween(start, end).getDays();
        calendar.setTime(lower);
        calendar.add(Calendar.DAY_OF_YEAR, range / 2);
        inputValue.setValue(format.format(calendar.getTime()));
        inputValue.setValidInput(true);
        result.add(inputValue);
        // Another valid value
        if (range > 1) {
            inputValue = (InputRecord) this.getInput().clone();
            calendar.setTime(lower);
            calendar.add(Calendar.DAY_OF_YEAR, range / 2 + 1);
            inputValue.setValue(format.format(calendar.getTime()));
            inputValue.setValidInput(true);
            result.add(inputValue);
        }
        // Lower border value
        inputValue = (InputRecord) this.getInput().clone();
        inputValue.setValue(format.format(lower));
        inputValue.setValidInput(this.includeLower);
        result.add(inputValue);
        // Upper border value
        inputValue = (InputRecord) this.getInput().clone();
        inputValue.setValue(format.format(upper));
        inputValue.setValidInput(this.includeUpper);
        result.add(inputValue);
        // Day before lower
        inputValue = (InputRecord) this.getInput().clone();
        calendar.setTime(lower);
        calendar.add(Calendar.DAY_OF_YEAR, -1);
        inputValue.setValue(format.format(calendar.getTime()));
        inputValue.setValidInput(false);
        result.add(inputValue);
        // Day after upper
        inputValue = (InputRecord) this.getInput().clone();
        calendar.setTime(upper);
        calendar.add(Calendar.DAY_OF_YEAR, 1);
        inputValue.setValue(format.format(calendar.getTime()));
        inputValue.setValidInput(false);
        result.add(inputValue);

        return result;
    }
1021604
public void write(WARCWritable record) throws IOException {
        if (record.getRecord() != null) write(record.getRecord());
    }
777217
@Override
    public synchronized void writeRecord(String record) {
        long length = record.length() + LoggingConstants.nlen;
        PrintStream ps = getPrintStream(length);
        ps.println(record);
        if (ps.checkError()) {
            setStreamStatus(StreamStatus.CLOSED, null, null, DummyOutputStream.psInstance);
            // to avoid junit test to print an error message
            if (System.getProperty("test.classesDir") == null && System.getProperty("test.buildDir") == null) {
                System.err.println(Tr.formatMessage(getTc(), "FAILED_TO_WRITE_LOG", new Object[] { getPrimaryFile().getAbsolutePath() }));
            }
        }
    }
131289
public List evaluate(Record record) {
    // fast path (not functionally necessary):
    if (fields.size() == 1) {
      Object first = fields.get(0);
      if (first instanceof String) {
        return Collections.singletonList(first);
      } else {
        String ref = ((Field) first).getName();
        if (ref.length() != 0) {
          List resolvedValues = record.get(ref);
          return resolvedValues;
        }
      }
    }

    // slow path:
    ArrayList<Object> results = new ArrayList<Object>(1);
    evaluate2(0, record, new StringBuilder(), results);
    return results;
  }
954819
protected static void writeList(Output out, List<?> list) {
        if (!list.isEmpty()) {
            int size = list.size();
            // if its a small list, write it as an array
            if (size < 100) {
                out.writeArray(list);
                return;
            }
            // else we should check for lots of null values,
            // if there are over 80% then its probably best to do it as a map
            int nullCount = 0;
            for (int i = 0; i < size; i++) {
                if (list.get(i) == null) {
                    nullCount++;
                }
            }
            if (nullCount > (size * 0.8)) {
                out.writeMap(list);
            } else {
                out.writeArray(list);
            }
        } else {
            out.writeArray(new Object[] {});
        }
    }