io.qase.commons.Methods Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qase-java-commons Show documentation
Show all versions of qase-java-commons Show documentation
Qase TMS Reporter's common classes
The newest version!
package io.qase.commons;
import io.qase.commons.models.domain.Attachment;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Methods {
public static void addComment(String message) {
if (!CasesStorage.isCaseInProgress()) {
return;
}
CasesStorage.getCurrentCase().message = message;
}
public static void addAttachments(String... attachments) {
List attachmentList = Arrays.stream(attachments)
.map(path -> {
Attachment attachment = new Attachment();
attachment.filePath = path;
return attachment;
})
.collect(Collectors.toList());
if (StepStorage.isStepInProgress()) {
StepStorage.getCurrentStep().attachments.addAll(attachmentList);
} else {
CasesStorage.getCurrentCase().attachments.addAll(attachmentList);
}
}
public static void addAttachment(String fileName, String content, String contentType) {
Attachment attachment = new Attachment();
attachment.fileName = fileName;
attachment.content = content;
attachment.mimeType = contentType;
if (StepStorage.isStepInProgress()) {
StepStorage.getCurrentStep().attachments.add(attachment);
} else {
CasesStorage.getCurrentCase().attachments.add(attachment);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy