public interface AndHowTestInit extends AndHowInit
Only place implementations of this interface on the test classpath.
If an AndHowTestInit implementation is on the classpath,
it will be used in preference to AndHowInit to allow a test configuration to take
precedence over the production configuration. Implementation example, where config values
for a local test db are hardcoded into the configuration:
public class TestInitiation implements AndHowTestInit {
@Override
public AndHowConfiguration getConfiguration() {
return AndHow.findConfig()
.addFixedValue("com.bigcorp.config.DB_URL", "jdbc://local.db")
.addFixedValue("com.bigcorp.config.DB_PWD", "changeme");
}
}
It is a fatal RuntimeException for there to be more than one AndHowTestInit on the
classpath since this would make startup configuration ambiguous.
getConfigurationCopyright © 2022. All rights reserved.