Skip to content

Commit bbdcf90

Browse files
committed
Add IT
1 parent 786b016 commit bbdcf90

File tree

6 files changed

+224
-0
lines changed

6 files changed

+224
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.maven.surefire.its.jiras;
20+
21+
import org.apache.maven.surefire.its.fixture.OutputValidator;
22+
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
23+
import org.apache.maven.surefire.its.fixture.TestFile;
24+
import org.junit.Test;
25+
26+
/**
27+
* Test for SUREFIRE-1360. Enabling and disabling properties element in plugin configuration.
28+
*/
29+
public class Surefire1360PropertiesElementIT extends SurefireJUnit4IntegrationTestCase {
30+
31+
@Test
32+
public void testPropertiesElementDisabled() {
33+
final OutputValidator outputValidator = unpack("/surefire-1360-disable-properties-element")
34+
.maven()
35+
.withFailure()
36+
.executeTest();
37+
final TestFile reportFile =
38+
outputValidator.getSurefireReportsXmlFile("TEST-disablePropertiesElement.TestPropertiesElement.xml");
39+
40+
reportFile.assertContainsText("<properties>");
41+
reportFile.assertContainsText("</properties>");
42+
43+
final TestFile reportFile2 =
44+
outputValidator.getSurefireReportsXmlFile("TEST-disablePropertiesElement.TestPropertiesElement2.xml");
45+
46+
reportFile2.assertNotContainsText("<properties>");
47+
reportFile2.assertNotContainsText("</properties>");
48+
}
49+
50+
@Test
51+
public void testPropertiesElementEnabled() {
52+
final OutputValidator outputValidator =
53+
unpack("/surefire-1360-enable-properties-element").executeTest();
54+
final TestFile reportFile =
55+
outputValidator.getSurefireReportsXmlFile("TEST-enablePropertiesElement.TestPropertiesElement.xml");
56+
57+
reportFile.assertContainsText("<properties>");
58+
reportFile.assertContainsText("</properties>");
59+
}
60+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
21+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<parent>
26+
<groupId>org.apache.maven.surefire</groupId>
27+
<artifactId>it-parent</artifactId>
28+
<version>1.0</version>
29+
<relativePath>../pom.xml</relativePath>
30+
</parent>
31+
32+
<groupId>org.apache.maven.plugins.surefire</groupId>
33+
<artifactId>surefire-1960-disable-properties-element</artifactId>
34+
<version>1.0</version>
35+
<url>http://maven.apache.org</url>
36+
37+
<dependencies>
38+
<dependency>
39+
<groupId>junit</groupId>
40+
<artifactId>junit</artifactId>
41+
<version>4.0</version>
42+
</dependency>
43+
</dependencies>
44+
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-surefire-plugin</artifactId>
50+
<version>${surefire.version}</version>
51+
<configuration>
52+
<enablePropertiesElement>false</enablePropertiesElement>
53+
</configuration>
54+
</plugin>
55+
</plugins>
56+
</build>
57+
58+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package disablePropertiesElement;
2+
3+
import org.junit.Test;
4+
5+
public class TestPropertiesElement {
6+
7+
@Test
8+
public void success() {
9+
System.out.println("This is successful.");
10+
}
11+
12+
@Test
13+
public void failure() throws Exception {
14+
System.out.println("This is faulty.");
15+
throw new Exception("Expected to fail");
16+
}
17+
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package disablePropertiesElement;
2+
3+
import org.junit.Test;
4+
5+
public class TestPropertiesElement2 {
6+
7+
@Test
8+
public void success() {
9+
System.out.println("This is successful.");
10+
}
11+
12+
@Test
13+
public void success2() {
14+
System.out.println("This is successful, too.");
15+
}
16+
17+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
21+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<parent>
26+
<groupId>org.apache.maven.surefire</groupId>
27+
<artifactId>it-parent</artifactId>
28+
<version>1.0</version>
29+
<relativePath>../pom.xml</relativePath>
30+
</parent>
31+
32+
<groupId>org.apache.maven.plugins.surefire</groupId>
33+
<artifactId>surefire-1360-enable-properties-element</artifactId>
34+
<version>1.0</version>
35+
<url>http://maven.apache.org</url>
36+
37+
<dependencies>
38+
<dependency>
39+
<groupId>junit</groupId>
40+
<artifactId>junit</artifactId>
41+
<version>4.0</version>
42+
</dependency>
43+
</dependencies>
44+
45+
<build>
46+
<plugins>
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-surefire-plugin</artifactId>
50+
<version>${surefire.version}</version>
51+
<configuration>
52+
<!-- Default value, but setting it explicitly for test -->
53+
<enablePropertiesElement>true</enablePropertiesElement>
54+
</configuration>
55+
</plugin>
56+
</plugins>
57+
</build>
58+
59+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package enablePropertiesElement;
2+
3+
import org.junit.Test;
4+
5+
public class TestPropertiesElement {
6+
7+
@Test
8+
public void success() {
9+
System.out.println("This is successful.");
10+
}
11+
12+
}

0 commit comments

Comments
 (0)