Package com.google.javascript.rhino.testing

# Class BaseJSTypeTestCase

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
com.google.javascript.rhino.testing.BaseJSTypeTestCase

All Implemented Interfaces:
  `junit.framework.Test`

public abstract class BaseJSTypeTestCase extends junit.framework.TestCase

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ALL_NATIVE_EXTERN_TYPES`
A definition of all extern types.
`protected JSType`
`ALL_TYPE`
`protected FunctionType`
`ARRAY_FUNCTION_TYPE`
`protected ObjectType`
`ARRAY_TYPE`
`protected JSType`
`BOOLEAN_OBJECT_FUNCTION_TYPE`
`protected ObjectType`
`BOOLEAN_OBJECT_TYPE`
`protected JSType`
`BOOLEAN_TYPE`
`protected ObjectType`
`CHECKED_UNKNOWN_TYPE`
`protected JSType`
`DATE_FUNCTION_TYPE`
`protected ObjectType`
`DATE_TYPE`
`protected JSType`
`ERROR_FUNCTION_TYPE`
`protected ObjectType`
`ERROR_TYPE`
`protected TestErrorReporter`
`errorReporter`
`protected JSType`
`EVAL_ERROR_FUNCTION_TYPE`
`protected ObjectType`
`EVAL_ERROR_TYPE`
`protected FunctionType`
`FUNCTION_FUNCTION_TYPE`
`protected FunctionType`
`FUNCTION_INSTANCE_TYPE`
`protected ObjectType`
`FUNCTION_PROTOTYPE`
`protected JSType`
`GREATEST_FUNCTION_TYPE`
`protected JSType`
`LEAST_FUNCTION_TYPE`
`protected JSType`
`MATH_TYPE`
`protected int`
`NATIVE_PROPERTIES_COUNT`
`protected ObjectType`
`NO_OBJECT_TYPE`
`protected ObjectType`
`NO_RESOLVED_TYPE`
`protected ObjectType`
`NO_TYPE`
`protected JSType`
`NULL_TYPE`
`protected JSType`
`NULL_VOID`
`protected JSType`
`NUMBER_OBJECT_FUNCTION_TYPE`
`protected ObjectType`
`NUMBER_OBJECT_TYPE`
`protected JSType`
`NUMBER_STRING_BOOLEAN`
`protected JSType`
`NUMBER_TYPE`
`protected FunctionType`
`OBJECT_FUNCTION_TYPE`
`protected JSType`
`OBJECT_NUMBER_STRING`
`protected JSType`
`OBJECT_NUMBER_STRING_BOOLEAN`
`protected JSType`
`OBJECT_PROTOTYPE`
`protected ObjectType`
`OBJECT_TYPE`
`protected JSType`
`RANGE_ERROR_FUNCTION_TYPE`
`protected ObjectType`
`RANGE_ERROR_TYPE`
`protected JSType`
`REFERENCE_ERROR_FUNCTION_TYPE`
`protected ObjectType`
`REFERENCE_ERROR_TYPE`
`protected JSType`
`REGEXP_FUNCTION_TYPE`
`protected ObjectType`
`REGEXP_TYPE`
`protected JSTypeRegistry`
`registry`
`protected JSType`
`STRING_OBJECT_FUNCTION_TYPE`
`protected ObjectType`
`STRING_OBJECT_TYPE`
`protected JSType`
`STRING_TYPE`
`protected JSType`
`SYNTAX_ERROR_FUNCTION_TYPE`
`protected ObjectType`
`SYNTAX_ERROR_TYPE`
`protected JSType`
`TYPE_ERROR_FUNCTION_TYPE`
`protected ObjectType`
`TYPE_ERROR_TYPE`
`protected FunctionType`
`U2U_CONSTRUCTOR_TYPE`
`protected FunctionType`
`U2U_FUNCTION_TYPE`
`protected ObjectType`
`UNKNOWN_TYPE`
`protected JSType`
`URI_ERROR_FUNCTION_TYPE`
`protected ObjectType`
`URI_ERROR_TYPE`
`protected JSType`
`VOID_TYPE`

## Constructor Summary

Constructors
Constructor
Description
`BaseJSTypeTestCase()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`addNativeProperties(JSTypeRegistry registry)`
Adds a basic set of properties to the native types.
`protected final void`
`assertTypeEquals(JSType a, JSType b)`
`protected void`
`assertTypeEquals(JSType expected, JSTypeExpression actual)`
Asserts that a a type expression resolves to the correct `JSType`.
`protected void`
`assertTypeEquals(JSType expected, Node actual)`
Asserts that a Node representing a type expression resolves to the correct `JSType`.
`protected final void`
`assertTypeEquals(String msg, JSType a, JSType b)`
`protected final void`
`assertTypeNotEquals(JSType a, JSType b)`
`protected final void`
`assertTypeNotEquals(String msg, JSType a, JSType b)`
`protected JSType`
`createNullableType(JSType type)`
`protected JSType`
`createOptionalType(JSType type)`
`protected RecordTypeBuilder`
`createRecordTypeBuilder()`
`protected TemplatizedType`
`createTemplatizedType(ObjectType baseType, com.google.common.collect.ImmutableList<JSType> templatizedTypes)`
`protected TemplatizedType`
`createTemplatizedType(ObjectType baseType, JSType... templatizedType)`
`protected JSType`
`createUnionType(JSType... variants)`
`protected void`
`initTypes()`
`protected JSType`
`resolve(JSTypeExpression n, String... warnings)`
Resolves a type expression, expecting the given warnings.
`protected void`
`setUp()`

### Methods inherited from class junit.framework.TestCase

`assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, tearDown, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### registry

protected JSTypeRegistry registry

### errorReporter

protected TestErrorReporter errorReporter

### ALL_TYPE

protected JSType ALL_TYPE

### NO_OBJECT_TYPE

protected ObjectType NO_OBJECT_TYPE

### NO_TYPE

protected ObjectType NO_TYPE

### NO_RESOLVED_TYPE

protected ObjectType NO_RESOLVED_TYPE

### ARRAY_FUNCTION_TYPE

protected FunctionType ARRAY_FUNCTION_TYPE

### ARRAY_TYPE

protected ObjectType ARRAY_TYPE

### BOOLEAN_OBJECT_FUNCTION_TYPE

protected JSType BOOLEAN_OBJECT_FUNCTION_TYPE

### BOOLEAN_OBJECT_TYPE

protected ObjectType BOOLEAN_OBJECT_TYPE

### BOOLEAN_TYPE

protected JSType BOOLEAN_TYPE

### CHECKED_UNKNOWN_TYPE

protected ObjectType CHECKED_UNKNOWN_TYPE

### DATE_FUNCTION_TYPE

protected JSType DATE_FUNCTION_TYPE

### DATE_TYPE

protected ObjectType DATE_TYPE

### ERROR_FUNCTION_TYPE

protected JSType ERROR_FUNCTION_TYPE

### ERROR_TYPE

protected ObjectType ERROR_TYPE

### EVAL_ERROR_FUNCTION_TYPE

protected JSType EVAL_ERROR_FUNCTION_TYPE

### EVAL_ERROR_TYPE

protected ObjectType EVAL_ERROR_TYPE

### FUNCTION_FUNCTION_TYPE

protected FunctionType FUNCTION_FUNCTION_TYPE

### FUNCTION_INSTANCE_TYPE

protected FunctionType FUNCTION_INSTANCE_TYPE

### FUNCTION_PROTOTYPE

protected ObjectType FUNCTION_PROTOTYPE

### GREATEST_FUNCTION_TYPE

protected JSType GREATEST_FUNCTION_TYPE

### LEAST_FUNCTION_TYPE

protected JSType LEAST_FUNCTION_TYPE

### MATH_TYPE

protected JSType MATH_TYPE

### NULL_TYPE

protected JSType NULL_TYPE

### NUMBER_OBJECT_FUNCTION_TYPE

protected JSType NUMBER_OBJECT_FUNCTION_TYPE

### NUMBER_OBJECT_TYPE

protected ObjectType NUMBER_OBJECT_TYPE

### NUMBER_STRING_BOOLEAN

protected JSType NUMBER_STRING_BOOLEAN

### NUMBER_TYPE

protected JSType NUMBER_TYPE

### OBJECT_FUNCTION_TYPE

protected FunctionType OBJECT_FUNCTION_TYPE

### NULL_VOID

protected JSType NULL_VOID

### OBJECT_NUMBER_STRING

protected JSType OBJECT_NUMBER_STRING

### OBJECT_NUMBER_STRING_BOOLEAN

protected JSType OBJECT_NUMBER_STRING_BOOLEAN

### OBJECT_PROTOTYPE

protected JSType OBJECT_PROTOTYPE

### OBJECT_TYPE

protected ObjectType OBJECT_TYPE

### RANGE_ERROR_FUNCTION_TYPE

protected JSType RANGE_ERROR_FUNCTION_TYPE

### RANGE_ERROR_TYPE

protected ObjectType RANGE_ERROR_TYPE

### REFERENCE_ERROR_FUNCTION_TYPE

protected JSType REFERENCE_ERROR_FUNCTION_TYPE

### REFERENCE_ERROR_TYPE

protected ObjectType REFERENCE_ERROR_TYPE

### REGEXP_FUNCTION_TYPE

protected JSType REGEXP_FUNCTION_TYPE

### REGEXP_TYPE

protected ObjectType REGEXP_TYPE

### STRING_OBJECT_FUNCTION_TYPE

protected JSType STRING_OBJECT_FUNCTION_TYPE

### STRING_OBJECT_TYPE

protected ObjectType STRING_OBJECT_TYPE

### STRING_TYPE

protected JSType STRING_TYPE

### SYNTAX_ERROR_FUNCTION_TYPE

protected JSType SYNTAX_ERROR_FUNCTION_TYPE

### SYNTAX_ERROR_TYPE

protected ObjectType SYNTAX_ERROR_TYPE

### TYPE_ERROR_FUNCTION_TYPE

protected JSType TYPE_ERROR_FUNCTION_TYPE

### TYPE_ERROR_TYPE

protected ObjectType TYPE_ERROR_TYPE

### U2U_CONSTRUCTOR_TYPE

protected FunctionType U2U_CONSTRUCTOR_TYPE

### U2U_FUNCTION_TYPE

protected FunctionType U2U_FUNCTION_TYPE

### UNKNOWN_TYPE

protected ObjectType UNKNOWN_TYPE

### URI_ERROR_FUNCTION_TYPE

protected JSType URI_ERROR_FUNCTION_TYPE

### URI_ERROR_TYPE

protected ObjectType URI_ERROR_TYPE

### VOID_TYPE

protected JSType VOID_TYPE

### NATIVE_PROPERTIES_COUNT

protected int NATIVE_PROPERTIES_COUNT

### ALL_NATIVE_EXTERN_TYPES

public static final String ALL_NATIVE_EXTERN_TYPES
A definition of all extern types. This should be kept in sync with javascript/externs/es3.js. This is used to check that the built-in types declared in `JSTypeRegistry` have the same type as that in the externs. It can also be used for any tests that want to use built-in types in their externs.

See Also:
  - Constant Field Values

## Constructor Details

### BaseJSTypeTestCase

public BaseJSTypeTestCase()

## Method Details

### setUp

protected void setUp() throws Exception

Overrides:
  `setUp` in class `junit.framework.TestCase`
Throws:
  `Exception`

### initTypes

protected void initTypes()

### addNativeProperties

public static void addNativeProperties(JSTypeRegistry registry)
Adds a basic set of properties to the native types.

### createUnionType

protected JSType createUnionType(JSType... variants)

### createRecordTypeBuilder

protected RecordTypeBuilder createRecordTypeBuilder()

### createNullableType

protected JSType createNullableType(JSType type)

### createOptionalType

protected JSType createOptionalType(JSType type)

### createTemplatizedType

protected TemplatizedType createTemplatizedType(ObjectType baseType, com.google.common.collect.ImmutableList<JSType> templatizedTypes)

### createTemplatizedType

protected TemplatizedType createTemplatizedType(ObjectType baseType, JSType... templatizedType)

### assertTypeEquals

protected void assertTypeEquals(JSType expected, Node actual)
Asserts that a Node representing a type expression resolves to the correct `JSType`.

### assertTypeEquals

protected void assertTypeEquals(JSType expected, JSTypeExpression actual)
Asserts that a a type expression resolves to the correct `JSType`.

### resolve

protected JSType resolve(JSTypeExpression n, String... warnings)
Resolves a type expression, expecting the given warnings.

### assertTypeEquals

protected final void assertTypeEquals(JSType a, JSType b)

### assertTypeEquals

protected final void assertTypeEquals(String msg, JSType a, JSType b)

### assertTypeNotEquals

protected final void assertTypeNotEquals(JSType a, JSType b)

### assertTypeNotEquals

protected final void assertTypeNotEquals(String msg, JSType a, JSType b)