-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
src/main/java/org/testng/internal/ant/AntReporterConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.testng.internal.ant; | ||
|
||
import org.testng.collections.Lists; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Used with the <reporter> sub-element of the Ant task | ||
* | ||
* <p>NOTE: this class needs to be public. It's used by TestNG Ant task | ||
*/ | ||
public class AntReporterConfig { | ||
|
||
/** The class name of the reporter listener */ | ||
protected String className; | ||
|
||
/** The properties of the reporter listener */ | ||
private final List<Property> properties = Lists.newArrayList(); | ||
|
||
public void addProperty(Property property) { | ||
properties.add(property); | ||
} | ||
|
||
public void setClassName(String className) { | ||
this.className = className; | ||
} | ||
|
||
public String serialize() { | ||
List<org.testng.internal.ReporterConfig.Property> properties = | ||
this.properties.stream() | ||
.map( | ||
property -> | ||
new org.testng.internal.ReporterConfig.Property(property.name, property.value)) | ||
.collect(Collectors.toList()); | ||
return (new org.testng.internal.ReporterConfig(className, properties)).serialize(); | ||
} | ||
|
||
public static class Property { | ||
private String name; | ||
private String value; | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
} | ||
} |