Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 2467 #2468

Merged
merged 3 commits into from Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.txt
@@ -1,4 +1,5 @@
Current
Fixed: GITHUB-2467: XmlTest does not copy the xmlClasses during clone (C.V.Aditya)
Fixed: GITHUB-2296: Fix for assertEquals not working for sets as order is not guaranteed. (Prashant Maroti)
Fixed: GITHUB-2465: Fix bux where Strings.join returns empty String
Fixed: GITHUB-1632: throwing SkipException sets iTestResult status to Failure instead of Skip (Julien Herr & Krishnan Mahadevan)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/testng/xml/XmlTest.java
Expand Up @@ -429,6 +429,7 @@ public Object clone() {
result.setParameters(getLocalParameters());
result.setXmlPackages(getXmlPackages());
result.setTimeOut(getTimeOut());
result.setXmlClasses(getXmlClasses());

Map<String, List<String>> metagroups = getMetaGroups();
for (Map.Entry<String, List<String>> group : metagroups.entrySet()) {
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/org/testng/xml/XmlTestTest.java
Expand Up @@ -5,6 +5,7 @@
import org.testng.annotations.Test;
import org.testng.collections.Maps;
import test.SimpleBaseTest;
import test.junitreports.SimpleTestSample;

import java.util.Collections;
import java.util.Map;
Expand Down Expand Up @@ -33,6 +34,17 @@ public Object[][] getData() {
return new Object[][] {{newSetOfParameters(null, "value")}, {newSetOfParameters("foo", null)}};
}

@Test(description = "GITHUB-2467")
public void testXMLClassesInCloneMethod() {
XmlSuite xmlSuite = createXmlSuite("suite");
XmlTest xmlTest = createXmlTest(xmlSuite, "test");
createXmlClass(xmlTest, SimpleTestSample.class);
XmlTest copyXmlTest = (XmlTest) xmlTest.clone();
Assert.assertNotNull(copyXmlTest);
Assert.assertNotNull(copyXmlTest.getXmlClasses());
Assert.assertEquals(xmlTest.getXmlClasses().size(), copyXmlTest.getXmlClasses().size());
}

private static Map<String, String> newSetOfParameters(String key, String value) {
Map<String, String> map = Maps.newHashMap();
map.put(key, value);
Expand Down