// Path: src/main/java/org/laughingpanda/beaninject/Inject.java
// public class Inject {
// 
// 	/**
// 	 * Returns a target identifier that uses an injector that injects directly
// 	 * to a member field regardless of the field's visibility.
// 	 * 
// 	 * @param fieldName
// 	 *            The name of the field to inject.
// 	 */
// 	public static ITargetIdentifier field(final String fieldName) {
// 		return new ITargetIdentifier() {
// 			public IDependencyInjector of(final Object target) {
// 				return new FieldInjector(target, fieldName);
// 			}
// 		};
// 	}
// 
// 	public static ITargetIdentifier fieldAnnotatedWith(
// 			final Class<? extends Annotation> annotation) {
// 		return new ITargetIdentifier() {
// 			public IDependencyInjector of(Object target) {
// 				return new AnnotatedFieldInjector(target, annotation);
// 			}
// 		};
// 	}
// 
// 	public static IStaticTargetIdentifier staticField(final String fieldName) {
// 		return new IStaticTargetIdentifier() {
// 			public IDependencyInjector of(final Class<?> target) {
// 				return new StaticNamedFieldInjector(target, fieldName);
// 			}
// 		};
// 	}
// 
// 	/**
// 	 * Returns a target identifier that uses an injector that injects through a
// 	 * property setter method (regardless of the method's visibility).
// 	 * 
// 	 * @param propertyName
// 	 *            The name of the property to inject. E.g. "foo" where the
// 	 *            respective setter method's name is "setFoo".
// 	 */
// 	public static ITargetIdentifier property(final String propertyName) {
// 		return new ITargetIdentifier() {
// 			public IDependencyInjector of(Object target) {
// 				String methodName = "set"
// 						+ propertyName.substring(0, 1).toUpperCase()
// 						+ propertyName.substring(1);
// 				return new MethodInjector(target, methodName);
// 			}
// 		};
// 	}
// 
// 	public static ITargetIdentifier propertyAnnotatedWith(
// 			final Class<? extends Annotation> annotation) {
// 		return new ITargetIdentifier() {
// 			public IDependencyInjector of(Object target) {
// 				return new AnnotatedMethodInjector(target, annotation);
// 			}
// 		};
// 	}
// 
// 	/**
// 	 * Returns an injector implementation which uses the given dependency
// 	 * object's type to infer which setter/field to inject.
// 	 * 
// 	 * @param target
// 	 *            The target object for injection.
// 	 */
// 	public static IVarargDependencyInjector bean(final Object target) {
// 		return new AbstractVarargDependencyInjector() {
// 			public void with(Object... dependencies) {
// 				TypeBasedInjector injector = new TypeBasedInjector();
// 				for (Object dependency : dependencies) {
// 					injector.validateInjectionOf(target, dependency);
// 				}
// 				for (Object dependency : dependencies) {
// 					injector.inject(target, dependency);
// 				}
// 			}
// 		};
// 	}
// 
// 	/**
// 	 * Returns an injector implementation which delegates actual injection to
// 	 * the given strategy when provided with a target to inject.
// 	 * 
// 	 * @param strategy
// 	 *            The injection strategy.
// 	 */
// 	public static ITargetInjector with(final IInjectionStrategy strategy) {
// 		return new ITargetInjector() {
// 			public void bean(Object target) {
// 				strategy.inject(target);
// 			}
// 		};
// 	}
// 
// 	public static IDependencyInjector staticFieldOf(final Class<?> targetClass) {
// 		return new IDependencyInjector() {
// 			public void with(Object dependency) {
// 				new StaticTypedFieldInjector(targetClass).with(dependency);
// 			}
// 		};
// 	}
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import junit.framework.JUnit4TestAdapter;
import org.junit.Before;
import org.junit.Test;
import org.laughingpanda.beaninject.Inject;
/*
 * Copyright 2006 Lasse Koskela
 *
 * 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 org.laughingpanda.beaninject.example;



/**
 * @author Lasse Koskela
 */
public class TestExample {

    private Target target;

    public class Target {
        private String field;

        public void setPropertyName(String value) {
            this.field = value;
        }

        public String getPropertyName() {
            return field;
        }
    }

    public static junit.framework.Test suite() {
        return new JUnit4TestAdapter(TestExample.class);
    }

    @Before
    public void setUp() {
        target = new Target();
        assertNull(target.getPropertyName());
    }

    @Test
// Path: src/main/java/org/laughingpanda/beaninject/Inject.java
// public class Inject {
// 
// 	/**
// 	 * Returns a target identifier that uses an injector that injects directly
// 	 * to a member field regardless of the field's visibility.
// 	 * 
// 	 * @param fieldName
// 	 *            The name of the field to inject.
// 	 */
// 	public static ITargetIdentifier field(final String fieldName) {
// 		return new ITargetIdentifier() {
// 			public IDependencyInjector of(final Object target) {
// 				return new FieldInjector(target, fieldName);
// 			}
// 		};
// 	}
// 
// 	public static ITargetIdentifier fieldAnnotatedWith(
// 			final Class<? extends Annotation> annotation) {
// 		return new ITargetIdentifier() {
// 			public IDependencyInjector of(Object target) {
// 				return new AnnotatedFieldInjector(target, annotation);
// 			}
// 		};
// 	}
// 
// 	public static IStaticTargetIdentifier staticField(final String fieldName) {
// 		return new IStaticTargetIdentifier() {
// 			public IDependencyInjector of(final Class<?> target) {
// 				return new StaticNamedFieldInjector(target, fieldName);
// 			}
// 		};
// 	}
// 
// 	/**
// 	 * Returns a target identifier that uses an injector that injects through a
// 	 * property setter method (regardless of the method's visibility).
// 	 * 
// 	 * @param propertyName
// 	 *            The name of the property to inject. E.g. "foo" where the
// 	 *            respective setter method's name is "setFoo".
// 	 */
// 	public static ITargetIdentifier property(final String propertyName) {
// 		return new ITargetIdentifier() {
// 			public IDependencyInjector of(Object target) {
// 				String methodName = "set"
// 						+ propertyName.substring(0, 1).toUpperCase()
// 						+ propertyName.substring(1);
// 				return new MethodInjector(target, methodName);
// 			}
// 		};
// 	}
// 
// 	public static ITargetIdentifier propertyAnnotatedWith(
// 			final Class<? extends Annotation> annotation) {
// 		return new ITargetIdentifier() {
// 			public IDependencyInjector of(Object target) {
// 				return new AnnotatedMethodInjector(target, annotation);
// 			}
// 		};
// 	}
// 
// 	/**
// 	 * Returns an injector implementation which uses the given dependency
// 	 * object's type to infer which setter/field to inject.
// 	 * 
// 	 * @param target
// 	 *            The target object for injection.
// 	 */
// 	public static IVarargDependencyInjector bean(final Object target) {
// 		return new AbstractVarargDependencyInjector() {
// 			public void with(Object... dependencies) {
// 				TypeBasedInjector injector = new TypeBasedInjector();
// 				for (Object dependency : dependencies) {
// 					injector.validateInjectionOf(target, dependency);
// 				}
// 				for (Object dependency : dependencies) {
// 					injector.inject(target, dependency);
// 				}
// 			}
// 		};
// 	}
// 
// 	/**
// 	 * Returns an injector implementation which delegates actual injection to
// 	 * the given strategy when provided with a target to inject.
// 	 * 
// 	 * @param strategy
// 	 *            The injection strategy.
// 	 */
// 	public static ITargetInjector with(final IInjectionStrategy strategy) {
// 		return new ITargetInjector() {
// 			public void bean(Object target) {
// 				strategy.inject(target);
// 			}
// 		};
// 	}
// 
// 	public static IDependencyInjector staticFieldOf(final Class<?> targetClass) {
// 		return new IDependencyInjector() {
// 			public void with(Object dependency) {
// 				new StaticTypedFieldInjector(targetClass).with(dependency);
// 			}
// 		};
// 	}
// }


// Path: src/test/java/org/laughingpanda/beaninject/example/TestExample.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import junit.framework.JUnit4TestAdapter;
import org.junit.Before;
import org.junit.Test;
import org.laughingpanda.beaninject.Inject;

/*
 * Copyright 2006 Lasse Koskela
 *
 * 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 org.laughingpanda.beaninject.example;



/**
 * @author Lasse Koskela
 */
public class TestExample {

    private Target target;

    public class Target {
        private String field;

        public void setPropertyName(String value) {
            this.field = value;
        }

        public String getPropertyName() {
            return field;
        }
    }

    public static junit.framework.Test suite() {
        return new JUnit4TestAdapter(TestExample.class);
    }

    @Before
    public void setUp() {
        target = new Target();
        assertNull(target.getPropertyName());
    }

    @Test
    public void exampleOfInjectingWithSetter() throws Exception {