类 TestClass
- java.lang.Object
- org.junit.runners.model.TestClass
- 所有已实现的接口:
Annotatable
public class TestClass extends Object implements Annotatable
Wraps a class to be run, providing method validation and annotation searching- 从以下版本开始:
- 4.5
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 protected static <T extends FrameworkMember<T>>
voidaddToAnnotationLists(T member, Map<Class<? extends Annotation>,List<T>> map)
boolean
equals(Object obj)
List<FrameworkField>
getAnnotatedFields()
Returns, efficiently, all the non-overridden fields in this class and its superclasses that are annotated.List<FrameworkField>
getAnnotatedFields(Class<? extends Annotation> annotationClass)
Returns, efficiently, all the non-overridden fields in this class and its superclasses that are annotated withannotationClass
.<T> List<T>
getAnnotatedFieldValues(Object test, Class<? extends Annotation> annotationClass, Class<T> valueClass)
List<FrameworkMethod>
getAnnotatedMethods()
Returns, efficiently, all the non-overridden methods in this class and its superclasses that are annotated}.List<FrameworkMethod>
getAnnotatedMethods(Class<? extends Annotation> annotationClass)
Returns, efficiently, all the non-overridden methods in this class and its superclasses that are annotated withannotationClass
.<T> List<T>
getAnnotatedMethodValues(Object test, Class<? extends Annotation> annotationClass, Class<T> valueClass)
<T extends Annotation>
TgetAnnotation(Class<T> annotationType)
Returns the annotation on the model element of the given type, or @code{null}Annotation[]
getAnnotations()
Returns the annotations on this classClass<?>
getJavaClass()
Returns the underlying Java class.String
getName()
Returns the class's name.Constructor<?>
getOnlyConstructor()
Returns the only public constructor in the class, or throws anAssertionError
if there are more or less than one.int
hashCode()
boolean
isANonStaticInnerClass()
boolean
isPublic()
protected void
scanAnnotatedMembers(Map<Class<? extends Annotation>,List<FrameworkMethod>> methodsForAnnotations, Map<Class<? extends Annotation>,List<FrameworkField>> fieldsForAnnotations)
方法详细资料
scanAnnotatedMembers
protected void scanAnnotatedMembers(Map<Class<? extends Annotation>,List<FrameworkMethod>> methodsForAnnotations, Map<Class<? extends Annotation>,List<FrameworkField>> fieldsForAnnotations)
addToAnnotationLists
protected static <T extends FrameworkMember<T>> void addToAnnotationLists(T member, Map<Class<? extends Annotation>,List<T>> map)
getAnnotatedMethods
public List<FrameworkMethod> getAnnotatedMethods()
Returns, efficiently, all the non-overridden methods in this class and its superclasses that are annotated}.- 从以下版本开始:
- 4.12
getAnnotatedMethods
public List<FrameworkMethod> getAnnotatedMethods(Class<? extends Annotation> annotationClass)
Returns, efficiently, all the non-overridden methods in this class and its superclasses that are annotated withannotationClass
.
getAnnotatedFields
public List<FrameworkField> getAnnotatedFields()
Returns, efficiently, all the non-overridden fields in this class and its superclasses that are annotated.- 从以下版本开始:
- 4.12
getAnnotatedFields
public List<FrameworkField> getAnnotatedFields(Class<? extends Annotation> annotationClass)
Returns, efficiently, all the non-overridden fields in this class and its superclasses that are annotated withannotationClass
.
getJavaClass
public Class<?> getJavaClass()
Returns the underlying Java class.
getOnlyConstructor
public Constructor<?> getOnlyConstructor()
Returns the only public constructor in the class, or throws anAssertionError
if there are more or less than one.
getAnnotations
public Annotation[] getAnnotations()
Returns the annotations on this class- 指定者:
getAnnotations
在接口中Annotatable
getAnnotation
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
从接口复制的说明:Annotatable
Returns the annotation on the model element of the given type, or @code{null}- 指定者:
getAnnotation
在接口中Annotatable
getAnnotatedFieldValues
public <T> List<T> getAnnotatedFieldValues(Object test, Class<? extends Annotation> annotationClass, Class<T> valueClass)
getAnnotatedMethodValues
public <T> List<T> getAnnotatedMethodValues(Object test, Class<? extends Annotation> annotationClass, Class<T> valueClass)
isPublic
public boolean isPublic()
isANonStaticInnerClass
public boolean isANonStaticInnerClass()