Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/main/java/com/aventstack/extentreports/ExtentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public class ExtentTest implements IAddsMedia<ExtentTest>, RunResult, Serializab
*
* @return {@link ExtentTest} object
*/
public ExtentTest createNode(Class<? extends IGherkinFormatterModel> type, String name, String description) {
public synchronized ExtentTest createNode(Class<? extends IGherkinFormatterModel> type, String name, String description) {
if (name == null || name.isEmpty())
throw new IllegalArgumentException("nodeName cannot be null or empty");

Expand All @@ -160,7 +160,7 @@ public ExtentTest createNode(Class<? extends IGherkinFormatterModel> type, Strin
*
* @return {@link ExtentTest} object
*/
public ExtentTest createNode(String name, String description) {
public synchronized ExtentTest createNode(String name, String description) {
if (name == null || name.isEmpty())
throw new IllegalArgumentException("nodeName cannot be null or empty");

Expand Down Expand Up @@ -197,7 +197,7 @@ public ExtentTest createNode(String name, String description) {
*
* @return {@link ExtentTest} object
*/
public ExtentTest createNode(Class<? extends IGherkinFormatterModel> type, String name) {
public synchronized ExtentTest createNode(Class<? extends IGherkinFormatterModel> type, String name) {
return createNode(type, name, null);
}

Expand Down Expand Up @@ -229,7 +229,7 @@ public ExtentTest createNode(Class<? extends IGherkinFormatterModel> type, Strin
*
* @return {@link ExtentTest}
*/
public ExtentTest createNode(GherkinKeyword gherkinKeyword, String name, String description) {
public synchronized ExtentTest createNode(GherkinKeyword gherkinKeyword, String name, String description) {
Class<? extends IGherkinFormatterModel> clazz = gherkinKeyword.getKeyword().getClass();
return createNode(clazz, name, description);
}
Expand Down Expand Up @@ -260,7 +260,7 @@ public ExtentTest createNode(GherkinKeyword gherkinKeyword, String name, String
*
* @return {@link ExtentTest} object
*/
public ExtentTest createNode(GherkinKeyword gherkinKeyword, String name) {
public synchronized ExtentTest createNode(GherkinKeyword gherkinKeyword, String name) {
return createNode(gherkinKeyword, name, null);
}

Expand All @@ -271,7 +271,7 @@ public ExtentTest createNode(GherkinKeyword gherkinKeyword, String name) {
*
* @return {@link ExtentTest} object
*/
public ExtentTest createNode(String name) {
public synchronized ExtentTest createNode(String name) {
return createNode(name, null);
}

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/aventstack/extentreports/ReportObservable.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private synchronized void refreshStatusList(List<Test> list) {
*
* @param node a {@link Test} node
*/
void addNode(Test node) {
synchronized void addNode(Test node) {
reporterList.forEach(x -> x.onNodeStarted(node));
}

Expand All @@ -315,7 +315,7 @@ void addNode(Test node) {
* @param test {@link Test} to which the event is added
* @param log {@link Log}
*/
void addLog(Test test, Log log) {
synchronized void addLog(Test test, Log log) {
reporterList.forEach(x -> x.onLogAdded(test, log));
}

Expand All @@ -325,7 +325,7 @@ void addLog(Test test, Log log) {
* @param test {@link Test} to which the Category is added
* @param category {@link Category}
*/
void assignCategory(Test test, Category category) {
synchronized void assignCategory(Test test, Category category) {
reporterList.forEach(x -> x.onCategoryAssigned(test, category));
}

Expand All @@ -335,7 +335,7 @@ void assignCategory(Test test, Category category) {
* @param test {@link Test} to which the Author is added
* @param author {@link Author}
*/
void assignAuthor(Test test, Author author) {
synchronized void assignAuthor(Test test, Author author) {
reporterList.forEach(x -> x.onAuthorAssigned(test, author));
}

Expand All @@ -345,7 +345,7 @@ void assignAuthor(Test test, Author author) {
* @param test {@link Test} to which the Device is added
* @param device {@link Device}
*/
void assignDevice(Test test, Device device) {
synchronized void assignDevice(Test test, Device device) {
reporterList.forEach(x -> x.onDeviceAssigned(test, device));
}

Expand All @@ -357,7 +357,7 @@ void assignDevice(Test test, Device device) {
*
* @throws IOException thrown if the {@link ScreenCapture} is not found
*/
void addScreenCapture(Test test, ScreenCapture screenCapture) throws IOException {
synchronized void addScreenCapture(Test test, ScreenCapture screenCapture) throws IOException {
ScreenCaptureService.resolvePath(screenCapture, imagePathResolveDir);
for (ExtentReporter r : reporterList) {
r.onScreenCaptureAdded(test, screenCapture);
Expand All @@ -372,7 +372,7 @@ void addScreenCapture(Test test, ScreenCapture screenCapture) throws IOException
*
* @throws IOException thrown if the {@link ScreenCapture} is not found
*/
void addScreenCapture(Log log, ScreenCapture screenCapture) throws IOException {
synchronized void addScreenCapture(Log log, ScreenCapture screenCapture) throws IOException {
ScreenCaptureService.resolvePath(screenCapture, imagePathResolveDir);
for (ExtentReporter r : reporterList) {
r.onScreenCaptureAdded(log, screenCapture);
Expand All @@ -393,7 +393,7 @@ protected TestAttributeTestContextStore<Author> getAuthorContextInfo() {
*
* @param status a {@link Status}
*/
private void updateReportStatus(Status status) {
synchronized private void updateReportStatus(Status status) {
int statusIndex = Status.getStatusHierarchy().indexOf(status);
int reportStatusIndex = Status.getStatusHierarchy().indexOf(reportStatus);

Expand Down