// Path: src/test/java/com/codereligion/bugsnag/logback/integration/CustomMetaDataProvider.java
// public class CustomMetaDataProvider implements MetaDataProvider {
// 
//     @Override
//     public MetaDataVO provide(final ILoggingEvent loggingEvent) {
//         final MetaDataVO metaDataVO = new MetaDataVO();
//         metaDataVO.addToTab("Logging", "level", loggingEvent.getLevel().toString());
//         metaDataVO.addToTab("Logging", "message", loggingEvent.getMessage());
//         metaDataVO.addToTab("User", "password", loggingEvent.getMDCPropertyMap().get("password"));
//         return metaDataVO;
//     }
// }
// 
// Path: src/main/java/com/codereligion/bugsnag/logback/model/MetaDataVO.java
// public class MetaDataVO {
// 
//     private Map<String, TabVO> tabsByName = new HashMap<String, TabVO>();
// 
//     /**
//      * Adds the given {@code key}/{@code value} pair to the specified {@code tabName}.
//      *
//      * @param tabName the name of the tab to add the key/value pair
//      * @param key the key to map the {@code value} to
//      * @param value the value for the given {@code key}
//      * @return a reference of this object
//      */
//     public MetaDataVO addToTab(final String tabName, final String key, final Object value) {
//         getAndEnsureTabExistence(tabName).add(key, value);
//         return this;
//     }
// 
//     /**
//      * The underlying data structure of this object.
//      *
//      * @return a map of string to {@link TabVO}
//      */
//     public Map<String, TabVO> getTabsByName() {
//         return tabsByName;
//     }
// 
//     private TabVO getAndEnsureTabExistence(final String tabName) {
//         final TabVO tab = tabsByName.get(tabName);
//         final boolean tabDoesNotExist = tab == null;
//         if (tabDoesNotExist) {
//             final TabVO newTab = new TabVO();
//             tabsByName.put(tabName, newTab);
//             return newTab;
//         }
// 
//         return tab;
//     }
// }


import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.spi.ContextAware;
import com.codereligion.bugsnag.logback.integration.CustomMetaDataProvider;
import com.codereligion.bugsnag.logback.model.MetaDataVO;
import com.google.common.collect.Sets;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;

    @Test
    public void isInvalidWhenMetaDataProviderClassHasNoPublicDefaultConstructor() {
        configuration.setApiKey("someKey");
        configuration.setMetaDataProviderClassName(NoPublicDefaultConstructorMetaDataProvider.class.getName());
        assertThat(configuration.isInvalid(), is(true));
    }

    @Test
    public void isInvalidWhenMetaDataProviderClassDoesNotImplementMetaDataProvider() {
        configuration.setApiKey("someKey");
        configuration.setMetaDataProviderClassName(NoImplementationOfMetaDataProvider.class.getName());
        assertThat(configuration.isInvalid(), is(true));
    }

    @Test
    public void isValidWhenMetaProviderClassIsPresentAndLoadable() {
        configuration.setApiKey("someKey");
        configuration.setMetaDataProviderClassName(CustomMetaDataProvider.class.getCanonicalName());
        assertThat(configuration.isInvalid(), is(false));
    }

    @Test
    public void isValidWhenMetaProviderClassIsNotPresent() {
        configuration.setApiKey("someKey");
        configuration.setMetaDataProviderClassName(null);
        assertThat(configuration.isInvalid(), is(false));
    }


// Path: src/test/java/com/codereligion/bugsnag/logback/integration/CustomMetaDataProvider.java
// public class CustomMetaDataProvider implements MetaDataProvider {
// 
//     @Override
//     public MetaDataVO provide(final ILoggingEvent loggingEvent) {
//         final MetaDataVO metaDataVO = new MetaDataVO();
//         metaDataVO.addToTab("Logging", "level", loggingEvent.getLevel().toString());
//         metaDataVO.addToTab("Logging", "message", loggingEvent.getMessage());
//         metaDataVO.addToTab("User", "password", loggingEvent.getMDCPropertyMap().get("password"));
//         return metaDataVO;
//     }
// }
// 
// Path: src/main/java/com/codereligion/bugsnag/logback/model/MetaDataVO.java
// public class MetaDataVO {
// 
//     private Map<String, TabVO> tabsByName = new HashMap<String, TabVO>();
// 
//     /**
//      * Adds the given {@code key}/{@code value} pair to the specified {@code tabName}.
//      *
//      * @param tabName the name of the tab to add the key/value pair
//      * @param key the key to map the {@code value} to
//      * @param value the value for the given {@code key}
//      * @return a reference of this object
//      */
//     public MetaDataVO addToTab(final String tabName, final String key, final Object value) {
//         getAndEnsureTabExistence(tabName).add(key, value);
//         return this;
//     }
// 
//     /**
//      * The underlying data structure of this object.
//      *
//      * @return a map of string to {@link TabVO}
//      */
//     public Map<String, TabVO> getTabsByName() {
//         return tabsByName;
//     }
// 
//     private TabVO getAndEnsureTabExistence(final String tabName) {
//         final TabVO tab = tabsByName.get(tabName);
//         final boolean tabDoesNotExist = tab == null;
//         if (tabDoesNotExist) {
//             final TabVO newTab = new TabVO();
//             tabsByName.put(tabName, newTab);
//             return newTab;
//         }
// 
//         return tab;
//     }
// }


// Path: src/test/java/com/codereligion/bugsnag/logback/ConfigurationTest.java
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.spi.ContextAware;
import com.codereligion.bugsnag.logback.integration.CustomMetaDataProvider;
import com.codereligion.bugsnag.logback.model.MetaDataVO;
import com.google.common.collect.Sets;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;


    @Test
    public void isInvalidWhenMetaDataProviderClassHasNoPublicDefaultConstructor() {
        configuration.setApiKey("someKey");
        configuration.setMetaDataProviderClassName(NoPublicDefaultConstructorMetaDataProvider.class.getName());
        assertThat(configuration.isInvalid(), is(true));
    }

    @Test
    public void isInvalidWhenMetaDataProviderClassDoesNotImplementMetaDataProvider() {
        configuration.setApiKey("someKey");
        configuration.setMetaDataProviderClassName(NoImplementationOfMetaDataProvider.class.getName());
        assertThat(configuration.isInvalid(), is(true));
    }

    @Test
    public void isValidWhenMetaProviderClassIsPresentAndLoadable() {
        configuration.setApiKey("someKey");
        configuration.setMetaDataProviderClassName(CustomMetaDataProvider.class.getCanonicalName());
        assertThat(configuration.isInvalid(), is(false));
    }

    @Test
    public void isValidWhenMetaProviderClassIsNotPresent() {
        configuration.setApiKey("someKey");
        configuration.setMetaDataProviderClassName(null);
        assertThat(configuration.isInvalid(), is(false));
    }


    @Test