Class MockSystemReader

java.lang.Object
org.eclipse.jgit.util.SystemReader
org.eclipse.jgit.junit.MockSystemReader

public class MockSystemReader extends org.eclipse.jgit.util.SystemReader
Mock SystemReader for tests.
  • Constructor Details

    • MockSystemReader

      public MockSystemReader()
      Constructor for MockSystemReader
  • Method Details

    • setUserGitConfig

      public org.eclipse.jgit.storage.file.FileBasedConfig setUserGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig userGitConfig)
      Set the user-level git config
      Parameters:
      userGitConfig - set another user-level git config
      Returns:
      the old user-level git config
      Since:
      5.1.9
    • setJGitConfig

      public void setJGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig jgitConfig)
      Set the jgit config stored at $XDG_CONFIG_HOME/jgit/config
      Parameters:
      jgitConfig - set the jgit configuration
      Since:
      5.5
    • setSystemGitConfig

      public org.eclipse.jgit.storage.file.FileBasedConfig setSystemGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig systemGitConfig)
      Set the system-level git config
      Parameters:
      systemGitConfig - the new system-level git config
      Returns:
      the old system-level config
      Since:
      5.1.9
    • clearProperties

      public void clearProperties()
      Clear properties
    • setProperty

      public void setProperty(String key, String value)
      Set a property
      Parameters:
      key - the key
      value - the value
    • getenv

      public String getenv(String variable)
      Specified by:
      getenv in class org.eclipse.jgit.util.SystemReader
    • getProperty

      public String getProperty(String key)
      Specified by:
      getProperty in class org.eclipse.jgit.util.SystemReader
    • openUserConfig

      public org.eclipse.jgit.storage.file.FileBasedConfig openUserConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs)
      Specified by:
      openUserConfig in class org.eclipse.jgit.util.SystemReader
    • openSystemConfig

      public org.eclipse.jgit.storage.file.FileBasedConfig openSystemConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs)
      Specified by:
      openSystemConfig in class org.eclipse.jgit.util.SystemReader
    • getUserConfig

      public org.eclipse.jgit.lib.StoredConfig getUserConfig() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
      Overrides:
      getUserConfig in class org.eclipse.jgit.util.SystemReader
      Throws:
      IOException
      org.eclipse.jgit.errors.ConfigInvalidException
    • getJGitConfig

      public org.eclipse.jgit.storage.file.FileBasedConfig getJGitConfig()
      Overrides:
      getJGitConfig in class org.eclipse.jgit.util.SystemReader
    • getSystemConfig

      public org.eclipse.jgit.lib.StoredConfig getSystemConfig() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException
      Overrides:
      getSystemConfig in class org.eclipse.jgit.util.SystemReader
      Throws:
      IOException
      org.eclipse.jgit.errors.ConfigInvalidException
    • getHostname

      public String getHostname()
      Specified by:
      getHostname in class org.eclipse.jgit.util.SystemReader
    • getCurrentTime

      public long getCurrentTime()
      Specified by:
      getCurrentTime in class org.eclipse.jgit.util.SystemReader
    • getClock

      public org.eclipse.jgit.util.time.MonotonicClock getClock()
      Overrides:
      getClock in class org.eclipse.jgit.util.SystemReader
    • tick

      public void tick(int secDelta)
      Adjusts the current time in seconds.
      Parameters:
      secDelta - number of seconds to add to the current time.
      Since:
      4.2
    • getTimezone

      public int getTimezone(long when)
      Specified by:
      getTimezone in class org.eclipse.jgit.util.SystemReader
    • getTimeZone

      public TimeZone getTimeZone()
      Overrides:
      getTimeZone in class org.eclipse.jgit.util.SystemReader
    • getTimeZoneId

      public ZoneId getTimeZoneId()
      Overrides:
      getTimeZoneId in class org.eclipse.jgit.util.SystemReader
    • getLocale

      public Locale getLocale()
      Overrides:
      getLocale in class org.eclipse.jgit.util.SystemReader
    • getSimpleDateFormat

      public SimpleDateFormat getSimpleDateFormat(String pattern)
      Overrides:
      getSimpleDateFormat in class org.eclipse.jgit.util.SystemReader
    • getDateTimeInstance

      public DateFormat getDateTimeInstance(int dateStyle, int timeStyle)
      Overrides:
      getDateTimeInstance in class org.eclipse.jgit.util.SystemReader
    • setCurrentPlatform

      public void setCurrentPlatform()
      Assign some properties for the currently executing platform
    • setWindows

      public void setWindows()
      Emulate Windows
    • setUnix

      public void setUnix()
      Emulate Unix
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • openJGitConfig

      public org.eclipse.jgit.storage.file.FileBasedConfig openJGitConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs)
      Specified by:
      openJGitConfig in class org.eclipse.jgit.util.SystemReader