// Path: hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/util/OverridableReadOnlyPropertiesImpl.java
// public class OverridableReadOnlyPropertiesImpl implements OverridableReadOnlyProperties {
// 
//     private List<Properties> propertieses;
// 
//     public OverridableReadOnlyPropertiesImpl(Properties... propertieses) {
//         this(Arrays.asList(propertieses));
//     }
// 
//     public OverridableReadOnlyPropertiesImpl(List<Properties> propertieses) {
//         if (propertieses == null || propertieses.size() == 0) {
//             throw new IllegalArgumentException("propertieses  can not be null.");
//         }
// 
//         if (propertieses.contains(null)) {
//             throw new IllegalArgumentException("propertieses can not contain null properties");
//         }
// 
//         this.propertieses = propertieses;
//     }
// 
//     @Override
//     public String getProperty(String key) {
//         return getProperty(key, null);
//     }
// 
//     @Override
//     public String getProperty(String key, String defaultValue) {
//         int size = propertieses.size();
//         for (int i = size - 1; i >= 0; i--) {
//             Properties properties = propertieses.get(i);
// 
//             String value = properties.getProperty(key);
//             if (value != null) {
//                 return value;
//             }
//         }
//         return defaultValue;
//     }
// 
//     @Override
//     public String getRequiredProperty(String key) {
//         String value = getProperty(key);
//         if (value == null) {
//             throw new IllegalStateException(key + " property is required!");
//         }
//         return value;
//     }
// }


import kr.pe.kwonnam.hibernate4memcached.util.OverridableReadOnlyPropertiesImpl;
import net.spy.memcached.auth.AuthDescriptor;
import net.spy.memcached.auth.PlainCallbackHandler;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Properties;
import static org.fest.assertions.api.Assertions.assertThat;
package kr.pe.kwonnam.hibernate4memcached.spymemcached.authdescriptorgenerator;




public class PlainAuthDescriptorGeneratorTest {
    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    private PlainAuthDescriptorGenerator generator;

    @Before
    public void setUp() throws Exception {
        generator = new PlainAuthDescriptorGenerator();
    }

    @Test
    public void generate_username_missing() throws Exception {
        expectedException.expect(IllegalStateException.class);

        Properties props = new Properties();
        props.setProperty(PlainAuthDescriptorGenerator.PASSWORD_PROPERTY_KEY, "password");

// Path: hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/util/OverridableReadOnlyPropertiesImpl.java
// public class OverridableReadOnlyPropertiesImpl implements OverridableReadOnlyProperties {
// 
//     private List<Properties> propertieses;
// 
//     public OverridableReadOnlyPropertiesImpl(Properties... propertieses) {
//         this(Arrays.asList(propertieses));
//     }
// 
//     public OverridableReadOnlyPropertiesImpl(List<Properties> propertieses) {
//         if (propertieses == null || propertieses.size() == 0) {
//             throw new IllegalArgumentException("propertieses  can not be null.");
//         }
// 
//         if (propertieses.contains(null)) {
//             throw new IllegalArgumentException("propertieses can not contain null properties");
//         }
// 
//         this.propertieses = propertieses;
//     }
// 
//     @Override
//     public String getProperty(String key) {
//         return getProperty(key, null);
//     }
// 
//     @Override
//     public String getProperty(String key, String defaultValue) {
//         int size = propertieses.size();
//         for (int i = size - 1; i >= 0; i--) {
//             Properties properties = propertieses.get(i);
// 
//             String value = properties.getProperty(key);
//             if (value != null) {
//                 return value;
//             }
//         }
//         return defaultValue;
//     }
// 
//     @Override
//     public String getRequiredProperty(String key) {
//         String value = getProperty(key);
//         if (value == null) {
//             throw new IllegalStateException(key + " property is required!");
//         }
//         return value;
//     }
// }


// Path: hibernate4-memcached-spymemcached-adapter/src/test/java/kr/pe/kwonnam/hibernate4memcached/spymemcached/authdescriptorgenerator/PlainAuthDescriptorGeneratorTest.java
import kr.pe.kwonnam.hibernate4memcached.util.OverridableReadOnlyPropertiesImpl;
import net.spy.memcached.auth.AuthDescriptor;
import net.spy.memcached.auth.PlainCallbackHandler;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Properties;
import static org.fest.assertions.api.Assertions.assertThat;

package kr.pe.kwonnam.hibernate4memcached.spymemcached.authdescriptorgenerator;




public class PlainAuthDescriptorGeneratorTest {
    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    private PlainAuthDescriptorGenerator generator;

    @Before
    public void setUp() throws Exception {
        generator = new PlainAuthDescriptorGenerator();
    }

    @Test
    public void generate_username_missing() throws Exception {
        expectedException.expect(IllegalStateException.class);

        Properties props = new Properties();
        props.setProperty(PlainAuthDescriptorGenerator.PASSWORD_PROPERTY_KEY, "password");

        generator.generate(new OverridableReadOnlyPropertiesImpl(props));