function runSetValueTests(
  validValueTestCases,
  invalidValueTestCases,
  invalidRunExpectedValue,
  invalidRunExpectedText,
) {
  /**
   * Creates test callback for invalid setValue test.
   * @param {!FieldValueTestCase} testCase The test case information.
   * @returns {!Function} The test callback.
   */
  const createInvalidSetValueTestCallback = (testCase) => {
    return function () {
      this.field.setValue(testCase.value);
      assertFieldValue(
        this.field,
        invalidRunExpectedValue,
        invalidRunExpectedText,
      );
    };
  };
  /**
   * Creates test callback for valid setValue test.
   * @param {!FieldValueTestCase} testCase The test case information.
   * @returns {!Function} The test callback.
   */
  const createValidSetValueTestCallback = (testCase) => {
    return function () {
      this.field.setValue(testCase.value);
      assertFieldValue(
        this.field,
        testCase.expectedValue,
        testCase.expectedText,
      );
    };
  };
  runTestCases(invalidValueTestCases, createInvalidSetValueTestCallback);
  runTestCases(validValueTestCases, createValidSetValueTestCallback);
}
Runs tests for setValue calls.
@param {!Array<!FieldValueTestCase>} validValueTestCases Test cases with
   valid values.
@param {!Array<!FieldValueTestCase>} invalidValueTestCases Test cases with
   invalid values.
@param {*} invalidRunExpectedValue Expected value for field after invalid
   call to setValue.
@param {string=} invalidRunExpectedText Expected text for field after invalid
   call to setValue.