// Path: Proton/src/main/java/proton/inject/ConfigurationException.java
// public class ConfigurationException extends ProtonRuntimeException {
//     private static final long serialVersionUID = 1171685360550055388L;
// 
//     public ConfigurationException() {
//         super();
//     }
// 
//     public ConfigurationException(String detailMessage, Throwable throwable) {
//         super(detailMessage, throwable);
//     }
// 
//     public ConfigurationException(String detailMessage) {
//         super(detailMessage);
//     }
// 
//     public ConfigurationException(Throwable throwable) {
//         super(throwable);
//     }
// }
// 
// Path: Proton/src/main/java/proton/inject/binding/BindingBuilderImpl.java
// public class BindingBuilderImpl<T> implements BindingBuilder<T> {
//     private final Binding<T> mBinding;
//     private final Bindings mBindings;
// 
//     public BindingBuilderImpl(Class<T> clazz, Bindings bindings) {
//         mBinding = new Binding<T>(clazz);
//         mBindings = bindings;
// 
//         mBindings.register(mBinding);
// 
//         if (!InjectorUtils.isAbstract(clazz)) {
//             setScope(clazz);
//             validateAnnotation(clazz);
//         }
//     }
// 
//     @Override
//     public ScopedBuilder to(Class<? extends T> to) {
//         mBinding.setToClass(checkNotNull(to, "to"));
//         setScope(to);
//         validateAnnotation(to);
//         return this;
//     }
// 
//     @Override
//     public ScopedBuilder toProvider(Class<? extends Provider<T>> provider) {
//         mBinding.setProviderClass(checkNotNull(provider, "provider"));
//         setScope(InjectorUtils.toActualClass(provider));
//         validateAnnotation(provider);
//         return this;
//     }
// 
//     @Override
//     public void toProvider(Provider<T> provider) {
//         mBinding.setProvider(checkNotNull(provider, "provider"));
//         mBinding.setScope(ApplicationScoped.class);
//         validateAnnotation(provider.getClass());
//     }
// 
//     @Override
//     public void in(Class<? extends Annotation> scope) {
//         mBinding.setScope(checkNotNull(scope, "scope"));
//     }
// 
//     private void setScope(Class<?> clazz) {
//         Annotation[] anns = clazz.getAnnotations();
//         for (Annotation ann : anns) {
//             if (ApplicationScoped.class.isInstance(ann) || Dependent.class.isInstance(ann)
//                     || ContextScoped.class.isInstance(ann))
//                 mBinding.setScope(ann.annotationType());
//         }
//     }
// 
//     private void validateAnnotation(Class<?> clazz) {
//         AndroidVersion version = clazz.getAnnotation(AndroidVersion.class);
//         if (version != null && Build.VERSION.SDK_INT < version.value())
//             mBindings.unregister(mBinding);
// 
//         DeviceModel model = clazz.getAnnotation(DeviceModel.class);
//         if (model != null && !Build.MODEL.equals(model.value()))
//             mBindings.unregister(mBinding);
//     }
// 
//     private <I> I checkNotNull(I obj, String msg) {
//         if (obj == null)
//             throw new ConfigurationException(msg);
//         return obj;
//     }
// }
// 
// Path: Proton/src/main/java/proton/inject/binding/Bindings.java
// public class Bindings {
//     private SparseClassArray<Binding<?>> mBindings = new SparseClassArray<Binding<?>>();
// 
//     public <T> void register(Binding<T> binding) {
//         mBindings.put(binding.getBindClass(), binding);
//     }
// 
//     public <T> void unregister(Binding<T> binding) {
//         mBindings.remove(binding.getBindClass());
//     }
// 
//     @SuppressWarnings("unchecked")
//     public <T> Binding<T> get(Class<T> key) {
//         return (Binding<T>) mBindings.get(key);
//     }
// }


import javax.inject.Provider;
import proton.inject.ConfigurationException;
import proton.inject.binding.AndroidVersion;
import proton.inject.binding.BindingBuilderImpl;
import proton.inject.binding.Bindings;
import proton.inject.binding.DeviceModel;
import proton.inject.scope.ApplicationScoped;
import proton.inject.scope.Dependent;
import android.test.AndroidTestCase;
	public void testToProviderClassWithNull() {
		try {
			new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).toProvider((Class) null);
			fail();
		} catch (ConfigurationException exp) {
		}
	}

	public void testToProviderProviderOfT() {
		Provider<Aaa> p = new AaaProvider();
		new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).toProvider(p);
		assertEquals(p, mBindings.get(Aaa.class).getProvider());
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void testToProviderWithNull() {
		try {
			new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).toProvider((Provider) null);
			fail();
		} catch (ConfigurationException exp) {
		}
	}

	public void testIn() {
		new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).in(ApplicationScoped.class);
		assertEquals(ApplicationScoped.class, mBindings.get(Aaa.class).getScope());
	}

	public void testInWithNull() {
		try {
// Path: Proton/src/main/java/proton/inject/ConfigurationException.java
// public class ConfigurationException extends ProtonRuntimeException {
//     private static final long serialVersionUID = 1171685360550055388L;
// 
//     public ConfigurationException() {
//         super();
//     }
// 
//     public ConfigurationException(String detailMessage, Throwable throwable) {
//         super(detailMessage, throwable);
//     }
// 
//     public ConfigurationException(String detailMessage) {
//         super(detailMessage);
//     }
// 
//     public ConfigurationException(Throwable throwable) {
//         super(throwable);
//     }
// }
// 
// Path: Proton/src/main/java/proton/inject/binding/BindingBuilderImpl.java
// public class BindingBuilderImpl<T> implements BindingBuilder<T> {
//     private final Binding<T> mBinding;
//     private final Bindings mBindings;
// 
//     public BindingBuilderImpl(Class<T> clazz, Bindings bindings) {
//         mBinding = new Binding<T>(clazz);
//         mBindings = bindings;
// 
//         mBindings.register(mBinding);
// 
//         if (!InjectorUtils.isAbstract(clazz)) {
//             setScope(clazz);
//             validateAnnotation(clazz);
//         }
//     }
// 
//     @Override
//     public ScopedBuilder to(Class<? extends T> to) {
//         mBinding.setToClass(checkNotNull(to, "to"));
//         setScope(to);
//         validateAnnotation(to);
//         return this;
//     }
// 
//     @Override
//     public ScopedBuilder toProvider(Class<? extends Provider<T>> provider) {
//         mBinding.setProviderClass(checkNotNull(provider, "provider"));
//         setScope(InjectorUtils.toActualClass(provider));
//         validateAnnotation(provider);
//         return this;
//     }
// 
//     @Override
//     public void toProvider(Provider<T> provider) {
//         mBinding.setProvider(checkNotNull(provider, "provider"));
//         mBinding.setScope(ApplicationScoped.class);
//         validateAnnotation(provider.getClass());
//     }
// 
//     @Override
//     public void in(Class<? extends Annotation> scope) {
//         mBinding.setScope(checkNotNull(scope, "scope"));
//     }
// 
//     private void setScope(Class<?> clazz) {
//         Annotation[] anns = clazz.getAnnotations();
//         for (Annotation ann : anns) {
//             if (ApplicationScoped.class.isInstance(ann) || Dependent.class.isInstance(ann)
//                     || ContextScoped.class.isInstance(ann))
//                 mBinding.setScope(ann.annotationType());
//         }
//     }
// 
//     private void validateAnnotation(Class<?> clazz) {
//         AndroidVersion version = clazz.getAnnotation(AndroidVersion.class);
//         if (version != null && Build.VERSION.SDK_INT < version.value())
//             mBindings.unregister(mBinding);
// 
//         DeviceModel model = clazz.getAnnotation(DeviceModel.class);
//         if (model != null && !Build.MODEL.equals(model.value()))
//             mBindings.unregister(mBinding);
//     }
// 
//     private <I> I checkNotNull(I obj, String msg) {
//         if (obj == null)
//             throw new ConfigurationException(msg);
//         return obj;
//     }
// }
// 
// Path: Proton/src/main/java/proton/inject/binding/Bindings.java
// public class Bindings {
//     private SparseClassArray<Binding<?>> mBindings = new SparseClassArray<Binding<?>>();
// 
//     public <T> void register(Binding<T> binding) {
//         mBindings.put(binding.getBindClass(), binding);
//     }
// 
//     public <T> void unregister(Binding<T> binding) {
//         mBindings.remove(binding.getBindClass());
//     }
// 
//     @SuppressWarnings("unchecked")
//     public <T> Binding<T> get(Class<T> key) {
//         return (Binding<T>) mBindings.get(key);
//     }
// }


// Path: Proton/src/instrumentTest/java/proton/inject/binding/BindingBuilderImplTest.java
import javax.inject.Provider;
import proton.inject.ConfigurationException;
import proton.inject.binding.AndroidVersion;
import proton.inject.binding.BindingBuilderImpl;
import proton.inject.binding.Bindings;
import proton.inject.binding.DeviceModel;
import proton.inject.scope.ApplicationScoped;
import proton.inject.scope.Dependent;
import android.test.AndroidTestCase;

	public void testToProviderClassWithNull() {
		try {
			new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).toProvider((Class) null);
			fail();
		} catch (ConfigurationException exp) {
		}
	}

	public void testToProviderProviderOfT() {
		Provider<Aaa> p = new AaaProvider();
		new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).toProvider(p);
		assertEquals(p, mBindings.get(Aaa.class).getProvider());
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void testToProviderWithNull() {
		try {
			new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).toProvider((Provider) null);
			fail();
		} catch (ConfigurationException exp) {
		}
	}

	public void testIn() {
		new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).in(ApplicationScoped.class);
		assertEquals(ApplicationScoped.class, mBindings.get(Aaa.class).getScope());
	}

	public void testInWithNull() {
		try {
			new BindingBuilderImpl<Aaa>(Aaa.class, mBindings).in(null);