signature:
public class ListUtilities { /** * Check if the passed instance is a { @ link java . util . List } and contains only elements of the passed element types .
 * In that case it casts the passed instance to a List of the passed element type .
 * @ param instance
 * @ return The instance cast to a List of the passed element type if the passed instance is a list and only contains
 * element of the passed element type , otherwise it return null . */
public static < T > List < T > getListOfType ( Object instance , Class < T > elementType ) { } }

implementation: if ( instance == null || elementType == null || ! isListOfType ( instance , elementType ) ) { return null ; } try { return ( List < T > ) instance ; } catch ( ClassCastException e ) { return null ; }


signature:
public class TraceeContextLoggerAbstractProcessor { /** * Central method to get cached FileObjectWrapper . Creates new FileObjectWrapper if it can ' t be found */
protected static synchronized FileObjectWrapper getOrCreateProfileProperties ( final Filer filer , String fileName ) throws IOException { } }

implementation: FileObjectWrapper fileObject = traceeProfileProperties . get ( fileName ) ; if ( fileObject == null ) { fileObject = new FileObjectWrapper ( filer . createResource ( StandardLocation . SOURCE_OUTPUT , "" , fileName , null ) ) ; traceeProfileProperties . put ( fileName , fileObject ) ; } return fileObject ;


signature:
public class TraceeContextLoggerAbstractMethodAnnotationProcessor { /** * Checks if passed element is a method declared as public , not abstract and not static
 * @ param element the element to check
 * @ return true if passed element is public , not abstract and not static method */
protected boolean isValidMethod ( Element element ) { } }

implementation:
// must be of type class
if ( element . getKind ( ) != ElementKind . METHOD ) { error ( element , "Element %s annotated with annotation %s must be a method" , element . getSimpleName ( ) , TraceeContextProviderMethod . class . getSimpleName ( ) ) ; return false ; } // must be public
if ( ! element . getModifiers ( ) . contains ( Modifier . PUBLIC ) ) { error ( element , "Method %s annotated with annotation %s must be public" , element . getSimpleName ( ) , TraceeContextProviderMethod . class . getSimpleName ( ) ) ; return false ; } // must not abstract
if ( element . getModifiers ( ) . contains ( Modifier . ABSTRACT ) ) { error ( element , "Method %s annotated with annotation %s must not be abstract" , element . getSimpleName ( ) , TraceeContextProviderMethod . class . getSimpleName ( ) ) ; return false ; } // must not be static
if ( element . getModifiers ( ) . contains ( Modifier . STATIC ) ) { error ( element , "Method %s annotated with annotation %s must not be static" , element . getSimpleName ( ) , TraceeContextProviderMethod . class . getSimpleName ( ) ) ; return false ; } return true ;


signature:
public class TraceeContextLoggerAbstractMethodAnnotationProcessor { /** * Checks if passed element has a non void return type and takes no parameters
 * @ param executableElement
 * @ return true if passed element has a non void return type and takes no parameters */
protected boolean isGetterMethod ( ExecutableElement executableElement ) { } }

implementation:
// must have a return value
TypeMirror returnTypeMirror = executableElement . getReturnType ( ) ; if ( returnTypeMirror . getKind ( ) . equals ( TypeKind . VOID ) ) { error ( executableElement , "method %s must have a non void return type" , executableElement . getSimpleName ( ) . toString ( ) ) ; return false ; } // check if method takes no parameters
List parameters = executableElement . getParameters ( ) ; if ( parameters != null && parameters . size ( ) > 0 ) { error ( executableElement , "method %s must have no parameters " , executableElement . getSimpleName ( ) . toString ( ) ) ; return false ; } return true ;


signature:
public class TraceeContextLoggerAbstractMethodAnnotationProcessor { /** * Checks if passed elements parent is type element and annotated with { @ link TraceeContextProvider } .
 * @ param element
 * @ return */
protected boolean isParentAnnotatedWithTraceeContextProvider ( final Element element ) { } }

implementation: Element parentElement = element . getEnclosingElement ( ) ; if ( parentElement == null || parentElement . getKind ( ) != ElementKind . CLASS || ! isTypeAnnotatedWithTraceeContextProvider ( ( TypeElement ) parentElement ) ) { error ( element , "Enclosing type of method %s annotated with annotation %s is not annotated with annotation %s." , element . getSimpleName ( ) , Flatten . class . getSimpleName ( ) , TraceeContextProvider . class . getSimpleName ( ) ) ; return false ; } return true ;


signature:
public class ProfileSettings { /** * Checks whether the property for the passed key is enabled or not .
 * @ param propertyKey the property key to check
 * @ return true , if the property is enabled in profile or manual overrides and not disabled in manual overrides , otherwise false */
public Boolean getPropertyValue ( final String propertyKey ) { } }

implementation:
if ( propertyKey == null ) { return null ; } // check system property override
if ( toTraceeContextStringRepresentationBuilder != null && toTraceeContextStringRepresentationBuilder . getManualContextOverrides ( ) != null ) { Boolean manualOverrideCheck = toTraceeContextStringRepresentationBuilder . getManualContextOverrides ( ) . get ( propertyKey ) ; if ( manualOverrideCheck != null ) { return manualOverrideCheck ; } } // check profile properties
if ( profileProperties != null ) { String value = profileProperties . getProperty ( propertyKey ) ; if ( value != null ) { return Boolean . valueOf ( value ) ; } } return null ;


signature:
public class TraceeContextLoggerAbstractTypeAnnotationProcessor { /** * Checks if class has noargs constructor or default noargs constructor .
 * @ param typeElement the type element to check .
 * @ return true if element has noarg constructor or no constructor at all */
protected boolean checkIfClassHasNoargsConstructor ( TypeElement typeElement ) { } }

implementation:
// check if annotated class has noargs constructor
boolean foundConstructor = false ; boolean foundNoargsConstructor = false ; for ( Element child : typeElement . getEnclosedElements ( ) ) { if ( ElementKind . CONSTRUCTOR . equals ( child . getKind ( ) ) ) { foundConstructor = true ; ExecutableElement constructor = ( ExecutableElement ) child ; if ( constructor . getParameters ( ) . size ( ) == 0 ) { foundNoargsConstructor = true ; break ; } } } return ! ( foundConstructor && ! foundNoargsConstructor ) ;


signature:
public class TraceeContextLogAnnotationUtilities { /** * Gets an annotation of passed instance .
 * @ param instance he instance to get the annotation from
 * @ param < T > the annotations class to get
 * @ return the annotation if present , otherwise null */
public static < T extends Annotation > T getAnnotationFromType ( final Object instance , Class < T > annotation ) { } }

implementation: if ( instance == null || annotation == null ) { return null ; } return instance . getClass ( ) . getAnnotation ( annotation ) ;


signature:
public class TraceeContextLogAnnotationUtilities { /** * Extracts all { @ link io . tracee . contextlogger . contextprovider . api . TraceeContextProviderMethod } annotated methods of the passed instance .
 * @ param instance the instance to check for
 * @ return a list containing all annotated methods of an instance */
public static List < MethodAnnotationPair > getAnnotatedMethodsOfInstance ( final Object instance ) { } }

implementation:
List < MethodAnnotationPair > result = new ArrayList < MethodAnnotationPair > ( ) ; for ( Method method : instance . getClass ( ) . getDeclaredMethods ( ) ) { if ( checkIsPublic ( method ) && checkMethodHasNoParameters ( method ) && checkMethodHasNonVoidReturnType ( method ) ) { TraceeContextProviderMethod annotation = method . getAnnotation ( TraceeContextProviderMethod . class ) ; // check if method has no parameters and is annotated
if ( annotation != null ) { result . add ( new MethodAnnotationPair ( instance . getClass ( ) , method , annotation ) ) ; } } } return result ;


signature:
public class TraceeContextLogAnnotationUtilities { /** * Checks whether the passsed method has a non void return value .
 * @ param method the method to check
 * @ return true if the method has a non void return type , otherwise false */
public static boolean checkMethodHasNonVoidReturnType ( final Method method ) { } }

implementation: if ( method == null ) { return false ; } try { return ! ( Void . TYPE == method . getReturnType ( ) ) ; } catch ( Exception e ) { return false ; }


signature:
public class BeanUtility { /** * Gets all getter methods recursively ( for all superclasses ) .
 * @ param type the type to get the methods for
 * @ return the available getter methods */
public static Set < Method > getGetterMethodsRecursively ( final Class type ) { } }

implementation:
Set < Method > getterMethods = new HashSet < Method > ( ) ; if ( type != null ) { Method [ ] methods = null ; try { methods = type . getDeclaredMethods ( ) ; } catch ( SecurityException e ) { // use fallback - checks against fields might not work
methods = type . getMethods ( ) ; } for ( Method method : methods ) { if ( IsGetterMethodPredicate . check ( type , method ) ) { getterMethods . add ( method ) ; } } // process supertype
getterMethods . addAll ( getGetterMethodsRecursively ( type . getSuperclass ( ) ) ) ; } return getterMethods ;


signature:
public class TypeProviderFunction { /** * Write the type string to the Stringbuilder
 * @ param stringBuilder the stringbuilder to write to
 * @ param outputStyle the output style to use
 * @ param outputElement the output element to write the type string for .
 * @ return true , if any output was written to the stringbuilder , otherwise false . */
public boolean apply ( final StringBuilder stringBuilder , final OutputStyle outputStyle , final OutputElement outputElement ) { } }

implementation: boolean result = false ; if ( outputElement != null ) { if ( OutputElementType . COLLECTION . equals ( outputElement . getOutputElementType ( ) ) ) { result = handleCollectionType ( stringBuilder , outputStyle , outputElement ) ; } else if ( OutputElementType . COMPLEX . equals ( outputElement . getOutputElementType ( ) ) ) { if ( TraceeContextLogAnnotationUtilities . getAnnotationFromType ( outputElement . getEncapsulatedInstance ( ) ) != null ) { result = handleTraceeContextprovider ( stringBuilder , outputStyle , outputElement ) ; } else { result = handleComplexType ( stringBuilder , outputStyle , outputElement ) ; } } } return result ;


signature:
public class TypeToWrapper { /** * Gets a list with all wrapper classes .
 * @ return a list with all wrapper classes */
public static Set < Class > findWrapperClasses ( ) { } }

implementation: final List < TypeToWrapper > localTypeToWrapperList = getTypeToWrapper ( ) ; Set < Class > resultList = new HashSet < Class > ( ) ; if ( localTypeToWrapperList != null ) { for ( TypeToWrapper typeToWrapper : localTypeToWrapperList ) { resultList . add ( typeToWrapper . getWrapperType ( ) ) ; } } return resultList ;


signature:
public class TypeToWrapper { /** * Generic function to get a implicit data provider classes from resource files .
 * @ return a set that contains all context provider type the were found */
public static Set < ImplicitContextData > getImplicitContextDataProviders ( ) { } }

implementation:
final Set < ImplicitContextData > result = new HashSet < ImplicitContextData > ( ) ; for ( Class clazz : ContextProviderServiceLoader . getServiceLocator ( ) . getImplicitContextProvider ( ) ) { try { if ( ImplicitContextData . class . isAssignableFrom ( clazz ) ) { ImplicitContextData instance = ( ImplicitContextData ) ( clazz . newInstance ( ) ) ; result . add ( instance ) ; } } catch ( Throwable e ) { // to be ignored
} } return result ;


signature:
public class TypeToWrapper { /** * Method to get all available wrappers .
 * @ return all wrapping between wrapper classes and their wrapped types . */
public static List < TypeToWrapper > getAvailableWrappers ( ) { } }

implementation:
final List < TypeToWrapper > result = new ArrayList < TypeToWrapper > ( ) ; for ( Class clazz : ContextProviderServiceLoader . getServiceLocator ( ) . getContextProvider ( ) ) { try { if ( WrappedContextData . class . isAssignableFrom ( clazz ) ) { // try to create instance to get the wrapped type
final WrappedContextData instance = ( WrappedContextData ) clazz . newInstance ( ) ; result . add ( new TypeToWrapper ( instance . getWrappedType ( ) , clazz ) ) ; } } catch ( Throwable e ) { // to be ignored
} } return result ;


signature:
public class ConnectorFactory { /** * Initializes all available connectors . */
private void initConnectors ( ) { } }

implementation:
// first get all connector configuration Names
Set < String > connectorConfigurationNames = this . getConnectorConfigurationNames ( ) ; for ( String connectorConfigurationName : connectorConfigurationNames ) { Connector connector = this . createConnector ( connectorConfigurationName ) ; if ( connector != null ) { this . connectorMap . put ( connectorConfigurationName , connector ) ; } } // Add mandatory logger
if ( ! isConnectorConfigured ( LogConnector . class ) ) { Connector logConnector = new LogConnector ( ) ; this . connectorMap . put ( "LOGGER" , logConnector ) ; }


signature:
public class ConnectorFactory { /** * Send error report to all initialized connector instances .
 * @ param connectorOutputProvider the context data provider used for output */
final void sendErrorReportToConnectors ( ConnectorOutputProvider connectorOutputProvider ) { } }

implementation: for ( Connector connector : this . connectorMap . values ( ) ) { connector . sendErrorReport ( connectorOutputProvider ) ; }


signature:
public class ConnectorFactory { /** * Extracts all names for connector configurations from System properties .
 * @ return a Set containing all connector configuration names */
final Set < String > getConnectorConfigurationNames ( ) { } }

implementation:
Set < String > connectorNames = new HashSet < String > ( ) ; Enumeration < Object > keyEnumeration = getSystemProperties ( ) . keys ( ) ; while ( keyEnumeration . hasMoreElements ( ) ) { String key = keyEnumeration . nextElement ( ) . toString ( ) ; // check if property key has tracee connector format
Matcher matcher = KEY_MATCHER_PATTERN . matcher ( key ) ; if ( matcher . matches ( ) && matcher . groupCount ( ) > 0 ) { connectorNames . add ( matcher . group ( 1 ) ) ; } } return connectorNames ;


signature:
public class ConnectorFactory { /** * Collects all properties for a given connector configuration name and writes them to a Map .
 * @ param connectorName the name of the connector configuration
 * @ return a Map containing all properties for a connector configuration name */
final Map < String , String > getPropertiesForConnectorConfigurationName ( final String connectorName ) { } }

implementation:
final Map < String , String > propertyMap = new HashMap < String , String > ( ) ; final String patternString = String . format ( CONNECTOR_PROPERTY_GRABBER_PATTERN , connectorName ) ; final Pattern propertyGrabPattern = Pattern . compile ( patternString ) ; final Set < Map . Entry < Object , Object > > entries = getSystemProperties ( ) . entrySet ( ) ; for ( Map . Entry < Object , Object > entry : entries ) { final String key = entry . getKey ( ) . toString ( ) ; final Object value = entry . getValue ( ) ; // check if property key has tracee connector format
final Matcher matcher = propertyGrabPattern . matcher ( key ) ; if ( value != null && matcher . matches ( ) && matcher . groupCount ( ) > 0 ) { final String propertyName = matcher . group ( 1 ) ; propertyMap . put ( propertyName , value . toString ( ) ) ; } } return propertyMap ;


signature:
public class ConnectorFactory { /** * Tries to create a Connector for a given connector configuration name .
 * @ param connectorConfigurationName the name of the connector configuration
 * @ return the connector if it could be created and initialized without error , otherwise null */
final Connector createConnector ( final String connectorConfigurationName ) { } }

implementation:
Map < String , String > propertyMap = this . getPropertiesForConnectorConfigurationName ( connectorConfigurationName ) ; String type = propertyMap . get ( TraceeContextLoggerConstants . SYSTEM_PROPERTY_CONTEXT_LOGGER_CONNECTOR_TYPE ) ; // get canonical class name for well known connectors
if ( WELL_KNOW_CONNECTOR_MAPPINGS . containsKey ( type ) ) { type = WELL_KNOW_CONNECTOR_MAPPINGS . get ( type ) ; } try { // try to create connector instance
Connector connector = ( Connector ) Class . forName ( type ) . newInstance ( ) ; // now try to call init method
connector . init ( propertyMap ) ; return connector ; } catch ( Exception e ) { LOGGER . error ( "An error occurred while creating connector with name '" + connectorConfigurationName + "' of type '" + type + "'" , e ) ; } return null ;


signature:
public class ConnectorFactory { /** * Checks whether the LogConnector is defined or not .
 * @ param connectorClass the connector to check for
 * @ return true , if LogConnector is already defined , otherwise false . */
private boolean isConnectorConfigured ( Class connectorClass ) { } }

implementation: for ( Connector connector : this . connectorMap . values ( ) ) { if ( connectorClass . isInstance ( connector ) ) { return true ; } } return false ;


signature:
public class IsGetterMethodPredicate { /** * Getter method names must have a specific prefix .
 * @ param method the method to check
 * @ return true , if the method name prefix is a getter Prefix , otherwise false */
boolean hasGetterPrefixInMethodName ( Method method ) { } }

implementation: String methodName = method . getName ( ) ; if ( methodName != null ) { for ( String prefix : GETTER_PREFIXES ) { if ( methodName . startsWith ( prefix ) ) { return true ; } } } return false ;


signature:
public class IsGetterMethodPredicate { /** * Getter methods must be public and not be static .
 * @ param method the method to check
 * @ return true if the method is not static and public , otherwise false */
boolean isPublicNonStaticMethod ( final Method method ) { } }

implementation: int modifiers = method . getModifiers ( ) ; return ! Modifier . isStatic ( modifiers ) && Modifier . isPublic ( modifiers ) ;


signature:
public class IsGetterMethodPredicate { /** * Getter methods must have return type ( must not be of type Void )
 * @ param method the method to check
 * @ return true if the method has a return type , otherwise false */
boolean hasReturnValue ( final Method method ) { } }

implementation: Class returnType = method . getReturnType ( ) ; return ! Void . TYPE . equals ( returnType ) ;


signature:
public class IsGetterMethodPredicate { /** * Getter method and field must have compatible fields .
 * @ param type the type to search the field in
 * @ param method the method to check
 * @ return true , if field type is assignable to methods return type */
boolean hasCompatibleReturnTypes ( Class type , Method method ) { } }

implementation: Field correspondingField = getCorrespondingField ( type , method ) ; return correspondingField != null && method . getReturnType ( ) . isAssignableFrom ( correspondingField . getType ( ) ) ;


signature:
public class IsGetterMethodPredicate { /** * Helper method for getting a corresponsing field for a method
 * @ param type the type to search the field in
 * @ param method the getter method to search the field for
 * @ return the Field or null if the field for the passed method doesn ' t exists */
Field getCorrespondingField ( Class type , Method method ) { } }

implementation: try { return type . getDeclaredField ( GetterUtilities . getFieldName ( method ) ) ; } catch ( NoSuchFieldException e ) { return null ; }


signature:
public class GetterUtilities { /** * Checks whether the method name starts with a getter prefix .
 * @ param methodName the method name to check for
 * @ return true if the method name starts with eiher one of values stored in GETTER _ PREFIXES */
public static boolean isGetterMethod ( final String methodName ) { } }

implementation: if ( methodName != null ) { for ( String prefix : GETTER_PREFIXES ) { if ( methodName . startsWith ( prefix ) ) { return true ; } } } return false ;


signature:
public class GetterUtilities { /** * Strips getter prefix from method name .
 * @ param methodName the name of the method to be processed
 * @ return the stripped method name with Decapitalized first letter or null if passed method name has no getter prefix . */
public static String getFieldName ( final String methodName ) { } }

implementation: if ( isGetterMethod ( methodName ) ) { return decapitalizeFirstCharOfString ( stripGetterPrefix ( methodName ) ) ; } return null ;


signature:
public class GetterUtilities { /** * Strips getter prefix from method name .
 * @ param method the method to be processed
 * @ return the stripped method name with Decapitalized first letter or null if passed method is null or if the method name has no getter prefix . */
public static String getFieldName ( final Method method ) { } }

implementation: if ( method != null ) { return getFieldName ( method . getName ( ) ) ; } else { return null ; }


signature:
public class GetterUtilities { /** * Gets the full qualified name of a field or non getter method .
 * Result has following format : " Full Qualified Classname " . " field name for getter methods or method name for non getter methods " .
 * @ param method The method to be processed
 * @ return */
public static String getFullQualifiedFieldName ( final Class type , final Method method ) { } }

implementation:
if ( method != null ) { // get the name of the type from passed type or method
final String typeName ; if ( type != null ) { typeName = type . getCanonicalName ( ) ; } else { typeName = method . getDeclaringClass ( ) . getCanonicalName ( ) ; } // get field name from getter method or method name for non getter methods
final String fieldName ; if ( isGetterMethod ( method . getName ( ) ) ) { fieldName = getFieldName ( method . getName ( ) ) ; } else { fieldName = method . getName ( ) ; } return typeName + "." + fieldName ; } else { return null ; }


signature:
public class GetterUtilities { /** * Capitalizes first char of an input string .
 * @ param input the string to be processed ;
 * @ return The input string with the first capitalized char . Returns empty string , if passed input String is null or empty . */
static String capitalizeFirstCharOfString ( final String input ) { } }

implementation: if ( input == null || input . length ( ) == 0 ) { return "" ; } else if ( input . length ( ) == 1 ) { return input . toUpperCase ( ) ; } else { return input . substring ( 0 , 1 ) . toUpperCase ( ) + input . substring ( 1 ) ; }


signature:
public class GetterUtilities { /** * Decapitalizes first char of an input string .
 * @ param input the string to be processed ;
 * @ return The input string with the first capitalized char . Returns empty string , if passed input String is null or empty . */
static String decapitalizeFirstCharOfString ( final String input ) { } }

implementation: if ( input == null || input . length ( ) == 0 ) { return "" ; } else if ( input . length ( ) == 1 ) { return input . toLowerCase ( ) ; } else { return input . substring ( 0 , 1 ) . toLowerCase ( ) + input . substring ( 1 ) ; }


signature:
public class GetterUtilities { /** * Strips getter prefix from input string
 * @ param input the input string to be processed
 * @ return the string stripped by getter prefix */
static String stripGetterPrefix ( final String input ) { } }

implementation: if ( input != null ) { for ( String prefix : GETTER_PREFIXES ) { if ( input . startsWith ( prefix ) ) { return input . substring ( prefix . length ( ) ) ; } } } return input ;


signature:
public class BeanToOutputElementTransformerFunction { /** * Invokes the getter and return the return values
 * @ param instance the instance to invoke the getter method on .
 * @ param method the method to invoke
 * @ return the return value of the getter invocation */
protected Object invokeGetter ( final Object instance , final Method method ) { } }

implementation:
try { return method . invoke ( instance ) ; } catch ( IllegalAccessException e ) { // shouldn ' t occur
} catch ( InvocationTargetException e ) { // shouldn ' t occur
} return null ;


signature:
public class BeanToOutputElementTransformerFunction { /** * Invokes the getter and return the return values
 * @ param instance the instance to invoke the getter method on .
 * @ param method the method to invoke
 * @ return the return value of the getter invocation */
protected Object invokeField ( final Object instance , final Method method ) { } }

implementation:
if ( instance == null || method == null ) { return null ; } try { Field field = FieldUtilities . getField ( instance . getClass ( ) , GetterUtilities . getFieldName ( method ) ) ; field . setAccessible ( true ) ; return field . get ( instance ) ; } catch ( IllegalAccessException e ) { // shouldn ' t occur
} catch ( IllegalArgumentException e ) { // ignore
} return null ;


signature:
public class WatchdogAspect { /** * Sends the error reports to all connectors .
 * @ param proceedingJoinPoint the aspectj calling context
 * @ param annotatedId the id defined in the watchdog annotation */
void sendErrorReportToConnectors ( ProceedingJoinPoint proceedingJoinPoint , String annotatedId , Throwable e ) { } }

implementation:
// try to get error message annotation
ErrorMessage errorMessage = WatchdogUtils . getErrorMessageAnnotation ( proceedingJoinPoint ) ; if ( errorMessage == null ) { TraceeContextLogger . create ( ) . enforceOrder ( ) . apply ( ) . logWithPrefixedMessage ( MessagePrefixProvider . provideLogMessagePrefix ( MessageLogLevel . ERROR , Watchdog . class ) , CoreImplicitContextProviders . COMMON , CoreImplicitContextProviders . TRACEE , WatchdogDataWrapper . wrap ( annotatedId , proceedingJoinPoint ) , e ) ; } else { TraceeContextLogger . create ( ) . enforceOrder ( ) . apply ( ) . logWithPrefixedMessage ( MessagePrefixProvider . provideLogMessagePrefix ( MessageLogLevel . ERROR , Watchdog . class ) , TraceeMessage . wrap ( errorMessage . value ( ) ) , CoreImplicitContextProviders . COMMON , CoreImplicitContextProviders . TRACEE , WatchdogDataWrapper . wrap ( annotatedId , proceedingJoinPoint ) , e ) ; }


signature:
public class TraceeContextProviderWrapperFunction { /** * Wraps the passed instance inside a matching tracee context logging provider instance .
 * Will return the passed instance , if no matching tracee context logging provider exists .
 * @ param contextLoggerConfiguration the configuration to use
 * @ param instanceToWrap the instance to wrap
 * @ return either a tracee context provider that encapsulates the passed instance or the instance itself if no matching context provider exists */
public Object apply ( ContextLoggerConfiguration contextLoggerConfiguration , Object instanceToWrap ) { } }

implementation:
// check for implicit context
if ( IsImplicitContextEnumValuePredicate . getInstance ( ) . apply ( instanceToWrap ) ) { return createInstance ( ( Class ) contextLoggerConfiguration . getImplicitContextProviderClass ( ( ImplicitContext ) instanceToWrap ) ) ; } // now try to find instance type in known wrapper types map
Class matchingWrapperType = contextLoggerConfiguration . getContextProviderClass ( instanceToWrap . getClass ( ) ) ; if ( matchingWrapperType == null ) { // now try to find instance type in TypeToWrapper List
for ( TypeToWrapper wrapper : contextLoggerConfiguration . getWrapperList ( ) ) { if ( wrapper . getWrappedInstanceType ( ) . isAssignableFrom ( instanceToWrap . getClass ( ) ) ) { matchingWrapperType = wrapper . getWrapperType ( ) ; break ; } } } if ( matchingWrapperType != null ) { // now create wrapper instance
try { WrappedContextData wrapperInstance = ( WrappedContextData ) createInstance ( matchingWrapperType ) ; wrapperInstance . setContextData ( instanceToWrap ) ; return wrapperInstance ; } catch ( Exception e ) { // continue
} } return instanceToWrap ;


signature:
public class TraceeContextProviderWrapperFunction { /** * Creates a new instance of the passed type via reflection .
 * @ param type the type of the new instance
 * @ return a new instance of the passed type or null if an exception occurred during the creation of the instance of if the passed type is null . */
protected Object createInstance ( final Class type ) { } }

implementation:
if ( type != null ) { try { return type . newInstance ( ) ; } catch ( Exception e ) { // should not occur
} } return null ;


signature:
public class IsTraceeContextProviderPrimitiveTypePredicate { /** * Checks whether the passed instance type is annotated with the { @ link io . tracee . contextlogger . contextprovider . api . TraceeContextProvider } annotation .
 * @ param instance the instance to check
 * @ return true , if the passed instance ' s type is annotated with the { @ link io . tracee . contextlogger . contextprovider . api . TraceeContextProvider } annotation ,
 * otherwise false */
protected boolean hasTraceeContextProviderPrimitiveTypeAnnotation ( final Object instance ) { } }

implementation: if ( instance == null ) { return false ; } TraceeContextProviderPrimitiveType annotation = TraceeContextLogAnnotationUtilities . getAnnotationFromType ( instance , TraceeContextProviderPrimitiveType . class ) ; return annotation != null ;


signature:
public class IsTraceeContextProviderPrimitiveTypePredicate { /** * Checks whether the passed instance extends the { @ link io . tracee . contextlogger . contextprovider . api . ImplicitContextData } or
 * { @ link io . tracee . contextlogger . contextprovider . api . WrappedContextData } types .
 * @ param instance the instance to check
 * @ return true , if the passed instance ' s type extends the ImplicitContextData or WrappedContextData class */
protected boolean isExtendingTraceeContextProvider ( final Object instance ) { } }

implementation: if ( instance == null ) { return false ; } return WrappedPrimitiveTypeContextData . class . isAssignableFrom ( instance . getClass ( ) ) ;


signature:
public class ProfileLookup { /** * Gets the current profile .
 * Uses the following algorithm to determine the profile .
 * 1 . If System Property is set force it as profile
 * 2 . If Custom Profile resource can be located in classpath use that file as profile
 * 3 . Use default profile
 * @ return */
public static Profile getCurrentProfile ( ) { } }

implementation:
// First get profile from system properties
Profile profile = getProfileFromSystemProperties ( ) ; // check if profile has been found otherwise try getting profile from file in classpath
if ( profile == null ) { profile = getProfileFromFileInClasspath ( ProfilePropertyNames . PROFILE_SET_BY_FILE_IN_CLASSPATH_FILENAME ) ; } // use DEFAULT profile , if profile has not been found
if ( profile == null ) { profile = ProfilePropertyNames . DEFAULT_PROFILE ; } return profile ;


signature:
public class ProfileLookup { /** * Gets the profile defined via the system properties .
 * @ return returns the profile defined via the system properties . Returns null if property is not set or set to an invalid value */
static Profile getProfileFromSystemProperties ( ) { } }

implementation:
Profile result = null ; // try to get system property
String systemPropertyProfileName = System . getProperty ( ProfilePropertyNames . PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES ) ; if ( systemPropertyProfileName != null ) { // try to convert String to enum value
try { result = Profile . valueOf ( systemPropertyProfileName ) ; } catch ( IllegalArgumentException e ) { logger . warn ( "Tracee ContextLoggerBuilder profile property ('" + ProfilePropertyNames . PROFILE_SET_GLOBALLY_VIA_SYSTEM_PROPERTIES + "') is set to the invalid value '" + systemPropertyProfileName + "' ==> Use default profile" ) ; } } return result ;


signature:
public class ProfileLookup { /** * Gets the profile defined via the system properties .
 * @ return returns the profile defined via the system properties or { @ code null } if property is not set or set to an invalid value . */
static Profile getProfileFromFileInClasspath ( final String filename ) { } }

implementation:
Profile result = null ; try { Properties properties = openProperties ( filename ) ; if ( properties != null ) { String profileFromProperties = properties . getProperty ( ProfilePropertyNames . PROFILE_SET_BY_FILE_IN_CLASSPATH_PROPERTY ) ; if ( profileFromProperties != null ) { // try to convert String to enum value
try { result = Profile . valueOf ( profileFromProperties ) ; } catch ( IllegalArgumentException e ) { logger . warn ( "Tracee custom ContextLoggerBuilder profile property ('" + ProfilePropertyNames . PROFILE_SET_BY_FILE_IN_CLASSPATH_PROPERTY + "') is set to the invalid value '" + profileFromProperties + "' and will be ignored" ) ; } } } } catch ( IOException e ) { // ignore it
} return result ;


signature:
public class ProfileLookup { /** * Loads properties from resources .
 * @ param propertyFileName the property file name to load
 * @ return the properties , or null if the properties can ' t be found
 * @ throws IOException if property file can ' t be opened */
public static Properties openProperties ( final String propertyFileName ) throws IOException { } }

implementation:
if ( propertyFileName == null ) { return null ; } InputStream inputStream = null ; try { inputStream = Profile . class . getResourceAsStream ( propertyFileName ) ; if ( inputStream != null ) { // file could be opened
Properties properties = new Properties ( ) ; properties . load ( inputStream ) ; return properties ; } else { // file doesn ' t exist
return null ; } } finally { if ( inputStream != null ) { inputStream . close ( ) ; } }


signature:
public class ConfigBuilderImpl { /** * Adds passed contexts value pairs to manualContextOverrides .
 * @ param contexts The property name of the context data .
 * @ param value the value which should be set . */
private void fillManualContextOverrideMap ( final String [ ] contexts , final boolean value ) { } }

implementation: if ( contexts != null ) { for ( String context : contexts ) { if ( ! context . isEmpty ( ) ) { this . manualContextOverrides . put ( context , value ) ; } } }


signature:
public class ConfigBuilderImpl { /** * Creates a TraceeGsonContextStringRepresentationBuilder instance which can be used for creating the createStringRepresentation message .
 * @ return An instance of TraceeGsonContextStringRepresentationBuilder */
private TraceeContextStringRepresentationBuilderImpl createContextStringRepresentationLogBuilder ( ) { } }

implementation: TraceeContextStringRepresentationBuilderImpl traceeContextStringRepresentationBuilderImpl = new TraceeContextStringRepresentationBuilderImpl ( ) ; traceeContextStringRepresentationBuilderImpl . setManualContextOverrides ( this . getManualContextOverrides ( ) ) ; traceeContextStringRepresentationBuilderImpl . setProfile ( this . getProfile ( ) ) ; traceeContextStringRepresentationBuilderImpl . setEnforceOrder ( this . getEnforceOrder ( ) ) ; traceeContextStringRepresentationBuilderImpl . setOutputWriterConfiguration ( this . getOutputWriterConfiguration ( ) ) ; return traceeContextStringRepresentationBuilderImpl ;


signature:
public class WatchdogUtils { /** * Tries to get the watchdog annotation for the called method or the methods class .
 * @ param proceedingJoinPoint The aspectj join point
 * @ return The watchdog annotation of the method , the class or null if neither the method or class aren ' t annotated with the watchdog annotation */
public static Watchdog getWatchdogAnnotation ( final ProceedingJoinPoint proceedingJoinPoint ) { } }

implementation:
// get watchdog annotation from method
MethodSignature methodSignature = ( MethodSignature ) proceedingJoinPoint . getSignature ( ) ; Watchdog methodAnnotation = methodSignature . getMethod ( ) . getAnnotation ( Watchdog . class ) ; if ( methodAnnotation != null ) { return methodAnnotation ; } // get watchdog annotation at class
return ( Watchdog ) proceedingJoinPoint . getSignature ( ) . getDeclaringType ( ) . getAnnotation ( Watchdog . class ) ;


signature:
public class WatchdogUtils { /** * Tries to get the watchdog annotation for the called method or the methods class .
 * @ param proceedingJoinPoint The aspectj join point
 * @ return The watchdog annotation of the method , the class or null if neither the method or class aren ' t annotated with the watchdog annotation */
public static ErrorMessage getErrorMessageAnnotation ( final ProceedingJoinPoint proceedingJoinPoint ) { } }

implementation:
// get watchdog annotation from method
MethodSignature methodSignature = ( MethodSignature ) proceedingJoinPoint . getSignature ( ) ; ErrorMessage methodAnnotation = methodSignature . getMethod ( ) . getAnnotation ( ErrorMessage . class ) ; if ( methodAnnotation != null ) { return methodAnnotation ; } else { return null ; }


signature:
public class WatchdogUtils { /** * Checks whether the passed Throwable is contained in methods throws part .
 * @ param proceedingJoinPoint The aspectj join point
 * @ param thrownException The Throwable which must be looked for
 * @ return true if Throwable was found and must be suppressed , otherwise false */
public static boolean checkIfMethodThrowsContainsPassedException ( final ProceedingJoinPoint proceedingJoinPoint , Throwable thrownException ) { } }

implementation: if ( proceedingJoinPoint == null || thrownException == null ) { return false ; } Class [ ] throwsClassesFromMethodSignature = getDefinedThrowsFromMethodSignature ( proceedingJoinPoint ) ; return checkClassIsDefinedInThrowsException ( throwsClassesFromMethodSignature , thrownException ) ;


signature:
public class WatchdogUtils { /** * Checks whether the passed Throwable is defined included in passed classes array or is subtype of one of the included classes .
 * @ param classes the classes to search
 * @ param thrownException the Throwable which must be searched for
 * @ return true if Throwable was found , otherwise false */
public static boolean checkClassIsDefinedInThrowsException ( Class [ ] classes , Throwable thrownException ) { } }

implementation:
// return false if either passed classes array or thrownException are null .
if ( classes == null || thrownException == null ) { return false ; } // loop through classes array to check for matching type
for ( Class clazz : classes ) { if ( clazz . isInstance ( thrownException ) ) { return true ; } } return false ;


signature:
public class WatchdogUtils { /** * Gets all Exceptions declared at the throws part of the method signature .
 * @ param proceedingJoinPoint the proceeding join point to get the method signature from .
 * @ return All defined exceptions that must be caught ( are defined in the method signature in the throws part ) */
public static Class [ ] getDefinedThrowsFromMethodSignature ( final ProceedingJoinPoint proceedingJoinPoint ) { } }

implementation:
if ( proceedingJoinPoint == null ) { return new Class [ 0 ] ; } // get watchdog annotation from method
MethodSignature methodSignature = ( MethodSignature ) proceedingJoinPoint . getSignature ( ) ; return methodSignature . getMethod ( ) . getExceptionTypes ( ) ;


signature:
public class WatchdogUtils { /** * Checks whether the exception should be processed or not .
 * @ param watchdogAnnotation the watchdog annotation to check .
 * @ return true , if passed watchdogAnnotation is not null and not disabled vie system properties , otherwise false . */
public static boolean checkProcessWatchdog ( final Watchdog watchdogAnnotation , final ProceedingJoinPoint proceedingJoinPoint , final Throwable throwable ) { } }

implementation:
// check if watchdog aspect processing is deactivated by annotation
if ( watchdogAnnotation != null && watchdogAnnotation . isActive ( ) ) { // checks if throws annotations must be suppressed
boolean throwableIsPartOfThrowsDeclaration = WatchdogUtils . checkIfMethodThrowsContainsPassedException ( proceedingJoinPoint , throwable ) ; if ( ! watchdogAnnotation . suppressThrowsExceptions ( ) || ( watchdogAnnotation . suppressThrowsExceptions ( ) && ! throwableIsPartOfThrowsDeclaration ) ) { return true ; } } return false ;


signature:
public class FileContentComparator { /** * Verifies that the given files have the same content . Adapted from < a
 * href = " http : / / junit - addons . sourceforge . net / junitx / framework / FileAssert . html " target = " _ blank " > FileAssert < / a > ( from < a
 * href = " http : / / sourceforge . net / projects / junit - addons " > JUnit - addons < / a > . ) */
@ NotNull LineDiff [ ] compareContents ( @ NotNull File actual , @ NotNull File expected ) throws IOException { } }

implementation: InputStream ais = null ; InputStream eis = null ; try { ais = new FileInputStream ( actual ) ; eis = new FileInputStream ( expected ) ; List < LineDiff > diffs = verifyEqualContent ( readerFor ( ais ) , readerFor ( eis ) ) ; return diffs . toArray ( new LineDiff [ diffs . size ( ) ] ) ; } finally { closeQuietly ( eis ) ; closeQuietly ( ais ) ; }


signature:
public class ComparableAssert { /** * Verifies that the actual { @ link Comparable } is equal to the given one .
 * @ param expected the given { @ code Comparable } to compare the actual { @ code Comparable } to .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Comparable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Comparable } is not equal to the given one . */
public final @ NotNull S isEqualByComparingTo ( T expected ) { } }

implementation: isNotNull ( ) ; if ( actual . compareTo ( expected ) == 0 ) { return myself ( ) ; } failIfCustomMessageIsSet ( ) ; throw comparisonFailed ( rawDescription ( ) , actual , expected ) ;


signature:
public class ComparableAssert { /** * Verifies that the actual { @ link Comparable } is < b > not < / b > equal to the given one .
 * @ param expected the given { @ code Comparable } to use to compare to the actual { @ code Comparable } .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Comparable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Comparable } is equal to the given one . */
public final @ NotNull S isNotEqualByComparingTo ( T expected ) { } }

implementation: isNotNull ( ) ; if ( actual . compareTo ( expected ) != 0 ) { return myself ( ) ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedEqual ( actual , expected ) ) ;


signature:
public class ComparableAssert { /** * Verifies that the actual { @ link Comparable } is less than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Comparable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Comparable } is not less than the given one . */
public final @ NotNull S isLessThan ( T other ) { } }

implementation: isNotNull ( ) ; if ( actual . compareTo ( other ) < 0 ) { return myself ( ) ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedGreaterThanOrEqualTo ( actual , other ) ) ;


signature:
public class ComparableAssert { /** * Verifies that the actual { @ link Comparable } is greater than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Comparable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Comparable } is not greater than the given one . */
public final @ NotNull S isGreaterThan ( @ Nullable T other ) { } }

implementation: isNotNull ( ) ; if ( actual . compareTo ( other ) > 0 ) { return myself ( ) ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedLessThanOrEqualTo ( actual , other ) ) ;


signature:
public class ComparableAssert { /** * Verifies that the actual { @ link Comparable } is less than or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Comparable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Comparable } is not less than or equal to the given one . */
public final @ NotNull S isLessThanOrEqualTo ( @ Nullable T other ) { } }

implementation: isNotNull ( ) ; if ( actual . compareTo ( other ) <= 0 ) { return myself ( ) ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedGreaterThan ( actual , other ) ) ;


signature:
public class ComparableAssert { /** * Verifies that the actual { @ link Comparable } is greater than or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Comparable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Comparable } is not greater than or equal to the given one . */
public final @ NotNull S isGreaterThanOrEqualTo ( @ Nullable T other ) { } }

implementation: isNotNull ( ) ; if ( actual . compareTo ( other ) >= 0 ) { return myself ( ) ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedLessThan ( actual , other ) ) ;


signature:
public class ImageAssert { /** * Reads the image in the specified path .
 * @ param imageFilePath the path of the image to read .
 * @ return the read image .
 * @ throws NullPointerException if the given path is { @ code null } .
 * @ throws IllegalArgumentException if the given path does not belong to a file .
 * @ throws IOException if any I / O error occurred while reading the image . */
public static @ Nullable BufferedImage read ( @ NotNull String imageFilePath ) throws IOException { } }

implementation: checkNotNull ( imageFilePath ) ; File imageFile = new File ( imageFilePath ) ; if ( ! imageFile . isFile ( ) ) { throw new IllegalArgumentException ( format ( "The path <%s> does not belong to a file" , imageFilePath ) ) ; } return imageReader . read ( imageFile ) ;


signature:
public class ImageAssert { /** * Verifies that the actual image is equal to the given one . Two images are equal if they have the same size and the
 * pixels at the same coordinates have the same color .
 * @ param expected the given image to compare the actual image to .
 * @ return this assertion object .
 * @ throws AssertionError if the actual image is not equal to the given one . */
@ Override public @ NotNull ImageAssert isEqualTo ( @ Nullable BufferedImage expected ) { } }

implementation: return isEqualTo ( expected , ZERO_THRESHOLD ) ;


signature:
public class ImageAssert { /** * Verifies that the actual image is equal to the given one . Two images are equal if :
 * < ol >
 * < li > they have the same size < / li >
 * < li > the difference between the RGB values of the color of each pixel is less than or equal to the given threshold < / li >
 * < / ol >
 * @ param expected the given image to compare the actual image to .
 * @ param threshold the threshold to use to decide if the color of two pixels are similar : two pixels that are
 * identical to the human eye may still have slightly different color values . For example , by using a
 * threshold of 1 we can indicate that a blue value of 60 is similar to a blue value of 61.
 * @ return this assertion object .
 * @ throws NullPointerException if { @ code threshold } is { @ code null } .
 * @ throws AssertionError if the actual image is not equal to the given one .
 * @ since 1.1 */
public @ NotNull ImageAssert isEqualTo ( @ Nullable BufferedImage expected , @ NotNull Threshold threshold ) { } }

implementation: checkNotNull ( threshold ) ; if ( areEqual ( actual , expected ) ) { return this ; } failIfNull ( expected ) ; failIfNotEqual ( sizeOf ( actual ) , sizeOf ( expected ) ) ; failIfNotEqualColor ( checkNotNull ( expected ) , threshold ) ; return this ;


signature:
public class ImageAssert { /** * Verifies that the actual image is not equal to the given one . Two images are equal if they have the same size and
 * the pixels at the same coordinates have the same color .
 * @ param image the given image to compare the actual image to .
 * @ return this assertion object .
 * @ throws AssertionError if the actual image is equal to the given one . */
@ Override public @ NotNull ImageAssert isNotEqualTo ( @ Nullable BufferedImage image ) { } }

implementation: if ( areEqual ( actual , image ) ) { failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedEqual ( actual , image ) ) ; } if ( image == null ) { return this ; } if ( areEqual ( sizeOf ( actual ) , sizeOf ( image ) ) && hasEqualColor ( image ) ) { failIfCustomMessageIsSet ( ) ; throw failure ( "images are equal" ) ; } return this ;


signature:
public class ImageAssert { /** * Verifies that the size of the actual image is equal to the given one .
 * @ param expected the expected size of the actual image .
 * @ return this assertion object .
 * @ throws AssertionError if the actual image is { @ code null } .
 * @ throws NullPointerException if the given size is { @ code null } .
 * @ throws AssertionError if the size of the actual image is not equal to the given one . */
public @ NotNull ImageAssert hasSize ( @ NotNull Dimension expected ) { } }

implementation: isNotNull ( ) ; checkNotNull ( expected ) ; Dimension actualDimension = new Dimension ( actual . getWidth ( ) , actual . getHeight ( ) ) ; if ( areEqual ( actualDimension , expected ) ) { return this ; } failWithMessage ( customErrorMessage ( ) ) ; throw comparisonFailed ( rawDescription ( ) , new DimensionFormatter ( actualDimension ) , new DimensionFormatter ( expected ) ) ;


signature:
public class Collections { /** * Attempts to find the given objects in the given { @ code Collection } , returning the ones that were not found .
 * @ param target the given { @ code Collection } .
 * @ param objects the elements to find in the given { @ code Collection } .
 * @ return the elements that were not found in the given { @ code Collection } . */
public static @ NotNull Collection < Object > notFound ( @ Nullable Collection < ? > target , @ NotNull Object ... objects ) { } }

implementation: if ( target == null ) { return emptyList ( ) ; } List < Object > notFound = newArrayList ( ) ; for ( Object o : objects ) { if ( ! target . contains ( o ) ) { notFound . add ( o ) ; } } return notFound ;


signature:
public class GroupAssert { /** * Verifies that the number of values in the actual group is equal to the given one .
 * @ param expected the expected number of values in the actual group .
 * @ return this assertion object .
 * @ throws AssertionError if the number of values of the actual group is not equal to the given one . */
public final @ NotNull S hasSize ( int expected ) { } }

implementation: isNotNull ( ) ; int size = actualGroupSize ( ) ; if ( size == expected ) { return myself ( ) ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "expected size:<%s> but was:<%s> for <%s>" , expected , size , actual ) ) ;


signature:
public class FileAssert { /** * Verifies that the actual { @ code File } does not exist .
 * @ return this assertion object .
 * @ throws AssertionError if the the actual { @ code File } is { @ code null } .
 * @ throws AssertionError if the actual { @ code File } exists . */
public @ NotNull FileAssert doesNotExist ( ) { } }

implementation: isNotNull ( ) ; if ( ! actual . exists ( ) ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "file:<%s> should not exist" , actual ) ) ;


signature:
public class FileAssert { /** * Verifies that the size of the actual { @ code File } is equal to the given one .
 * @ param expected the expected size of the actual { @ code File } .
 * @ return this assertion object .
 * @ throws AssertionError if the the actual { @ code File } is { @ code null } .
 * @ throws AssertionError if the size of the actual { @ code File } is not equal to the given one . */
public @ NotNull FileAssert hasSize ( long expected ) { } }

implementation: isNotNull ( ) ; long size = actual . length ( ) ; if ( size == expected ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "size of file:<%s> expected:<%s> but was:<%s>" , actual , expected , size ) ) ;


signature:
public class FileAssert { /** * Verifies that the actual { @ code File } is a directory .
 * @ return this assertion object .
 * @ throws AssertionError if the the actual { @ code File } is { @ code null } .
 * @ throws AssertionError if the actual { @ code File } is not a directory . */
public @ NotNull FileAssert isDirectory ( ) { } }

implementation: isNotNull ( ) ; if ( actual . isDirectory ( ) ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "file:<%s> should be a directory" , actual ) ) ;


signature:
public class FileAssert { /** * Verifies that the actual { @ code File } is a regular file .
 * @ return this assertion object .
 * @ throws AssertionError if the the actual { @ code File } is { @ code null } .
 * @ throws AssertionError if the actual { @ code File } is not a regular file . */
public @ NotNull FileAssert isFile ( ) { } }

implementation: isNotNull ( ) ; if ( actual . isFile ( ) ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "file:<%s> should be a file" , actual ) ) ;


signature:
public class FileAssert { /** * Verifies that the content of the actual { @ code File } is equal to the content of the given one . Adapted from < a
 * href = " http : / / junit - addons . sourceforge . net / junitx / framework / FileAssert . html " target = " _ blank " > FileAssert < / a > ( from < a
 * href = " http : / / sourceforge . net / projects / junit - addons " > JUnit - addons < / a > . )
 * @ param expected the given { @ code File } to compare the actual { @ code File } to .
 * @ return this assertion object .
 * @ throws NullPointerException if the file to compare to is { @ code null } .
 * @ throws AssertionError if the the actual { @ code File } is { @ code null } .
 * @ throws AssertionError if the content of the actual { @ code File } is not equal to the content of the given one . */
public @ NotNull FileAssert hasSameContentAs ( @ NotNull File expected ) { } }

implementation: checkNotNull ( expected ) ; isNotNull ( ) ; assertExists ( actual ) . assertExists ( expected ) ; try { LineDiff [ ] diffs = comparator . compareContents ( actual , expected ) ; if ( ! isNullOrEmpty ( diffs ) ) { fail ( expected , diffs ) ; } } catch ( IOException e ) { cannotCompareToExpectedFile ( expected , e ) ; } return this ;


signature:
public class FileAssert { /** * Verifies that the actual { @ code File } is a relative path .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code File } is not a relative path . */
public @ NotNull FileAssert isRelative ( ) { } }

implementation: isNotNull ( ) ; if ( ! actual . isAbsolute ( ) ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "file:<%s> should be a relative path" , actual ) ) ;


signature:
public class IteratorAssert { /** * { @ inheritDoc } */
@ Override protected @ NotNull IteratorAssert onProperty ( @ NotNull String propertyName ) { } }

implementation: checkNotNull ( propertyName ) ; isNotNull ( ) ; List < Object > subset = PropertySupport . instance ( ) . propertyValues ( propertyName , newArrayList ( contentOfActual ( ) ) ) ; return new IteratorAssert ( subset . iterator ( ) ) ;


signature:
public class IteratorAssert { /** * { @ inheritDoc } */
@ Override protected @ Nullable List < Object > actualAsList ( ) { } }

implementation: if ( actual == null ) { return null ; } return newArrayList ( contentOfActual ( ) ) ;


signature:
public class PropertySupport { /** * Returns a list containing the values of the given property name , from the elements of the given collection . If the
 * given collection is empty or { @ code null } , this method will return an empty collection .
 * For example , given the nested property " address . street . number " , this method will :
 * < ol >
 * < li > extract a collection of " address " from the given collection ( remaining property is ' street . number ' ) < / li >
 * < li > extract a collection of " street " from the " address " collection ( remaining property is ' number ' ) < / li >
 * < li > extract a collection of " number " from the " street " collection < / li >
 * < / ol >
 * @ param propertyName the name of the property . It may be a nested property .
 * @ param target the given collection .
 * @ return a list containing the values of the given property name , from the elements of the given collection .
 * @ throws NullPointerException if given property name is { @ code null } .
 * @ throws IntrospectionError if an element in the given collection does not have a matching property . */
@ NotNull List < Object > propertyValues ( @ NotNull String propertyName , @ Nullable Collection < ? > target ) { } }

implementation:
if ( isNullOrEmpty ( target ) ) { return emptyList ( ) ; } // ignore null elements as we can ' t extract a property from a null object
Collection < ? > nonNullElements = nonNullElementsIn ( target ) ; if ( isNestedProperty ( propertyName ) ) { String firstProperty = firstPropertyIfNested ( propertyName ) ; List < Object > firstPropertyValues = propertyValues ( firstProperty , nonNullElements ) ; // extract next sub property values until reaching a last sub property
return propertyValues ( removeFirstPropertyIfNested ( propertyName ) , firstPropertyValues ) ; } return simplePropertyValues ( propertyName , nonNullElements ) ;


signature:
public class PropertySupport { /** * Returns { @ code true } if property is nested , { @ code false } otherwise .
 * Examples :
 * < pre >
 * isNestedProperty ( & quot ; address . street & quot ; ) ; / / true
 * isNestedProperty ( & quot ; address . street . name & quot ; ) ; / / true
 * isNestedProperty ( & quot ; person & quot ; ) ; / / false
 * isNestedProperty ( & quot ; . name & quot ; ) ; / / false
 * isNestedProperty ( & quot ; person . & quot ; ) ; / / false
 * isNestedProperty ( & quot ; person . name . & quot ; ) ; / / false
 * isNestedProperty ( & quot ; . person . name & quot ; ) ; / / false
 * isNestedProperty ( & quot ; . & quot ; ) ; / / false
 * isNestedProperty ( & quot ; & quot ; ) ; / / false
 * < / pre >
 * @ param propertyName the given property name .
 * @ return { @ code true } if property is nested , { @ code false } otherwise .
 * @ throws NullPointerException if given property name is { @ code null } . */
boolean isNestedProperty ( String propertyName ) { } }

implementation: Preconditions . checkNotNull ( propertyName ) ; return propertyName . contains ( SEPARATOR ) && ! propertyName . startsWith ( SEPARATOR ) && ! propertyName . endsWith ( SEPARATOR ) ;


signature:
public class PropertySupport { /** * Returns the first property from the given property name only if the given property name belongs to a nested
 * property . For example , given the nested property " address . street . name " , this method will return " address " . This
 * method returns the given property name unchanged if it does not belong to a nested property .
 * @ param propertyName the given property name .
 * @ return the first property from the given property name , if the property name belongs to a nested property ;
 * otherwise , it will return the given property name unchanged .
 * @ throws NullPointerException if given property name is { @ code null } . */
@ NotNull String firstPropertyIfNested ( @ NotNull String propertyName ) { } }

implementation: if ( ! isNestedProperty ( propertyName ) ) { return propertyName ; } return checkNotNull ( propertyName . substring ( 0 , propertyName . indexOf ( SEPARATOR ) ) ) ;


signature:
public class ComparisonFailureFactory { /** * Creates a new instance of JUnit ' s { @ code ComparisonFailure } only if JUnit 4 + is in the classpath .
 * @ param message the identifying message or { @ code null } .
 * @ param expected the expected value .
 * @ param actual the actual value .
 * @ return the created { @ code ComparisonFailure } , or { @ code null } if JUnit 4 + is not in the classpath . */
public static @ Nullable AssertionError comparisonFailure ( @ Nullable String message , @ Nullable Object expected , @ Nullable Object actual ) { } }

implementation: try { return newComparisonFailure ( clean ( message ) , expected , actual ) ; } catch ( Exception e ) { return null ; }


signature:
public class ListAssert { /** * Verifies that the actual { @ code List } contains the given object at the given index .
 * @ param o the object to look for .
 * @ param index the index where the object should be stored in the actual { @ code List } .
 * @ return this assertion object .
 * @ throws NullPointerException if the given { @ code Index } is { @ code null } .
 * @ throws IndexOutOfBoundsException if the value of the given { @ code Index } is negative , or equal to or greater than
 * the size of the actual { @ code List } .
 * @ throws AssertionError if the given { @ code List } does not contain the given object at the given index . */
public @ NotNull ListAssert contains ( @ Nullable Object o , @ NotNull Index index ) { } }

implementation: checkNotNull ( index ) ; isNotNull ( ) . isNotEmpty ( ) ; int indexValue = index . value ( ) ; int listSize = actualGroupSize ( ) ; if ( indexValue < 0 || indexValue >= listSize ) { failIndexOutOfBounds ( indexValue ) ; } Object actualElement = actual . get ( indexValue ) ; if ( ! areEqual ( actualElement , o ) ) { failElementNotFound ( o , actualElement , indexValue ) ; } return this ;


signature:
public class ListAssert { /** * Verifies that the actual { @ code List } contains the given sequence of objects , without any other objects between
 * them .
 * @ param sequence the sequence of objects to look for .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code List } is { @ code null } .
 * @ throws AssertionError if the given array is { @ code null } .
 * @ throws AssertionError if the actual { @ code List } does not contain the given sequence of objects . */
public @ NotNull ListAssert containsSequence ( @ NotNull Object ... sequence ) { } }

implementation: isNotNull ( ) ; checkNotNull ( sequence ) ; int sequenceSize = sequence . length ; if ( sequenceSize == 0 ) { return this ; } int indexOfFirst = actual . indexOf ( sequence [ 0 ] ) ; if ( indexOfFirst == - 1 ) { failIfSequenceNotFound ( sequence ) ; } int listSize = actualGroupSize ( ) ; for ( int i = 0 ; i < sequenceSize ; i ++ ) { int actualIndex = indexOfFirst + i ; if ( actualIndex > listSize - 1 ) { failIfSequenceNotFound ( sequence ) ; } if ( ! areEqual ( sequence [ i ] , actual . get ( actualIndex ) ) ) { failIfSequenceNotFound ( sequence ) ; } } return this ;


signature:
public class ListAssert { /** * Verifies that the actual { @ code List } starts with the given sequence of objects , without any other objects between
 * them . Same as { @ link # containsSequence } , but verifies also that first given object is also first element of
 * { @ code List } .
 * @ param sequence the sequence of objects to look for .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code List } is { @ code null } .
 * @ throws AssertionError if the given array is { @ code null } .
 * @ throws AssertionError if the actual { @ code List } is not empty and with the given sequence of objects is empty .
 * @ throws AssertionError if the actual { @ code List } does not start with the given sequence of objects . */
public @ NotNull ListAssert startsWith ( @ NotNull Object ... sequence ) { } }

implementation: isNotNull ( ) ; checkNotNull ( sequence ) ; int sequenceSize = sequence . length ; int listSize = actualGroupSize ( ) ; if ( sequenceSize == 0 && listSize == 0 ) { return this ; } if ( sequenceSize == 0 && listSize != 0 ) { failIfNotStartingWithSequence ( sequence ) ; } if ( listSize < sequenceSize ) { failIfNotStartingWithSequence ( sequence ) ; } for ( int i = 0 ; i < sequenceSize ; i ++ ) { if ( ! areEqual ( sequence [ i ] , actual . get ( i ) ) ) { failIfNotStartingWithSequence ( sequence ) ; } } return this ;


signature:
public class ListAssert { /** * Verifies that the actual { @ code List } ends with the given sequence of objects , without any other objects between
 * them . Same as { @ link # containsSequence } , but verifies also that last given object is also last element of
 * { @ code List } .
 * @ param sequence the sequence of objects to look for .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code List } is { @ code null } .
 * @ throws AssertionError if the given array is { @ code null } .
 * @ throws AssertionError if the actual { @ code List } is not empty and with the given sequence of objects is empty .
 * @ throws AssertionError if the actual { @ code List } does not end with the given sequence of objects . */
public @ NotNull ListAssert endsWith ( @ NotNull Object ... sequence ) { } }

implementation: isNotNull ( ) ; checkNotNull ( sequence ) ; int sequenceSize = sequence . length ; int listSize = actualGroupSize ( ) ; if ( sequenceSize == 0 && listSize == 0 ) { return this ; } if ( sequenceSize == 0 && listSize != 0 ) { failIfNotEndingWithSequence ( sequence ) ; } if ( listSize < sequenceSize ) { failIfNotEndingWithSequence ( sequence ) ; } for ( int i = 0 ; i < sequenceSize ; i ++ ) { int sequenceIndex = sequenceSize - 1 - i ; int listIndex = listSize - 1 - i ; if ( ! areEqual ( sequence [ sequenceIndex ] , actual . get ( listIndex ) ) ) { failIfNotEndingWithSequence ( sequence ) ; } } return this ;


signature:
public class ListAssert { /** * Verifies that the actual { @ code List } contains the given objects , in the same order . This method works just like
 * { @ code isEqualTo ( List ) } , with the difference that internally the given array is converted to a { @ code List } .
 * @ param objects the objects to look for .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code List } is { @ code null } .
 * @ throws NullPointerException if the given array is { @ code null } .
 * @ throws AssertionError if the actual { @ code List } does not contain the given objects . */
public @ NotNull ListAssert containsExactly ( @ NotNull Object ... objects ) { } }

implementation: checkNotNull ( objects ) ; return isNotNull ( ) . isEqualTo ( newArrayList ( objects ) ) ;


signature:
public class ListAssert { /** * Creates a new instance of { @ link ListAssert } whose target list contains the values of the given
 * property name from the elements of this { @ code ListAssert } ' s list . Property access works with both simple
 * properties like { @ code Person . age } and nested properties { @ code Person . father . age } .
 * For example , let ' s say we have a list of { @ code Person } objects and you want to verify their age :
 * < pre >
 * assertThat ( persons ) . onProperty ( & quot ; age & quot ; ) . containsOnly ( 25 , 16 , 44 , 37 ) ; / / simple property
 * assertThat ( persons ) . onProperty ( " father . age " ) . containsOnly ( 55 , 46 , 74 , 62 ) ; / / nested property
 * < / pre >
 * @ param propertyName the name of the property to extract values from the actual list to build a new
 * { @ code ListAssert } .
 * @ return a new { @ code ListAssert } containing the values of the given property name from the elements of this
 * { @ code ListAssert } ' s list .
 * @ throws AssertionError if the actual list is { @ code null } .
 * @ throws IntrospectionError if an element in the given list does not have a matching property .
 * @ since 1.3 */
@ Override public @ NotNull ListAssert onProperty ( @ NotNull String propertyName ) { } }

implementation: isNotNull ( ) ; if ( actual . isEmpty ( ) ) { return new ListAssert ( emptyList ( ) ) ; } return new ListAssert ( PropertySupport . instance ( ) . propertyValues ( propertyName , actual ) ) ;


signature:
public class ListAssert { /** * { @ inheritDoc } */
@ Override protected @ Nullable Set < Object > actualAsSet ( ) { } }

implementation: return actual == null ? null : newLinkedHashSet ( actual . toArray ( ) ) ;


signature:
public class DoubleAssert { /** * Verifies that the actual { @ code Double } is equal to the given one , within a positive delta .
 * @ param expected the value to compare the actual one to .
 * @ param delta the given delta .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Double } is not equal to the given one .
 * @ deprecated use method { @ link # isEqualTo ( double , org . fest . assertions . Delta ) } instead . This method will be removed
 * in version 2.0. */
@ Deprecated public @ NotNull DoubleAssert isEqualTo ( double expected , Delta delta ) { } }

implementation: return isEqualTo ( expected , delta . value ) ;


signature:
public class DoubleAssert { /** * Verifies that the actual { @ code Double } is equal to the given one , within a positive delta .
 * @ param expected the value to compare the actual one to .
 * @ param delta the given delta .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Double } is not equal to the given one .
 * @ since 1.1 */
public @ NotNull DoubleAssert isEqualTo ( double expected , org . fest . assertions . Delta delta ) { } }

implementation: return isEqualTo ( expected , delta . doubleValue ( ) ) ;


signature:
public class DoubleAssert { /** * Verifies that the actual { @ code Double } is less than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Double } is not less than the given one . */
public @ NotNull DoubleAssert isLessThan ( double other ) { } }

implementation: if ( compareTo ( other ) < 0 ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedGreaterThanOrEqualTo ( actual , other ) ) ;


signature:
public class DoubleAssert { /** * Verifies that the actual { @ code Double } is greater or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Double } is not greater than or equal to the given one . */
public @ NotNull DoubleAssert isGreaterThanOrEqualTo ( double other ) { } }

implementation: if ( compareTo ( other ) >= 0 ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedLessThan ( actual , other ) ) ;


signature:
public class DoubleAssert { /** * Verifies that the actual { @ code Double } is less or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Double } is not less than or equal to the given one . */
public @ NotNull DoubleAssert isLessThanOrEqualTo ( double other ) { } }

implementation: if ( compareTo ( other ) <= 0 ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedGreaterThan ( actual , other ) ) ;


signature:
public class LongAssert { /** * Verifies that the actual { @ code Long } is greater than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Long } is not greater than the given one . */
public @ NotNull LongAssert isGreaterThan ( long other ) { } }

implementation: if ( actual > other ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedLessThanOrEqualTo ( actual , other ) ) ;


signature:
public class LongAssert { /** * Verifies that the actual { @ code Long } is less than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Long } is not less than the given one . */
public @ NotNull LongAssert isLessThan ( long other ) { } }

implementation: if ( actual < other ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedGreaterThanOrEqualTo ( actual , other ) ) ;


signature:
public class LongAssert { /** * Verifies that the actual { @ code Long } is greater or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Long } is not greater than or equal to the given one . */
public @ NotNull LongAssert isGreaterThanOrEqualTo ( long other ) { } }

implementation: if ( actual >= other ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedLessThan ( actual , other ) ) ;


signature:
public class LongAssert { /** * Verifies that the actual { @ code Long } is less or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Long } is not less than or equal to the given one . */
public @ NotNull LongAssert isLessThanOrEqualTo ( long other ) { } }

implementation: if ( actual <= other ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedGreaterThan ( actual , other ) ) ;


signature:
public class ItemGroupAssert { /** * Verifies that the actual actual group of objects contains the given objects , in any order .
 * @ param objects the objects to look for .
 * @ throws AssertionError if the actual actual group of objects is { @ code null } .
 * @ throws NullPointerException if the given array is { @ code null } .
 * @ throws AssertionError if the actual actual group of objects does not contain the given objects . */
protected final void assertContains ( @ NotNull Object ... objects ) { } }

implementation: isNotNull ( ) ; checkNotNull ( objects ) ; Collection < Object > notFound = notFoundInActual ( objects ) ; if ( notFound . isEmpty ( ) ) { return ; } throw failureIfExpectedElementsNotFound ( notFound ) ;


signature:
public class ItemGroupAssert { /** * Verifies that the actual group of objects contains the given objects < strong > only < / strong > , in any order .
 * @ param objects the objects to look for .
 * @ throws AssertionError if the actual group of objects is { @ code null } .
 * @ throws NullPointerException if the given group of objects is { @ code null } .
 * @ throws AssertionError if the actual group of objects does not contain the given objects , or if the actual
 * group of objects contains elements other than the ones specified . */
protected final void assertContainsOnly ( @ NotNull Object ... objects ) { } }

implementation: isNotNull ( ) ; checkNotNull ( objects ) ; Set < Object > copy = actualAsSet ( ) ; List < Object > notFound = notFoundInCopy ( copy , newLinkedHashSet ( objects ) ) ; if ( ! notFound . isEmpty ( ) ) { throw failureIfExpectedElementsNotFound ( notFound ) ; } if ( copy == null || copy . isEmpty ( ) ) { return ; } throw failureIfUnexpectedElementsFound ( copy ) ;


signature:
public class ItemGroupAssert { /** * Verifies that the actual group of objects does not contain the given objects .
 * @ param objects the objects that the group of objects should exclude .
 * @ throws AssertionError if the actual group of objects is { @ code null } .
 * @ throws NullPointerException if the given array is { @ code null } .
 * @ throws AssertionError if the actual group of objects contains any of the given objects . */
protected final void assertExcludes ( @ NotNull Object ... objects ) { } }

implementation: isNotNull ( ) ; checkNotNull ( objects ) ; Collection < Object > found = found ( actualAsSet ( ) , objects ) ; if ( found . isEmpty ( ) ) { return ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "<%s> does not exclude element(s):<%s>" , actual , found ) ) ;


signature:
public class ItemGroupAssert { /** * Verifies that the actual group of objects does not have duplicates .
 * @ throws AssertionError if the actual group of objects is { @ code null } .
 * @ throws AssertionError if the actual group of objects has duplicates . */
protected final void assertDoesNotHaveDuplicates ( ) { } }

implementation: isNotNull ( ) ; Collection < ? > duplicates = duplicatesFrom ( actualAsList ( ) ) ; if ( duplicates . isEmpty ( ) ) { return ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "<%s> contains duplicate(s):<%s>" , actual , duplicates ) ) ;


signature:
public class Formatting { /** * Returns the given message formatted as follows :
 * < pre >
 * [ description ] message .
 * < / pre >
 * @ param description the description of the actual value in the failed assertion . It can be { @ code null } .
 * @ param message the message to format .
 * @ return the formatted message .
 * @ throws NullPointerException if the given message is { @ code null } .
 * @ since 1.2 */
public static @ NotNull String format ( @ Nullable Description description , @ NotNull String message ) { } }

implementation: checkNotNull ( message ) ; String s = valueOf ( description ) ; return format ( s ) + message ;


signature:
public class Formatting { /** * Returns the value of the given { @ link Description } .
 * @ param description the given { @ code Description } .
 * @ return the value of the given { @ code Description } , or { @ code null } if the given { @ code Description } is
 * { @ code null } . */
public static @ Nullable String valueOf ( @ Nullable Description description ) { } }

implementation: return description == null ? null : description . value ( ) ;


signature:
public class Formatting { /** * Returns a formatted string using the specified format { @ code String } and arguments .
 * @ param format a format { @ code String } .
 * @ param args Arguments referenced by the format specifiers in the format { @ code String } . If there are more
 * arguments than format specifiers , the extra arguments are ignored . The number of arguments is
 * variable and may be zero .
 * @ return A formatted { @ code String } .
 * @ throws IllegalFormatException If a format string contains an illegal syntax , a format specifier that is
 * incompatible with the given arguments , insufficient arguments given the format
 * { @ code String } , or other illegal conditions .
 * @ throws NullPointerException if the given format is { @ code null } .
 * @ since 1.3.1 */
public static @ NotNull String format ( @ NotNull String format , @ NotNull Object ... args ) { } }

implementation: Object [ ] argsAsText = new String [ args . length ] ; for ( int i = 0 ; i < args . length ; i ++ ) { argsAsText [ i ] = toStringOf ( args [ i ] ) ; } return String . format ( format , argsAsText ) ;


signature:
public class Assertions { /** * Creates a new instance of { @ link IteratorAssert } .
 * @ param actual an { @ code Iterable } whose contents will be added to a new { @ code Collection } .
 * @ return the created assertion object . */
public static @ NotNull IteratorAssert assertThat ( @ Nullable Iterable < ? > actual ) { } }

implementation: Iterator < ? > iterator = actual == null ? null : actual . iterator ( ) ; return assertThat ( iterator ) ;


signature:
public class CharAssert { /** * Verifies that the { @ code Character } value is greater than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the { @ code Character } value is not greater than the given one . */
public @ NotNull CharAssert isGreaterThan ( char other ) { } }


signature:
public class CharAssert { /** * Verifies that the { @ code Character } value is less than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the { @ code Character } value is not less than the given one . */
public @ NotNull CharAssert isLessThan ( char other ) { } }


signature:
public class CharAssert { /** * Verifies that the { @ code Character } value is greater or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the { @ code Character } value is not greater than or equal to the given one . */
public @ NotNull CharAssert isGreaterThanOrEqualTo ( char other ) { } }


signature:
public class CharAssert { /** * Verifies that the { @ code Character } value is less or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the { @ code Character } value is not less than or equal to the given one . */
public @ NotNull CharAssert isLessThanOrEqualTo ( char other ) { } }


signature:
public class CharAssert { /** * Verifies that the { @ code Character } value is an upper - case value .
 * @ return this assertion object .
 * @ throws AssertionError if the { @ code Character } value is not an upper - case value . */
public @ NotNull CharAssert isUpperCase ( ) { } }

implementation: if ( Character . isUpperCase ( actual ) ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( String . format ( "<%s> should be an upper-case character" , actual ) ) ;


signature:
public class CharAssert { /** * Verifies that the { @ code Character } value is an lower - case value .
 * @ return this assertion object .
 * @ throws AssertionError if the { @ code Character } value is not an lower - case value . */
public @ NotNull CharAssert isLowerCase ( ) { } }

implementation: if ( Character . isLowerCase ( actual ) ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( String . format ( "<%s> should be a lower-case character" , actual ) ) ;


signature:
public class Fail { /** * Throws an { @ code AssertionError } if the given objects are equal .
 * @ param customErrorMessage any custom error message . This message will replace the default one only if it ( the
 * custom message ) is not { @ code null } .
 * @ param descriptionOfActual the description of the actual value .
 * @ param actual the actual object .
 * @ param other the object to compare to .
 * @ throws AssertionError if the given objects are equal .
 * @ since 1.2 */
protected static void failIfEqual ( @ Nullable String customErrorMessage , @ Nullable Description descriptionOfActual , @ Nullable Object actual , @ Nullable Object other ) { } }

implementation: if ( ! areEqual ( actual , other ) ) { return ; } failWithMessage ( customErrorMessage ) ; fail ( format ( descriptionOfActual , unexpectedEqual ( actual , other ) ) ) ;


signature:
public class Fail { /** * Throws an { @ code AssertionError } if ' actual ' is not equal to ' expected ' . If JUnit 4 ( or greater ) is in the
 * classpath , this method will throw a { @ code ComparisonFailure } instead . More details about this feature can be
 * found < a href = " http : / / docs . codehaus . org / display / FEST / JUnit - Specific + Features " > here < / a > .
 * @ param customErrorMessage any custom error message . This message will replace the default one only if it ( the
 * custom message ) is not { @ code null } .
 * @ param descriptionOfActual the description of the actual value .
 * @ param actual the actual object .
 * @ param expected the expected object .
 * @ throws AssertionError if the given objects are not equal .
 * @ since 1.2 */
protected static void failIfNotEqual ( @ Nullable String customErrorMessage , @ Nullable Description descriptionOfActual , @ Nullable Object actual , @ Nullable Object expected ) { } }

implementation: if ( areEqual ( actual , expected ) ) { return ; } failWithMessage ( customErrorMessage ) ; throw comparisonFailed ( descriptionOfActual , actual , expected ) ;


signature:
public class Fail { /** * Returns a { @ code AssertionError } describing a comparison failure .
 * @ param description the description of the comparison .
 * @ param actual the actual value .
 * @ param expected the expected value .
 * @ return a { @ code AssertionError } describing the comparison failure .
 * @ since 1.3 */
protected static @ NotNull AssertionError comparisonFailed ( @ Nullable Description description , @ Nullable Object actual , @ Nullable Object expected ) { } }

implementation: AssertionError comparisonFailure = comparisonFailure ( valueOf ( description ) , expected , actual ) ; if ( comparisonFailure != null ) { return comparisonFailure ; } return failure ( format ( description , unexpectedNotEqual ( actual , expected ) ) ) ;


signature:
public class Fail { /** * Throws an { @ code AssertionError } if the actual value is { @ code null } .
 * @ param customErrorMessage any custom error message . This message will replace the default one only if it ( the
 * custom message ) is not { @ code null } .
 * @ param description the description of the actual value .
 * @ param actual the actual value .
 * @ throws AssertionError if the actual value is { @ code null } .
 * @ since 1.3 */
protected static void failIfActualIsNull ( @ Nullable String customErrorMessage , @ Nullable Description description , @ Nullable Object actual ) { } }

implementation: if ( actual != null ) { return ; } failWithMessage ( customErrorMessage ) ; fail ( description , array ( "expecting actual value not to be null" ) ) ;


signature:
public class Fail { /** * Throws an { @ code AssertionError } if the given object is { @ code null } .
 * @ param customErrorMessage any custom error message . This message will replace the default one only if it ( the
 * custom message ) is not { @ code null } .
 * @ param description the description of the given object .
 * @ param o the given object .
 * @ throws AssertionError if the given object is { @ code null } .
 * @ since 1.2 */
protected static void failIfNull ( @ Nullable String customErrorMessage , @ Nullable Description description , @ Nullable Object o ) { } }

implementation: if ( o != null ) { return ; } failWithMessage ( customErrorMessage ) ; fail ( description , array ( "expecting a non-null object, but it was null" ) ) ;


signature:
public class Fail { /** * Throws an { @ code AssertionError } if the given object is not { @ code null } .
 * @ param customErrorMessage any custom error message . This message will replace the default one only if it ( the
 * custom message ) is not { @ code null } .
 * @ param description the description of the given object .
 * @ param o the given object .
 * @ throws AssertionError if the given object is not { @ code null } .
 * @ since 1.2 */
protected static void failIfNotNull ( @ Nullable String customErrorMessage , @ Nullable Description description , @ Nullable Object o ) { } }

implementation: if ( o == null ) { return ; } failWithMessage ( customErrorMessage ) ; fail ( description , array ( inBrackets ( o ) , " should be null" ) ) ;


signature:
public class Fail { /** * Throws an { @ code AssertionError } if the given objects are the same .
 * @ param customErrorMessage any custom error message . This message will replace the default one only if it ( the
 * custom message ) is not { @ code null } .
 * @ param descriptionOfActual the description of the actual value .
 * @ param actual the actual object .
 * @ param other the object to compare to .
 * @ throws AssertionError if the given objects are the same .
 * @ since 1.2 */
protected static void failIfSame ( @ Nullable String customErrorMessage , @ Nullable Description descriptionOfActual , @ Nullable Object actual , @ Nullable Object other ) { } }

implementation: if ( actual != other ) { return ; } failWithMessage ( customErrorMessage ) ; fail ( descriptionOfActual , array ( "given objects are same:" , inBrackets ( actual ) ) ) ;


signature:
public class Fail { /** * Throws an { @ code AssertionError } only if the given custom message is not { @ code null } .
 * @ param customErrorMessage the custom error message .
 * @ param realCause cause of the error .
 * @ throws AssertionError only if the custom error message is not { @ code null } .
 * @ since 1.2 */
protected static void failWithMessage ( @ Nullable String customErrorMessage , Throwable realCause ) { } }

implementation: if ( customErrorMessage != null ) { fail ( customErrorMessage , realCause ) ; }


signature:
public class Fail { /** * Throws an { @ code AssertionError } with the given message and with the { @ code Throwable } that caused the failure .
 * @ param description the description of the failed assertion . It can be { @ code null } .
 * @ param realCause cause of the error . */
public static void fail ( String description , @ Nullable Throwable realCause ) { } }

implementation: AssertionError error = failure ( description ) ; error . initCause ( realCause ) ; throw error ;


signature:
public class ObjectAssert { /** * Verifies that the actual { @ code Object } is an instance of the given type .
 * @ param type the type to check the actual { @ code Object } against .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Object } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Object } is not an instance of the given type .
 * @ throws NullPointerException if the given type is { @ code null } . */
public @ NotNull ObjectAssert isInstanceOf ( @ NotNull Class < ? > type ) { } }

implementation: isNotNull ( ) ; checkNotNull ( type ) ; Class < ? > current = actual . getClass ( ) ; if ( type . isAssignableFrom ( current ) ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "expected instance of:<%s> but was instance of:<%s>" , type , current ) ) ;


signature:
public class ObjectAssert { /** * Verifies that the actual { @ code Object } is an instance of any of the given types .
 * @ param types the types to check the actual { @ code Object } against .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Object } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Object } is not an instance of any of the given types .
 * @ throws NullPointerException if the given array of types is { @ code null } .
 * @ throws NullPointerException if the given array of types contains { @ code null } s . */
public @ NotNull ObjectAssert isInstanceOfAny ( @ NotNull Class < ? > ... types ) { } }

implementation: isNotNull ( ) ; checkNotNull ( types ) ; if ( ! foundInstanceOfAny ( types ) ) { String format = "expected instance of any:<%s> but was instance of:<%s>" ; fail ( String . format ( format , typeNames ( types ) , actual . getClass ( ) . getName ( ) ) ) ; } return this ;


signature:
public class ThrowableAssert { /** * Verifies that the actual { @ code Throwable } is an instance of the given type .
 * @ param type the type to check the actual { @ code Throwable } against .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Throwable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Throwable } is not an instance of the given type .
 * @ throws NullPointerException if the given type is { @ code null } . */
public @ NotNull ThrowableAssert isInstanceOf ( @ NotNull Class < ? extends Throwable > type ) { } }

implementation: objectAssert . isInstanceOf ( type ) ; return this ;


signature:
public class ThrowableAssert { /** * Verifies that the actual { @ code Throwable } is an instance of the given type . In order for the assertion to pass ,
 * the type of the actual { @ code Throwable } has to be exactly the same as the given type .
 * @ param type the type to check the actual { @ code Throwable } against .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Throwable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Throwable } is not an instance of the given type .
 * @ throws NullPointerException if the given type is { @ code null } . */
public @ NotNull ThrowableAssert isExactlyInstanceOf ( @ NotNull Class < ? > type ) { } }

implementation: isNotNull ( ) ; checkNotNull ( type ) ; Class < ? > current = actual . getClass ( ) ; if ( type . equals ( current ) ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "expected exactly the same type:<%s> but was:<%s>" , type , current ) ) ;


signature:
public class ThrowableAssert { /** * Verifies that the message of the actual { @ code Throwable } is equal to the given one .
 * @ param message the expected message .
 * @ return this assertion error .
 * @ throws AssertionError if the actual { @ code Throwable } is { @ code null } .
 * @ throws AssertionError if the message of the actual { @ code Throwable } is not equal to the given one . */
public @ NotNull ThrowableAssert hasMessage ( @ Nullable String message ) { } }

implementation: isNotNull ( ) ; failIfNotEqual ( customErrorMessage ( ) , rawDescription ( ) , actual . getMessage ( ) , message ) ; return this ;


signature:
public class ThrowableAssert { /** * Verifies that the actual { @ code Throwable } does not have a cause .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Throwable } is { @ code null } .
 * @ throws AssertionError if the actual { @ code Throwable } has a cause . */
public @ NotNull ThrowableAssert hasNoCause ( ) { } }

implementation: isNotNull ( ) ; Throwable actualCause = actual . getCause ( ) ; if ( actualCause == null ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( format ( "expected exception without cause, but cause was:<%s>" , actualCause . getClass ( ) ) ) ;


signature:
public class ThrowableAssert { /** * { @ inheritDoc } */
@ Override public @ NotNull ThrowableAssert as ( @ Nullable String description ) { } }

implementation: objectAssert . as ( description ) ; return super . as ( description ) ;


signature:
public class ThrowableAssert { /** * { @ inheritDoc } */
@ Override public @ NotNull ThrowableAssert as ( @ Nullable Description description ) { } }


signature:
public class ThrowableAssert { /** * { @ inheritDoc } */
@ Override public @ NotNull ThrowableAssert overridingErrorMessage ( @ Nullable String message ) { } }

implementation: objectAssert . overridingErrorMessage ( message ) ; return super . overridingErrorMessage ( message ) ;


signature:
public class MapAssert { /** * Creates a new map entry .
 * @ param key the key of the entry .
 * @ param value the value of the entry .
 * @ return the created entry .
 * @ see # includes ( org . fest . assertions . MapAssert . Entry . . . ) */
public static @ NotNull Entry entry ( @ Nullable Object key , @ Nullable Object value ) { } }

implementation: return new Entry ( key , value ) ;


signature:
public class MapAssert { /** * Verifies that the actual { @ code Map } contains the given entries .
 * Example :
 * < pre >
 * / / static import org . fest . assertions . Assertions . * ;
 * / / static import org . fest . assertions . MapAssert . * ;
 * assertThat ( myMap ) . { @ link # includes ( org . fest . assertions . MapAssert . Entry . . . ) includes } ( { @ link # entry ( Object , Object ) entry } ( & quot ; jedi & quot ; , yoda ) , { @ link # entry ( Object , Object ) entry } ( & quot ; sith & quot ; , anakin ) ) ;
 * < / pre >
 * @ param entries the given entries .
 * @ return this assertion error .
 * @ throws AssertionError if the actual map is { @ code null } .
 * @ throws AssertionError if the actual { @ code Map } does not contain any of the given entries .
 * @ throws NullPointerException if the given array of entries is { @ code null } .
 * @ throws NullPointerException if any of the entries in the given array is { @ code null } . */
public @ NotNull MapAssert includes ( @ NotNull Entry ... entries ) { } }

implementation: isNotNull ( ) ; checkNotNull ( entries ) ; List < Entry > notFound = newArrayList ( ) ; for ( Entry e : entries ) { if ( ! containsEntry ( checkNotNull ( e ) ) ) { notFound . add ( e ) ; } } if ( ! notFound . isEmpty ( ) ) { failIfNotFound ( entryOrEntries ( notFound ) , notFound ) ; } return this ;


signature:
public class MapAssert { /** * Verifies that the actual { @ code Map } does not contain the given entries .
 * Example :
 * < pre >
 * / / static import org . fest . assertions . Assertions . * ;
 * / / static import org . fest . assertions . MapAssert . * ;
 * assertThat ( myMap ) . { @ link # excludes ( org . fest . assertions . MapAssert . Entry . . . ) excludes } ( { @ link # entry ( Object , Object ) entry } ( & quot ; jedi & quot ; , yoda ) , { @ link # entry ( Object , Object ) entry } ( & quot ; sith & quot ; , anakin ) ) ;
 * < / pre >
 * @ param entries the given entries .
 * @ return this assertion error .
 * @ throws AssertionError if the actual map is { @ code null } .
 * @ throws AssertionError if the actual { @ code Map } contains any of the given entries .
 * @ throws NullPointerException if the given array of entries is { @ code null } .
 * @ throws NullPointerException if any of the entries in the given array is { @ code null } . */
public @ NotNull MapAssert excludes ( @ NotNull Entry ... entries ) { } }

implementation: isNotNull ( ) ; checkNotNull ( entries ) ; List < Entry > found = newArrayList ( ) ; for ( Entry e : entries ) { if ( containsEntry ( checkNotNull ( e ) ) ) { found . add ( e ) ; } } if ( ! found . isEmpty ( ) ) { failIfFound ( entryOrEntries ( found ) , found ) ; } return this ;


signature:
public class ShortAssert { /** * Verifies that the actual { @ code Short } is greater than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Short } is not greater than the given one . */
public @ NotNull ShortAssert isGreaterThan ( short other ) { } }

implementation: if ( actual > other ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedLessThanOrEqualTo ( actual , other ) ) ;


signature:
public class ShortAssert { /** * Verifies that the actual { @ code Short } is less than the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Short } is not less than the given one . */
public @ NotNull ShortAssert isLessThan ( short other ) { } }

implementation: if ( actual < other ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedGreaterThanOrEqualTo ( actual , other ) ) ;


signature:
public class ShortAssert { /** * Verifies that the actual { @ code Short } is greater or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Short } is not greater than or equal to the given one . */
public @ NotNull ShortAssert isGreaterThanOrEqualTo ( short other ) { } }

implementation: if ( actual >= other ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedLessThan ( actual , other ) ) ;


signature:
public class ShortAssert { /** * Verifies that the actual { @ code Short } is less or equal to the given one .
 * @ param other the given value .
 * @ return this assertion object .
 * @ throws AssertionError if the actual { @ code Short } is not less than or equal to the given one . */
public @ NotNull ShortAssert isLessThanOrEqualTo ( short other ) { } }

implementation: if ( actual <= other ) { return this ; } failIfCustomMessageIsSet ( ) ; throw failure ( unexpectedGreaterThan ( actual , other ) ) ;