Skip to content

Commit

Permalink
Added NPE on null status in setTestCaseStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
edovnar committed Feb 25, 2025
1 parent b1b4214 commit 9ee9324
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static void setTestCaseKey(String testCaseKey) {
*
* @param testCaseKey key of the test case
* @param resultStatus name of the status to be set for the test case
* @see SystemTestCaseStatus
* @throws NullPointerException if {@code resultStatus} is null
* @see SystemTestCaseStatus
*/
public static void setTestCaseStatus(String testCaseKey, String resultStatus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -67,6 +68,8 @@ void addTestCasesToCurrentTest(TcmType tcmType, Collection<String> testCaseIds)
}

void setCurrentTestTestCaseStatus(TcmType tcmType, String testCaseId, String status) {
Objects.requireNonNull(status, "Status cannot be null.");

RunContext.getCurrentTest()
.map(TestDescriptor::getZebrunnerId)
.ifPresent(testId -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public static void setTestCaseId(String testCaseId) {
*
* @param testCaseId TestRail id of the test case. Can be either a regular number or a number with the letter 'C' at the begging.
* @param resultStatus system name (not labels!) of the status to be set for the test case
* @throws NullPointerException if {@code resultStatus} is null
* @see SystemTestCaseStatus
*/
public static void setTestCaseStatus(String testCaseId, String resultStatus) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/zebrunner/agent/core/registrar/Xray.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static void setTestKey(String testKey) {
*
* @param testKey key of the Xray test
* @param resultStatus name of the status to be set for the test
* @throws NullPointerException if {@code resultStatus} is null
* @see SystemTestStatus.Cloud
* @see SystemTestStatus.Server
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static void setTestCaseKey(String testCaseKey) {
*
* @param testCaseKey key of the Zephyr test case
* @param resultStatus name of the status to be set for the test case
* @throws NullPointerException if {@code resultStatus} is null
* @see Scale.SystemTestCaseStatus.Cloud
* @see Squad.SystemTestCaseStatus.Cloud
*/
Expand Down

0 comments on commit 9ee9324

Please sign in to comment.