Package org.hibernate.testing.junit4
Class Helper
java.lang.Object
org.hibernate.testing.junit4.Helper
Centralized utility functionality
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends Annotation,
P extends Annotation>
Collection<S> collectAnnotations
(Class<S> singularAnnotationClass, Class<P> pluralAnnotationClass, Helper.TestAnnotationCollector<S> collector, org.junit.runners.model.FrameworkMethod frameworkMethod, org.junit.runners.model.TestClass testClass) static <S extends Annotation,
P extends Annotation>
Collection<S> collectAnnotations
(Class<S> singularAnnotationClass, Class<P> pluralAnnotationClass, org.junit.runners.model.FrameworkMethod frameworkMethod, org.junit.runners.model.TestClass testClass) static void
createH2Schema
(String schemaName, Map settings) Create additional H2 schema.static void
createH2Schema
(String schemaName, org.hibernate.cfg.Configuration cfg) static String
extractIgnoreMessage
(FailureExpected failureExpected, org.junit.runners.model.FrameworkMethod frameworkMethod) static String
extractMessage
(FailureExpected failureExpected) static String
extractMethodName
(Method method) Extract a nice method name representation for displaystatic String
extractTestName
(org.junit.runners.model.FrameworkMethod frameworkMethod) Extract a nice test name representation for displaystatic boolean
isNotEmpty
(String string) Standard string content checking.static <T extends Annotation>
List<T> locateAllAnnotations
(Class<T> annotationClass, org.junit.runners.model.FrameworkMethod frameworkMethod, org.junit.runners.model.TestClass testClass) Locates the specified annotation both at the method site and class site.static <T extends Annotation>
TlocateAnnotation
(Class<T> annotationClass, org.junit.runners.model.FrameworkMethod frameworkMethod, org.junit.runners.model.TestClass testClass)
-
Field Details
-
VALIDATE_FAILURE_EXPECTED
- See Also:
-
-
Method Details
-
isNotEmpty
Standard string content checking.- Parameters:
string
- The string to check- Returns:
- Are its content empty or the reference null?
-
extractTestName
Extract a nice test name representation for display- Parameters:
frameworkMethod
- The test method.- Returns:
- The display representation
-
extractMethodName
Extract a nice method name representation for display- Parameters:
method
- The method.- Returns:
- The display representation
-
locateAnnotation
public static <T extends Annotation> T locateAnnotation(Class<T> annotationClass, org.junit.runners.model.FrameworkMethod frameworkMethod, org.junit.runners.model.TestClass testClass) -
locateAllAnnotations
public static <T extends Annotation> List<T> locateAllAnnotations(Class<T> annotationClass, org.junit.runners.model.FrameworkMethod frameworkMethod, org.junit.runners.model.TestClass testClass) Locates the specified annotation both at the method site and class site. This is useful for situations where you may apply the same annotation at both the method and class level and rather than both sites being mutually exclusive, this permits both to be returned instead.- Type Parameters:
T
- Annotation type.- Parameters:
annotationClass
- Annotation classframeworkMethod
- Test method.testClass
- Test class.- Returns:
- Collection of all annotations detected at both method or class level.
-
collectAnnotations
public static <S extends Annotation,P extends Annotation> Collection<S> collectAnnotations(Class<S> singularAnnotationClass, Class<P> pluralAnnotationClass, org.junit.runners.model.FrameworkMethod frameworkMethod, org.junit.runners.model.TestClass testClass) - Type Parameters:
S
- Singular annotation type.P
- Plural annotation type.- Parameters:
singularAnnotationClass
- Singular annotation class (e.g.SkipForDialect
).pluralAnnotationClass
- Plural annotation class (e.g.SkipForDialects
), assuming that the only declared method is an array of singular annotations.frameworkMethod
- Test method.testClass
- Test class.- Returns:
- Collection of all singular annotations or an empty list.
-
collectAnnotations
public static <S extends Annotation,P extends Annotation> Collection<S> collectAnnotations(Class<S> singularAnnotationClass, Class<P> pluralAnnotationClass, Helper.TestAnnotationCollector<S> collector, org.junit.runners.model.FrameworkMethod frameworkMethod, org.junit.runners.model.TestClass testClass) -
extractMessage
-
extractIgnoreMessage
public static String extractIgnoreMessage(FailureExpected failureExpected, org.junit.runners.model.FrameworkMethod frameworkMethod) -
createH2Schema
- See Also:
-
createH2Schema
Create additional H2 schema.- Parameters:
schemaName
- New schema name.settings
- Current settings.
-