1 /*
2 * Grapht, an open source dependency injector.
3 * Copyright 2014-2015 various contributors (see CONTRIBUTORS.txt)
4 * Copyright 2010-2014 Regents of the University of Minnesota
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 * details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 51
18 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20 package org.grouplens.grapht;
21
22 import junit.framework.Test;
23 import junit.framework.TestCase;
24 import org.atinject.tck.Tck;
25 import org.atinject.tck.auto.*;
26 import org.atinject.tck.auto.accessories.SpareTire;
27
28 public class TckTest extends TestCase {
29
30 public static Test suite() throws InjectionException {
31 InjectorBuilder ib = InjectorBuilder.create()
32 .setDefaultCachePolicy(CachePolicy.NEW_INSTANCE)
33 .setProviderInjectionEnabled(true);
34
35 ib.bind(Car.class).to(Convertible.class);
36 ib.bind(Seat.class).withQualifier(Drivers.class).to(DriversSeat.class);
37 ib.bind(Seat.class).to(Seat.class);
38 ib.bind(Tire.class).to(Tire.class);
39 ib.bind(Engine.class).to(V8Engine.class);
40 ib.bind(Tire.class).withQualifier(Names.named("spare")).to(SpareTire.class);
41
42 Car car = ib.build().getInstance(Car.class);
43
44 // Support for private methods, but no support for static methods,
45 // that doesn't make sense with grapht's design principles
46 return Tck.testsFor(car, false, true);
47 }
48 }