Configuration.SetupConfigRule

public static class Configuration.SetupConfigRule extends Object
implements TestRule

TestRule to initialize static Configuration object for unit tests.

For example:

 @Rule public ResetConfigRule resetConfig = new ResetConfigRule(); 
 @Rule public SetupConfigRule setupConfig = SetupConfigRule.uninitialized(); 

 @Test public void testSomething() {
     Properties configProperties = new Properties();
     configProperties.put("config.key1", "value1");
     setupConfig.initConfig(configProperties);
     // do test code using initialized configuration
     ...
   }
 

Public Method Summary

Statement
apply(Statement base, Description description)
void
initConfig(Properties properties)
static Configuration.SetupConfigRule

Inherited Method Summary

Public Methods

public Statement apply (Statement base, Description description)

Parameters
base
description

public void initConfig (Properties properties)

Parameters
properties

public static Configuration.SetupConfigRule uninitialized ()

Send feedback about...

Cloud Search
Cloud Search