// Path: test/weld/guiceconfig/AbstractGuiceConfigTest.java
// public abstract class AbstractGuiceConfigTest extends TestCase {
// 
//     protected BeanManager manager;
// 
//     Weld weld;
// 
//     protected abstract Iterable<? extends Module> getModules();
// 
//     @Override
//     public void setUp() {
//         GuiceConfigTestModule.register(getModules());
//         weld = new Weld();
//         WeldContainer container = weld.initialize();
//         manager = container.getBeanManager();
//     }
// 
//     @Override
//     public void tearDown() {
//         weld.shutdown();
//     }
// 
//     public <T> T getReference(Class<T> clazz, Annotation... bindings) {
//         Set<Bean<?>> beans = manager.getBeans(clazz, bindings);
//         if (beans.isEmpty()) {
//             throw new RuntimeException("No bean found with class: " + clazz + " and bindings " + bindings.toString());
//         } else if (beans.size() != 1) {
//             StringBuilder bs = new StringBuilder("[");
//             for (Annotation a : bindings) {
//                 bs.append(a.toString() + ",");
//             }
//             bs.append("]");
//             throw new RuntimeException("More than one bean found with class: " + clazz + " and bindings " + bs);
//         }
//         Bean bean = beans.iterator().next();
//         return (T) bean.create(manager.createCreationalContext(bean));
//     }
// 
// }
// 
// Path: test/weld/guiceconfig/world/AsynchronousMailer.java
// public class AsynchronousMailer implements Mailer {
//     @Override
//     public void sendMail(String recipient, String subject, String content) {
// 
//     }
// }
// 
// Path: test/weld/guiceconfig/world/Mailer.java
// @CustomQualifier
// public interface Mailer {
// 
//     void sendMail(String recipient, String subject, String content);
// 
// }


import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.matcher.AbstractMatcher;
import com.google.inject.matcher.Matchers;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import weld.guiceconfig.AbstractGuiceConfigTest;
import weld.guiceconfig.world.AsynchronousMailer;
import weld.guiceconfig.world.Mailer;
import javax.inject.Singleton;
import java.lang.reflect.Method;
import java.util.Arrays;
/*
 * Copyright (C) 2010 Alen Vrecko
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package weld.guiceconfig.basics;



/**
 * Tests basic linked binding and aop.
 *
 * @author Alen Vrecko
 */
public class BasicTest extends AbstractGuiceConfigTest {

    private static final String AOPED = "AOPED";

    @Override
    protected Iterable<? extends Module> getModules() {
        return Arrays.asList(new AbstractModule() {
            @Override
            protected void configure() {
// Path: test/weld/guiceconfig/AbstractGuiceConfigTest.java
// public abstract class AbstractGuiceConfigTest extends TestCase {
// 
//     protected BeanManager manager;
// 
//     Weld weld;
// 
//     protected abstract Iterable<? extends Module> getModules();
// 
//     @Override
//     public void setUp() {
//         GuiceConfigTestModule.register(getModules());
//         weld = new Weld();
//         WeldContainer container = weld.initialize();
//         manager = container.getBeanManager();
//     }
// 
//     @Override
//     public void tearDown() {
//         weld.shutdown();
//     }
// 
//     public <T> T getReference(Class<T> clazz, Annotation... bindings) {
//         Set<Bean<?>> beans = manager.getBeans(clazz, bindings);
//         if (beans.isEmpty()) {
//             throw new RuntimeException("No bean found with class: " + clazz + " and bindings " + bindings.toString());
//         } else if (beans.size() != 1) {
//             StringBuilder bs = new StringBuilder("[");
//             for (Annotation a : bindings) {
//                 bs.append(a.toString() + ",");
//             }
//             bs.append("]");
//             throw new RuntimeException("More than one bean found with class: " + clazz + " and bindings " + bs);
//         }
//         Bean bean = beans.iterator().next();
//         return (T) bean.create(manager.createCreationalContext(bean));
//     }
// 
// }
// 
// Path: test/weld/guiceconfig/world/AsynchronousMailer.java
// public class AsynchronousMailer implements Mailer {
//     @Override
//     public void sendMail(String recipient, String subject, String content) {
// 
//     }
// }
// 
// Path: test/weld/guiceconfig/world/Mailer.java
// @CustomQualifier
// public interface Mailer {
// 
//     void sendMail(String recipient, String subject, String content);
// 
// }


// Path: test/weld/guiceconfig/basics/BasicTest.java
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.matcher.AbstractMatcher;
import com.google.inject.matcher.Matchers;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import weld.guiceconfig.AbstractGuiceConfigTest;
import weld.guiceconfig.world.AsynchronousMailer;
import weld.guiceconfig.world.Mailer;
import javax.inject.Singleton;
import java.lang.reflect.Method;
import java.util.Arrays;

/*
 * Copyright (C) 2010 Alen Vrecko
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package weld.guiceconfig.basics;



/**
 * Tests basic linked binding and aop.
 *
 * @author Alen Vrecko
 */
public class BasicTest extends AbstractGuiceConfigTest {

    private static final String AOPED = "AOPED";

    @Override
    protected Iterable<? extends Module> getModules() {
        return Arrays.asList(new AbstractModule() {
            @Override
            protected void configure() {
                bind(Mailer.class).to(AsynchronousMailer.class).in(Singleton.class);