File tree Expand file tree Collapse file tree 12 files changed +286
-1
lines changed
projects/surefire.combinedtests/bundle5.no.vintage.test
src/test/java/org/eclipse/tycho/test/surefire
tycho-metadata-model/src/main/java/org/eclipse/tycho/model/classpath Expand file tree Collapse file tree 12 files changed +286
-1
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <classpath >
3+ <classpathentry kind =" src" path =" src" />
4+ <classpathentry kind =" src" output =" test" path =" src_test" >
5+ <attributes >
6+ <attribute name =" test" value =" true" />
7+ </attributes >
8+ </classpathentry >
9+ <classpathentry kind =" src" path =" src2" />
10+ <classpathentry kind =" src" output =" test" path =" integration-tests" >
11+ <attributes >
12+ <attribute name =" test" value =" true" />
13+ </attributes >
14+ </classpathentry >
15+ <classpathentry kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11" >
16+ <attributes >
17+ <attribute name =" module" value =" true" />
18+ </attributes >
19+ </classpathentry >
20+ <classpathentry kind =" con" path =" org.eclipse.pde.core.requiredPlugins" />
21+ <classpathentry kind =" con" path =" org.eclipse.jdt.junit.JUNIT_CONTAINER/5" >
22+ <attributes >
23+ <attribute name =" vintage" value =" false" />
24+ </attributes >
25+ </classpathentry >
26+ <classpathentry kind =" output" path =" bin" />
27+ </classpath >
Original file line number Diff line number Diff line change 1+ Manifest-Version : 1.0
2+ Bundle-ManifestVersion : 2
3+ Bundle-Name : Test Plug-in
4+ Bundle-SymbolicName : bundle.test5
5+ Bundle-Version : 1.0.0
6+ Import-Package : javax.annotation,
7+ org.osgi.framework
8+ Automatic-Module-Name : bundle.test5
9+ Bundle-RequiredExecutionEnvironment : JavaSE-11
Original file line number Diff line number Diff line change 1+ source.. = src/,src2/
2+ output.. = bin/
3+ bin.includes = META-INF/,\
4+ .
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project >
3+ <modelVersion >4.0.0</modelVersion >
4+ <groupId >org.eclipse.tycho.tycho-its.surefire</groupId >
5+ <artifactId >bundle.test5</artifactId >
6+ <packaging >eclipse-plugin</packaging >
7+ <version >1.0.0</version >
8+ <properties >
9+ <target-platform >https:////download.eclipse.org/releases/2022-12/</target-platform >
10+ <tycho-version >4.0.0-SNAPSHOT</tycho-version >
11+ </properties >
12+ <repositories >
13+ <repository >
14+ <id >platform</id >
15+ <url >${target-platform} </url >
16+ <layout >p2</layout >
17+ </repository >
18+ </repositories >
19+ <build >
20+ <plugins >
21+ <plugin >
22+ <groupId >org.eclipse.tycho</groupId >
23+ <artifactId >tycho-maven-plugin</artifactId >
24+ <version >${tycho-version} </version >
25+ <extensions >true</extensions >
26+ </plugin >
27+ <plugin >
28+ <groupId >org.apache.maven.plugins</groupId >
29+ <artifactId >maven-surefire-plugin</artifactId >
30+ <version >3.0.0-M5</version >
31+ <dependencies >
32+ <dependency >
33+ <groupId >org.apache.maven.surefire</groupId >
34+ <artifactId >surefire-junit47</artifactId >
35+ <version >3.0.0-M5</version >
36+ </dependency >
37+ </dependencies >
38+ <executions >
39+ <execution >
40+ <id >execute-tests</id >
41+ <goals >
42+ <goal >test</goal >
43+ </goals >
44+ </execution >
45+ </executions >
46+ </plugin >
47+ </plugins >
48+ </build >
49+ </project >
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2021 Christoph Läubrich and others.
3+ * This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License 2.0
5+ * which accompanies this distribution, and is available at
6+ * https://www.eclipse.org/legal/epl-2.0/
7+ *
8+ * SPDX-License-Identifier: EPL-2.0
9+ *
10+ * Contributors:
11+ * Christoph Läubrich. - initial API and implementation
12+ *******************************************************************************/
13+ package bundle .test ;
14+
15+ public class CountDown {
16+
17+ RefMe refFromOtherSourceFolder ;
18+
19+ int count ;
20+
21+ public CountDown (int initalValue ) {
22+ count = initalValue ;
23+ }
24+
25+ public void decrement (int x ) {
26+ if (x < 0 ) {
27+ throw new IllegalArgumentException ();
28+ }
29+ if (count -x < 0 ) {
30+ throw new IllegalStateException ();
31+ }
32+ count -= x ;
33+ }
34+
35+ public int get () {
36+ return count ;
37+ }
38+ }
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2021 Christoph Läubrich and others.
3+ * This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License 2.0
5+ * which accompanies this distribution, and is available at
6+ * https://www.eclipse.org/legal/epl-2.0/
7+ *
8+ * SPDX-License-Identifier: EPL-2.0
9+ *
10+ * Contributors:
11+ * Christoph Läubrich. - initial API and implementation
12+ *******************************************************************************/
13+ package bundle .test ;
14+
15+ public class Counter {
16+
17+ int count ;
18+
19+ public void increment (int x ) {
20+ if (x < 0 ) {
21+ throw new IllegalArgumentException ();
22+ }
23+ count += x ;
24+ }
25+
26+ public int get () {
27+ return count ;
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2021 Christoph Läubrich and others.
3+ * This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License 2.0
5+ * which accompanies this distribution, and is available at
6+ * https://www.eclipse.org/legal/epl-2.0/
7+ *
8+ * SPDX-License-Identifier: EPL-2.0
9+ *
10+ * Contributors:
11+ * Christoph Läubrich. - initial API and implementation
12+ *******************************************************************************/
13+
14+ package bundle .test ;
15+
16+ public class RefMe extends Counter {
17+
18+ }
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2021 Christoph Läubrich and others.
3+ * This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License 2.0
5+ * which accompanies this distribution, and is available at
6+ * https://www.eclipse.org/legal/epl-2.0/
7+ *
8+ * SPDX-License-Identifier: EPL-2.0
9+ *
10+ * Contributors:
11+ * Christoph Läubrich. - initial API and implementation
12+ *******************************************************************************/
13+ package bundle .test ;
14+
15+ import static org .junit .Assert .assertEquals ;
16+ import static org .junit .jupiter .api .Assertions .assertThrows ;
17+
18+ public class AdderTest {
19+
20+ @ org .junit .jupiter .api .Test
21+ public void incrementTest () {
22+ Counter counter = new Counter ();
23+ counter .increment (1 );
24+ counter .increment (3 );
25+ assertEquals (4 , counter .get ());
26+ }
27+
28+ @ org .junit .jupiter .api .Test
29+ public void decrementTest () {
30+ assertThrows (IllegalArgumentException .class , ()->{
31+ Counter counter = new Counter ();
32+ counter .increment (-1 );
33+ });
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2021 Christoph Läubrich and others.
3+ * This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License 2.0
5+ * which accompanies this distribution, and is available at
6+ * https://www.eclipse.org/legal/epl-2.0/
7+ *
8+ * SPDX-License-Identifier: EPL-2.0
9+ *
10+ * Contributors:
11+ * Christoph Läubrich - initial API and implementation
12+ *******************************************************************************/
13+ package bundle .test ;
14+
15+ import static org .junit .Assert .assertEquals ;
16+
17+ import org .junit .Test ;
18+
19+ public class SubtractorTest {
20+
21+ @ Test
22+ public void incrementTest () {
23+ CountDown counter = new CountDown (10 );
24+ counter .decrement (1 );
25+ counter .decrement (3 );
26+ assertEquals (6 , counter .get ());
27+ }
28+
29+ @ Test (expected = IllegalArgumentException .class )
30+ public void decrementTest () {
31+ CountDown counter = new CountDown (10 );
32+ counter .decrement (-1 );
33+ }
34+
35+ @ Test (expected = IllegalStateException .class )
36+ public void decrementTest2 () {
37+ CountDown counter = new CountDown (1 );
38+ counter .decrement (5 );
39+ }
40+ }
Original file line number Diff line number Diff line change @@ -47,6 +47,15 @@ public void testCompile5() throws Exception {
4747 new File (verifier .getBasedir (), "target/test-classes/bundle/test/AdderTest.class" ).exists ());
4848 }
4949
50+ @ Test
51+ public void testCompile5WithoutVintage () throws Exception {
52+ Verifier verifier = getVerifier ("surefire.combinedtests/bundle5.no.vintage.test" );
53+ assertThrows ("Compilation must fail because the usage of junit 4 annotations" , VerificationException .class ,
54+ () -> verifier .executeGoals (Arrays .asList ("clean" , "test-compile" )));
55+ verifier .verifyTextInLog ("The import org.junit.Assert cannot be resolved" );
56+ verifier .verifyTextInLog ("The import org.junit.Test cannot be resolved" );
57+ }
58+
5059 @ Test
5160 public void testTest () throws Exception {
5261 Verifier verifier = getVerifier ("surefire.combinedtests/bundle.test" );
You can’t perform that action at this time.
0 commit comments