Interface ArgumentConverter

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.lang.Object convert​(java.lang.Object source, org.junit.jupiter.api.extension.ParameterContext context)
      Convert the supplied source object according to the supplied context.
      default java.lang.Object convert​(java.lang.Object source, FieldContext context)
      Convert the supplied source object according to the supplied context.
    • Method Detail

      • convert

        java.lang.Object convert​(java.lang.Object source,
                                 org.junit.jupiter.api.extension.ParameterContext context)
                          throws ArgumentConversionException
        Convert the supplied source object according to the supplied context.
        Parameters:
        source - the source object to convert; may be null
        context - the parameter context where the converted object will be supplied; never null
        Returns:
        the converted object; may be null but only if the target type is a reference type
        Throws:
        ArgumentConversionException - if an error occurs during the conversion
      • convert

        @API(status=MAINTAINED,
             since="5.13.3")
        default java.lang.Object convert​(java.lang.Object source,
                                         FieldContext context)
                                  throws ArgumentConversionException
        Convert the supplied source object according to the supplied context.
        Parameters:
        source - the source object to convert; may be null
        context - the field context where the converted object will be injected; never null
        Returns:
        the converted object; may be null but only if the target type is a reference type
        Throws:
        ArgumentConversionException - if an error occurs during the conversion
        Since:
        5.13