// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java
// public class StubConfigSource implements ConfigSource {
// 
//     private final Map<Parameter, String> params;
// 
//     public StubConfigSource() {
//         this.params = new HashMap<Parameter, String>();
//     }
// 
//     public StubConfigSource add(String parameter, String value) {
//         params.put(new Parameter(parameter), value);
//         return this;
//     }
// 
//     @Override
//     public String getValue(Parameter parameter) {
//         return params.get(parameter);
//     }
// }
// 
// Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java
// public class DelegatingConfigSource implements ConfigSource {
// 
//     private final ConfigSource[] sources;
// 
//     /**
//      * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using
//      * the given component sources in preference order.
//      *
//      * @param sources  component {@link com.statemachinesystems.envy.ConfigSource}s in preference order
//      */
//     public DelegatingConfigSource(ConfigSource... sources) {
//         this.sources = sources;
//     }
// 
//     @Override
//     public String getValue(Parameter parameter) {
//         for (ConfigSource source : sources) {
//             String value = source.getValue(parameter);
//             if (value != null) {
//                 return value;
//             }
//         }
//         return null;
//     }
// }


import com.statemachinesystems.envy.common.StubConfigSource;
import com.statemachinesystems.envy.sources.DelegatingConfigSource;
import org.junit.Test;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
package com.statemachinesystems.envy;



public class DelegatingConfigSourceTest {

    @Test
    public void looksUpValuesInMultipleConfigSources() {
        ConfigSource source1 = new StubConfigSource().add("foo", "1");
        ConfigSource source2 = new StubConfigSource().add("bar", "2");
// Path: src/test/java/com/statemachinesystems/envy/common/StubConfigSource.java
// public class StubConfigSource implements ConfigSource {
// 
//     private final Map<Parameter, String> params;
// 
//     public StubConfigSource() {
//         this.params = new HashMap<Parameter, String>();
//     }
// 
//     public StubConfigSource add(String parameter, String value) {
//         params.put(new Parameter(parameter), value);
//         return this;
//     }
// 
//     @Override
//     public String getValue(Parameter parameter) {
//         return params.get(parameter);
//     }
// }
// 
// Path: src/main/java/com/statemachinesystems/envy/sources/DelegatingConfigSource.java
// public class DelegatingConfigSource implements ConfigSource {
// 
//     private final ConfigSource[] sources;
// 
//     /**
//      * Creates a {@link com.statemachinesystems.envy.sources.DelegatingConfigSource} using
//      * the given component sources in preference order.
//      *
//      * @param sources  component {@link com.statemachinesystems.envy.ConfigSource}s in preference order
//      */
//     public DelegatingConfigSource(ConfigSource... sources) {
//         this.sources = sources;
//     }
// 
//     @Override
//     public String getValue(Parameter parameter) {
//         for (ConfigSource source : sources) {
//             String value = source.getValue(parameter);
//             if (value != null) {
//                 return value;
//             }
//         }
//         return null;
//     }
// }


// Path: src/test/java/com/statemachinesystems/envy/DelegatingConfigSourceTest.java
import com.statemachinesystems.envy.common.StubConfigSource;
import com.statemachinesystems.envy.sources.DelegatingConfigSource;
import org.junit.Test;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;

package com.statemachinesystems.envy;



public class DelegatingConfigSourceTest {

    @Test
    public void looksUpValuesInMultipleConfigSources() {
        ConfigSource source1 = new StubConfigSource().add("foo", "1");
        ConfigSource source2 = new StubConfigSource().add("bar", "2");
        ConfigSource configSource = new DelegatingConfigSource(source1, source2);