Class TestSystemWrapper

  • All Implemented Interfaces:
    SystemWrapper

    @Singleton
    @Alternative
    @Priority(2010)
    public class TestSystemWrapper
    extends Object
    implements SystemWrapper
    Default implementation that is nothing more than a delegate of System class.
    Author:
    Yohann Chastagnier
    • Constructor Detail

      • TestSystemWrapper

        public TestSystemWrapper()
    • Method Detail

      • setupDefaultParameters

        @PostConstruct
        public void setupDefaultParameters()
      • initFor

        public void initFor​(Object testInstance)
      • getenv

        public String getenv​(String name)
        Description copied from interface: SystemWrapper
        Gets the value of a environment variable.
        Specified by:
        getenv in interface SystemWrapper
        Parameters:
        name - the name of the variable.
        Returns:
        the value of the requested environment variable.
      • setProperty

        public String setProperty​(String key,
                                  String value)
        Description copied from interface: SystemWrapper
        Sets a new system property. If the property isn't valued, id est has a null or an empty value, then it is not set. Only non-null and not empty property can be set.
        Specified by:
        setProperty in interface SystemWrapper
        Parameters:
        key - the key of the property.
        value - a non-null and non-empty value of the property.
        Returns:
        the previous value of the system property, or null if it did not have one or if the property to set isn't valid.
        See Also:
        System.setProperty(String, String)
      • getProperty

        public String getProperty​(String key)
        Description copied from interface: SystemWrapper
        Gets a system property.
        Specified by:
        getProperty in interface SystemWrapper
        Parameters:
        key - the key of the system property.
        Returns:
        the string value of the system property, or null if there is no property with that key.
      • getProperty

        public String getProperty​(String key,
                                  String def)
        Description copied from interface: SystemWrapper
        Gets a system property.
        Specified by:
        getProperty in interface SystemWrapper
        Parameters:
        key - the key of the system property.
        def - the default value if there is no property value with the key.
        Returns:
        the string value of the system property, or the default value if there is no property with that key.