Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 354427
Collapse All | Expand All

(-)src/org/eclipse/e4/core/internal/tests/contexts/inject/Bug354427Test.java (+68 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.e4.core.internal.tests.contexts.inject;
13
14
import javax.annotation.PostConstruct;
15
import javax.annotation.PreDestroy;
16
17
import junit.framework.TestCase;
18
19
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
20
import org.eclipse.e4.core.contexts.EclipseContextFactory;
21
import org.eclipse.e4.core.contexts.IEclipseContext;
22
23
public class Bug354427Test extends TestCase {
24
25
	public static class SuperInject {
26
		
27
		boolean pcCalled = false;
28
		boolean pdCalled = false;
29
		
30
		@PostConstruct
31
		void pc() {
32
			pcCalled = true;
33
		}
34
		
35
		@PreDestroy
36
		void pd() {
37
			pdCalled = true;
38
		}
39
	}
40
	
41
	public static class SubInject extends SuperInject {
42
		
43
		@Override
44
		void pc() {
45
			super.pc();
46
		}
47
		
48
		@Override
49
		void pd() {
50
			super.pd();
51
		}
52
	}
53
54
	public void testUnannotatedOverrides() throws Exception {
55
		IEclipseContext context = EclipseContextFactory.create();
56
57
		SubInject subInject = ContextInjectionFactory.make(SubInject.class, context);
58
59
		assertTrue(subInject.pcCalled);
60
		assertFalse(subInject.pdCalled);
61
		
62
		context.dispose();
63
		
64
		assertTrue(subInject.pcCalled);
65
		assertFalse(subInject.pdCalled);
66
	}
67
68
}
(-)src/org/eclipse/e4/core/tests/CoreTestSuite.java (+2 lines)
Lines 24-29 Link Here
24
import org.eclipse.e4.core.internal.tests.contexts.inject.AnnotationsInjectionTest;
24
import org.eclipse.e4.core.internal.tests.contexts.inject.AnnotationsInjectionTest;
25
import org.eclipse.e4.core.internal.tests.contexts.inject.Bug304585Test;
25
import org.eclipse.e4.core.internal.tests.contexts.inject.Bug304585Test;
26
import org.eclipse.e4.core.internal.tests.contexts.inject.Bug317183Test;
26
import org.eclipse.e4.core.internal.tests.contexts.inject.Bug317183Test;
27
import org.eclipse.e4.core.internal.tests.contexts.inject.Bug354427Test;
27
import org.eclipse.e4.core.internal.tests.contexts.inject.ComplexDisposalTest;
28
import org.eclipse.e4.core.internal.tests.contexts.inject.ComplexDisposalTest;
28
import org.eclipse.e4.core.internal.tests.contexts.inject.ContextFunctionDynamicsTest;
29
import org.eclipse.e4.core.internal.tests.contexts.inject.ContextFunctionDynamicsTest;
29
import org.eclipse.e4.core.internal.tests.contexts.inject.ContextInjectionDisposeTest;
30
import org.eclipse.e4.core.internal.tests.contexts.inject.ContextInjectionDisposeTest;
Lines 102-106 Link Here
102
		addTestSuite(ActivationInjectionTest.class);
103
		addTestSuite(ActivationInjectionTest.class);
103
		addTestSuite(GenericsInjectionTest.class);
104
		addTestSuite(GenericsInjectionTest.class);
104
		addTestSuite(RecursiveObjectCreationTest.class);
105
		addTestSuite(RecursiveObjectCreationTest.class);
106
		addTestSuite(Bug354427Test.class);
105
	}
107
	}
106
}
108
}

Return to bug 354427