blob: 1d32f7889fb9cf1295e720a27a4230ba0647ef53 [file] [log] [blame]
crazyboblee66b415a2006-08-25 02:01:19 +00001/**
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
17package com.google.inject;
18
limpbizkit6663d022008-06-19 07:57:55 +000019import com.google.inject.internal.FinalizableReferenceQueueTest;
limpbizkit9f17f4f2009-05-19 01:49:41 +000020import com.google.inject.internal.ImmutableSet;
limpbizkitbf0d8762009-02-19 09:06:22 +000021import com.google.inject.internal.Jsr166HashMapTest;
limpbizkit6663d022008-06-19 07:57:55 +000022import com.google.inject.internal.LineNumbersTest;
crazyboblee210bf432009-02-05 06:04:18 +000023import com.google.inject.internal.MapMakerTestSuite;
limpbizkit6663d022008-06-19 07:57:55 +000024import com.google.inject.internal.UniqueAnnotationsTest;
crazyboblee4f79e402007-02-14 02:11:47 +000025import com.google.inject.matcher.MatcherTest;
limpbizkitf9e26582008-12-09 18:45:13 +000026import com.google.inject.name.NamesTest;
limpbizkitaa07ab02009-05-15 07:10:43 +000027import com.google.inject.spi.BindingTargetVisitorTest;
limpbizkit9f17f4f2009-05-19 01:49:41 +000028import com.google.inject.spi.ElementApplyToTest;
limpbizkit477f9f92008-07-28 07:05:14 +000029import com.google.inject.spi.ElementsTest;
limpbizkit76c24b12008-12-25 04:32:41 +000030import com.google.inject.spi.HasDependenciesTest;
limpbizkitb3a8f0b2008-09-05 22:30:40 +000031import com.google.inject.spi.InjectionPointTest;
limpbizkit477f9f92008-07-28 07:05:14 +000032import com.google.inject.spi.ModuleRewriterTest;
limpbizkitb3a8f0b2008-09-05 22:30:40 +000033import com.google.inject.spi.ProviderMethodsTest;
limpbizkit477f9f92008-07-28 07:05:14 +000034import com.google.inject.spi.SpiBindingsTest;
limpbizkit9f17f4f2009-05-19 01:49:41 +000035import com.google.inject.util.NoopOverrideTest;
kevinb9n36500812007-05-15 18:53:41 +000036import com.google.inject.util.ProvidersTest;
limpbizkit3beaaaf2008-06-10 06:37:12 +000037import com.google.inject.util.TypesTest;
limpbizkit9f17f4f2009-05-19 01:49:41 +000038import java.util.Enumeration;
39import java.util.Set;
crazyboblee66b415a2006-08-25 02:01:19 +000040import junit.framework.Test;
41import junit.framework.TestSuite;
42
43/**
44 * @author crazybob@google.com (Bob Lee)
45 */
46public class AllTests {
47
limpbizkit9f17f4f2009-05-19 01:49:41 +000048 private static final Set<String> SUPPRESSED_TEST_NAMES = ImmutableSet.of(
49 "testCircularlyDependentMultipleWays(" + CircularDependencyTest.class.getName() + ")",
50 "testUnscopedProviderWorksOutsideOfRequestedScope(" + ScopesTest.class.getName() + ")",
51 "testNullScopedAsASingleton(" + ScopesTest.class.getName() + ")",
52 "testCannotConvertUnannotatedBindings(" + TypeConversionTest.class.getName() + ")"
53 );
54
crazyboblee66b415a2006-08-25 02:01:19 +000055 public static Test suite() {
56 TestSuite suite = new TestSuite();
57
crazyboblee7bef6222007-05-08 20:49:31 +000058 suite.addTestSuite(BinderTest.class);
limpbizkitff295522008-08-25 07:54:48 +000059 suite.addTest(BinderTestSuite.suite());
limpbizkit56400ca2008-05-23 19:20:08 +000060 suite.addTestSuite(BindingAnnotationTest.class);
limpbizkit42025a02007-11-20 21:52:31 +000061 suite.addTestSuite(BindingOrderTest.class);
crazybobleed0c4b8b2007-09-06 02:47:04 +000062 suite.addTestSuite(BindingTest.class);
limpbizkit56400ca2008-05-23 19:20:08 +000063 suite.addTestSuite(BoundInstanceInjectionTest.class);
crazyboblee589b57d2007-02-25 20:51:23 +000064 suite.addTestSuite(BoundProviderTest.class);
kevinb9n225310e2007-02-20 04:12:01 +000065 suite.addTestSuite(CircularDependencyTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +000066 // ErrorHandlingTest.class is not a testcase
limpbizkitf9e26582008-12-09 18:45:13 +000067 suite.addTestSuite(EagerSingletonTest.class);
kevinb9n225310e2007-02-20 04:12:01 +000068 suite.addTestSuite(GenericInjectionTest.class);
69 suite.addTestSuite(ImplicitBindingTest.class);
limpbizkitee792462009-04-08 23:48:49 +000070 suite.addTestSuite(TypeListenerTest.class);
limpbizkit56400ca2008-05-23 19:20:08 +000071 suite.addTestSuite(InjectorTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +000072 // IntegrationTest is AOP-only
kevinb9n225310e2007-02-20 04:12:01 +000073 suite.addTestSuite(KeyTest.class);
limpbizkit56400ca2008-05-23 19:20:08 +000074 suite.addTestSuite(LoggerInjectionTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +000075 // MethodInterceptionTest is AOP-only
limpbizkit97eac0f2009-03-28 18:25:35 +000076 suite.addTestSuite(MembersInjectorTest.class);
limpbizkit2d887302008-08-12 02:41:55 +000077 suite.addTestSuite(ModulesTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +000078 suite.addTestSuite(ModuleTest.class);
limpbizkit49c877e2007-11-20 23:33:36 +000079 suite.addTestSuite(NullableInjectionPointTest.class);
limpbizkit56400ca2008-05-23 19:20:08 +000080 suite.addTestSuite(OptionalBindingTest.class);
81 suite.addTestSuite(OverrideModuleTest.class);
82 suite.addTestSuite(ParentInjectorTest.class);
limpbizkitfcbdf992008-11-26 02:37:35 +000083 suite.addTestSuite(PrivateModuleTest.class);
crazybobleebd9544e2007-02-25 20:32:11 +000084 suite.addTestSuite(ProviderInjectionTest.class);
limpbizkitad94bcb2008-04-28 00:22:43 +000085 suite.addTestSuite(ProvisionExceptionTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +000086 // ProxyFactoryTest is AOP-only
crazybobleea6e73982007-02-02 00:21:07 +000087 suite.addTestSuite(ReflectionTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +000088 suite.addTestSuite(RequestInjectionTest.class);
crazybobleef33d23e2007-02-12 04:17:48 +000089 suite.addTestSuite(ScopesTest.class);
limpbizkit56400ca2008-05-23 19:20:08 +000090 suite.addTestSuite(SerializationTest.class);
kevinb9n225310e2007-02-20 04:12:01 +000091 suite.addTestSuite(SuperclassTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +000092 suite.addTestSuite(TypeConversionTest.class);
limpbizkitf9e26582008-12-09 18:45:13 +000093 suite.addTestSuite(TypeLiteralInjectionTest.class);
kevinb9n225310e2007-02-20 04:12:01 +000094 suite.addTestSuite(TypeLiteralTest.class);
limpbizkit4f5d1f72008-11-14 08:43:40 +000095 suite.addTestSuite(TypeLiteralTypeResolutionTest.class);
crazyboblee66b415a2006-08-25 02:01:19 +000096
limpbizkit56400ca2008-05-23 19:20:08 +000097 // internal
98 suite.addTestSuite(FinalizableReferenceQueueTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +000099 suite.addTestSuite(Jsr166HashMapTest.class);
limpbizkit56400ca2008-05-23 19:20:08 +0000100 suite.addTestSuite(LineNumbersTest.class);
crazyboblee210bf432009-02-05 06:04:18 +0000101 suite.addTest(MapMakerTestSuite.suite());
limpbizkit56400ca2008-05-23 19:20:08 +0000102 suite.addTestSuite(UniqueAnnotationsTest.class);
103
104 // matcher
105 suite.addTestSuite(MatcherTest.class);
106
limpbizkitf9e26582008-12-09 18:45:13 +0000107 // names
108 suite.addTestSuite(NamesTest.class);
limpbizkit3697a672009-02-28 02:43:04 +0000109
limpbizkit516e2ab2009-03-26 22:01:18 +0000110 // spi
111 suite.addTestSuite(BindingTargetVisitorTest.class);
112 suite.addTestSuite(ElementsTest.class);
limpbizkitaa07ab02009-05-15 07:10:43 +0000113 suite.addTestSuite(ElementApplyToTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +0000114 suite.addTestSuite(HasDependenciesTest.class);
115 suite.addTestSuite(InjectionPointTest.class);
116 suite.addTestSuite(ModuleRewriterTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +0000117 suite.addTestSuite(ProviderMethodsTest.class);
118 suite.addTestSuite(SpiBindingsTest.class);
119
limpbizkit56400ca2008-05-23 19:20:08 +0000120 // tools
121 // suite.addTestSuite(JmxTest.class); not a testcase
122
123 // util
limpbizkitaa07ab02009-05-15 07:10:43 +0000124 suite.addTestSuite(NoopOverrideTest.class);
limpbizkit56400ca2008-05-23 19:20:08 +0000125 suite.addTestSuite(ProvidersTest.class);
limpbizkit516e2ab2009-03-26 22:01:18 +0000126 suite.addTestSuite(TypesTest.class);
limpbizkit56400ca2008-05-23 19:20:08 +0000127
limpbizkitbf0d8762009-02-19 09:06:22 +0000128 /*if[AOP]*/
limpbizkit4f6274a2009-02-19 21:57:55 +0000129 suite.addTestSuite(ProxyFactoryTest.class);
limpbizkitbf0d8762009-02-19 09:06:22 +0000130 suite.addTestSuite(IntegrationTest.class);
131 suite.addTestSuite(MethodInterceptionTest.class);
limpbizkit4f6274a2009-02-19 21:57:55 +0000132 suite.addTestSuite(com.googlecode.guice.BytecodeGenTest.class);
limpbizkit3697a672009-02-28 02:43:04 +0000133 suite.addTest(com.googlecode.guice.StrictContainerTestSuite.suite());
limpbizkitbf0d8762009-02-19 09:06:22 +0000134 /*end[AOP]*/
135
limpbizkit9f17f4f2009-05-19 01:49:41 +0000136 return removeSuppressedTests(suite, SUPPRESSED_TEST_NAMES);
137 }
138
139 public static TestSuite removeSuppressedTests(TestSuite suite, Set<String> suppressedTestNames) {
140 TestSuite result = new TestSuite(suite.getName());
141
142 for(Enumeration e = suite.tests(); e.hasMoreElements(); ) {
143 Test test = (Test) e.nextElement();
144
145 if (suppressedTestNames.contains(test.toString())) {
146 continue;
147 } else if (test instanceof TestSuite) {
148 result.addTest(removeSuppressedTests((TestSuite) test, suppressedTestNames));
149 } else {
150 result.addTest(test);
151 }
152 }
153
154 return result;
crazyboblee66b415a2006-08-25 02:01:19 +0000155 }
156}