1/** 2 * Copyright (C) 2009 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.googlecode.guice; 18 19import com.google.inject.AbstractModule; 20import com.google.inject.Guice; 21import com.google.inject.Provides; 22 23import junit.framework.Test; 24import junit.framework.TestCase; 25 26import org.atinject.tck.Tck; 27import org.atinject.tck.auto.Car; 28import org.atinject.tck.auto.Convertible; 29import org.atinject.tck.auto.Drivers; 30import org.atinject.tck.auto.DriversSeat; 31import org.atinject.tck.auto.Engine; 32import org.atinject.tck.auto.FuelTank; 33import org.atinject.tck.auto.Seat; 34import org.atinject.tck.auto.Tire; 35import org.atinject.tck.auto.V8Engine; 36import org.atinject.tck.auto.accessories.Cupholder; 37import org.atinject.tck.auto.accessories.SpareTire; 38 39import javax.inject.Named; 40 41public class GuiceTck extends TestCase { 42 43 public static Test suite() { 44 return Tck.testsFor(Guice.createInjector(new AbstractModule() { 45 protected void configure() { 46 bind(Car.class).to(Convertible.class); 47 bind(Seat.class).annotatedWith(Drivers.class).to(DriversSeat.class); 48 bind(Engine.class).to(V8Engine.class); 49 bind(Cupholder.class); 50 bind(Tire.class); 51 bind(FuelTank.class); 52 requestStaticInjection(Convertible.class, SpareTire.class); 53 } 54 55 @Provides @Named("spare") Tire provideSpareTire(SpareTire spare) { 56 return spare; 57 } 58 }).getInstance(Car.class), true, true); 59 } 60} 61