1 /**
2  * Copyright (C) 2006 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 
17 package com.google.inject;
18 
19 import com.google.common.collect.ImmutableSet;
20 import com.google.inject.internal.MoreTypesTest;
21 import com.google.inject.internal.UniqueAnnotationsTest;
22 import com.google.inject.internal.WeakKeySetTest;
23 import com.google.inject.internal.util.LineNumbersTest;
24 import com.google.inject.matcher.MatcherTest;
25 import com.google.inject.name.NamedEquivalanceTest;
26 import com.google.inject.name.NamesTest;
27 import com.google.inject.spi.BindingTargetVisitorTest;
28 import com.google.inject.spi.ElementApplyToTest;
29 import com.google.inject.spi.ElementSourceTest;
30 import com.google.inject.spi.ElementsTest;
31 import com.google.inject.spi.HasDependenciesTest;
32 import com.google.inject.spi.InjectionPointTest;
33 import com.google.inject.spi.InjectorSpiTest;
34 import com.google.inject.spi.ModuleAnnotatedMethodScannerTest;
35 import com.google.inject.spi.ModuleRewriterTest;
36 import com.google.inject.spi.ModuleSourceTest;
37 import com.google.inject.spi.ProviderMethodsTest;
38 import com.google.inject.spi.SpiBindingsTest;
39 import com.google.inject.spi.ToolStageInjectorTest;
40 import com.google.inject.util.NoopOverrideTest;
41 import com.google.inject.util.OverrideModuleTest;
42 import com.google.inject.util.ProvidersTest;
43 import com.google.inject.util.TypesTest;
44 
45 import com.googlecode.guice.GuiceTck;
46 import com.googlecode.guice.Jsr330Test;
47 
48 import junit.framework.Test;
49 import junit.framework.TestSuite;
50 
51 import java.util.Set;
52 
53 /**
54  * @author crazybob@google.com (Bob Lee)
55  */
56 public class AllTests {
57 
58   private static final Set<String> SUPPRESSED_TEST_NAMES = ImmutableSet.of(
59       "testUnscopedProviderWorksOutsideOfRequestedScope(" + ScopesTest.class.getName() + ")",
60       "testCannotConvertUnannotatedBindings(" + TypeConversionTest.class.getName() + ")"
61   );
62 
suite()63   public static Test suite() {
64     TestSuite suite = new TestSuite();
65 
66     suite.addTest(GuiceTck.suite());
67     suite.addTestSuite(BinderTest.class);
68     suite.addTest(BinderTestSuite.suite());
69     suite.addTestSuite(BindingAnnotationTest.class);
70     suite.addTestSuite(BindingOrderTest.class);
71     suite.addTestSuite(BindingTest.class);
72     suite.addTestSuite(BoundInstanceInjectionTest.class);
73     suite.addTestSuite(BoundProviderTest.class);
74     suite.addTestSuite(CircularDependencyTest.class);
75     suite.addTestSuite(DuplicateBindingsTest.class);
76     // ErrorHandlingTest.class is not a testcase
77     suite.addTestSuite(EagerSingletonTest.class);
78     suite.addTestSuite(GenericInjectionTest.class);
79     suite.addTestSuite(ImplicitBindingTest.class);
80     suite.addTestSuite(TypeListenerTest.class);
81     suite.addTestSuite(InjectorTest.class);
82     suite.addTestSuite(JitBindingsTest.class);
83     // IntegrationTest is AOP-only
84     suite.addTestSuite(KeyTest.class);
85     suite.addTestSuite(LoggerInjectionTest.class);
86     // MethodInterceptionTest is AOP-only
87     suite.addTestSuite(MembersInjectorTest.class);
88     suite.addTestSuite(ModulesTest.class);
89     suite.addTestSuite(ModuleTest.class);
90     suite.addTestSuite(ModuleAnnotatedMethodScannerTest.class);
91     suite.addTestSuite(NullableInjectionPointTest.class);
92     suite.addTestSuite(OptionalBindingTest.class);
93     suite.addTestSuite(OverrideModuleTest.class);
94     suite.addTestSuite(ParentInjectorTest.class);
95     suite.addTestSuite(PrivateModuleTest.class);
96     suite.addTestSuite(ProviderInjectionTest.class);
97     suite.addTestSuite(ProvisionExceptionTest.class);
98     suite.addTestSuite(ProvisionListenerTest.class);
99     // ProxyFactoryTest is AOP-only
100     suite.addTestSuite(ReflectionTest.class);
101     suite.addTestSuite(RequestInjectionTest.class);
102     suite.addTestSuite(RequireAtInjectOnConstructorsTest.class);
103     suite.addTestSuite(ScopesTest.class);
104     suite.addTestSuite(SerializationTest.class);
105     suite.addTestSuite(SuperclassTest.class);
106     suite.addTestSuite(TypeConversionTest.class);
107     suite.addTestSuite(TypeLiteralInjectionTest.class);
108     suite.addTestSuite(TypeLiteralTest.class);
109     suite.addTestSuite(TypeLiteralTypeResolutionTest.class);
110     suite.addTestSuite(WeakKeySetTest.class);
111 
112     // internal
113     suite.addTestSuite(LineNumbersTest.class);
114     suite.addTestSuite(MoreTypesTest.class);
115     suite.addTestSuite(UniqueAnnotationsTest.class);
116 
117     // matcher
118     suite.addTestSuite(MatcherTest.class);
119 
120     // names
121     suite.addTestSuite(NamesTest.class);
122     suite.addTestSuite(NamedEquivalanceTest.class);
123 
124     // spi
125     suite.addTestSuite(BindingTargetVisitorTest.class);
126     suite.addTestSuite(ElementsTest.class);
127     suite.addTestSuite(ElementApplyToTest.class);
128     suite.addTestSuite(HasDependenciesTest.class);
129     suite.addTestSuite(InjectionPointTest.class);
130     suite.addTestSuite(InjectorSpiTest.class);
131     suite.addTestSuite(ModuleRewriterTest.class);
132     suite.addTestSuite(ProviderMethodsTest.class);
133     suite.addTestSuite(SpiBindingsTest.class);
134     suite.addTestSuite(ToolStageInjectorTest.class);
135     suite.addTestSuite(ModuleSourceTest.class);
136     suite.addTestSuite(ElementSourceTest.class);
137 
138     // tools
139     // suite.addTestSuite(JmxTest.class); not a testcase
140 
141     // util
142     suite.addTestSuite(NoopOverrideTest.class);
143     suite.addTestSuite(ProvidersTest.class);
144     suite.addTestSuite(TypesTest.class);
145 
146     /*if[AOP]*/
147     suite.addTestSuite(com.google.inject.internal.ProxyFactoryTest.class);
148     suite.addTestSuite(IntegrationTest.class);
149     suite.addTestSuite(MethodInterceptionTest.class);
150     suite.addTestSuite(com.googlecode.guice.BytecodeGenTest.class);
151     /*end[AOP]*/
152 
153     // googlecode.guice
154     suite.addTestSuite(com.googlecode.guice.OSGiContainerTest.class);
155     suite.addTestSuite(Jsr330Test.class);
156 
157     return SuiteUtils.removeSuppressedTests(suite, SUPPRESSED_TEST_NAMES);
158   }
159 }
160