Class SimpleArgumentConverter

java.lang.Object
org.junit.jupiter.params.converter.SimpleArgumentConverter
All Implemented Interfaces:
ArgumentConverter
Direct Known Subclasses:
DefaultArgumentConverter

@API(status=STABLE,
     since="5.7")
public abstract class SimpleArgumentConverter
extends java.lang.Object
implements ArgumentConverter
SimpleArgumentConverter is an abstract base class for ArgumentConverter implementations.
Since:
5.0
See Also:
ArgumentConverter
  • Constructor Summary

    Constructors
    Constructor Description
    SimpleArgumentConverter()  
  • Method Summary

    Modifier and Type Method Description
    protected abstract java.lang.Object convert​(java.lang.Object source, java.lang.Class<?> targetType)
    Convert the supplied source object into the supplied targetType.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SimpleArgumentConverter

      public SimpleArgumentConverter()
  • Method Details

    • convert

      public final java.lang.Object convert​(java.lang.Object source, org.junit.jupiter.api.extension.ParameterContext context) throws ArgumentConversionException
      Description copied from interface: ArgumentConverter
      Convert the supplied source object according to the supplied context.
      Specified by:
      convert in interface ArgumentConverter
      Parameters:
      source - the source object to convert; may be null
      context - the parameter context where the converted object will be used; 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

      protected abstract java.lang.Object convert​(java.lang.Object source, java.lang.Class<?> targetType) throws ArgumentConversionException
      Convert the supplied source object into the supplied targetType.
      Parameters:
      source - the source object to convert; may be null
      targetType - the target type the source object should be converted into; never null
      Returns:
      the converted object; may be null but only if the target type is a reference type
      Throws:
      ArgumentConversionException - in case an error occurs during the conversion