Interface KoraConfigModification

All Known Implementing Classes:
KoraConfigFile, KoraConfigString, KoraConfigSystemProperties

public interface KoraConfigModification
"application.conf" configuration modification for tests with system properties
  • Method Details

    • systemProperties

      @Nonnull Map<String,String> systemProperties()
    • withSystemProperty

      @Nonnull KoraConfigModification withSystemProperty(@Nonnull String key, @Nonnull String value)
      Example: Given config below
       
        myconfig {
            myinnerconfig {
                first = ${ENV_FIRST}
                second = ${ENV_SECOND}
            }
       }
       
       
      Use system property to set `ENV_FIRST` and 'ENV_SECOND'
       
       KoraConfigModification.ofString("""
                                    myconfig {
                                        myinnerconfig {
                                            first = ${ENV_FIRST}
                                            second = ${ENV_SECOND}
                                        }
                                    }
                                    """)
                                .withSystemProperty("ENV_FIRST", "1")
                                .withSystemProperty("ENV_SECOND", "2");
       
       
      Parameters:
      key - system property key
      value - system property value
      Returns:
      self
    • ofString

      @Nonnull static KoraConfigString ofString(@Nonnull String config)
      Example below:
       
       KoraConfigModification.ofString("""
                                    myconfig {
                                        myinnerconfig {
                                            first = 1
                                        }
                                    }
                                    """)
       
       
      Parameters:
      config - application configuration with config as string
      Returns:
      self
    • ofResourceFile

      @Nonnull static KoraConfigFile ofResourceFile(@Nonnull String configFile)
      File is located in "resources" directory than example below:
       
       KoraConfigModification.ofFile("reference-raw.conf")
       
       
      Parameters:
      configFile - application configuration with config file from "resources" directory
      Returns:
      self
    • ofSystemProperty

      @Nonnull static KoraConfigSystemProperties ofSystemProperty(@Nonnull String key, @Nonnull String value)
      Use system property to set `ENV_FIRST` and 'ENV_SECOND'
       
       KoraConfigModification.ofSystemProperty("ENV_FIRST", "1")
                            .withSystemProperty("ENV_SECOND", "2");
       
       
      Parameters:
      key - system property key
      value - system property value
      Returns:
      self