diff --git a/src/main/java/io/github/lambdatest/gradle/LambdaTestTask.java b/src/main/java/io/github/lambdatest/gradle/LambdaTestTask.java index 8c23636..897bd85 100644 --- a/src/main/java/io/github/lambdatest/gradle/LambdaTestTask.java +++ b/src/main/java/io/github/lambdatest/gradle/LambdaTestTask.java @@ -157,18 +157,30 @@ public void runLambdaTest() { // setter methods for the properties public void setUsername(String username) { + if (username == null || username.trim().isEmpty()) { + throw new IllegalArgumentException("Username cannot be null or empty"); + } this.username = username; } public void setAccessKey(String accessKey) { + if (accessKey == null || accessKey.trim().isEmpty()) { + throw new IllegalArgumentException("Access key cannot be null or empty"); + } this.accessKey = accessKey; } public void setAppFilePath(String appFilePath) { + if (appFilePath != null && appFilePath.trim().isEmpty()) { + throw new IllegalArgumentException("App file path cannot be empty"); + } this.appFilePath = appFilePath; } public void setTestSuiteFilePath(String testSuiteFilePath) { + if (testSuiteFilePath != null && testSuiteFilePath.trim().isEmpty()) { + throw new IllegalArgumentException("Test suite file path cannot be empty"); + } this.testSuiteFilePath = testSuiteFilePath; } diff --git a/src/main/java/io/github/lambdatest/gradle/LambdaUploaderTask.java b/src/main/java/io/github/lambdatest/gradle/LambdaUploaderTask.java index 927b779..3bb02f0 100644 --- a/src/main/java/io/github/lambdatest/gradle/LambdaUploaderTask.java +++ b/src/main/java/io/github/lambdatest/gradle/LambdaUploaderTask.java @@ -104,18 +104,30 @@ public void uploadApkToLambdaTest() { // Setter functions for the task public void setUsername(String username) { + if (username == null || username.trim().isEmpty()) { + throw new IllegalArgumentException("Username cannot be null or empty"); + } this.username = username; } public void setAccessKey(String accessKey) { + if (accessKey == null || accessKey.trim().isEmpty()) { + throw new IllegalArgumentException("Access key cannot be null or empty"); + } this.accessKey = accessKey; } public void setAppFilePath(String appFilePath) { + if (appFilePath != null && appFilePath.trim().isEmpty()) { + throw new IllegalArgumentException("App file path cannot be empty"); + } this.appFilePath = appFilePath; } public void setTestSuiteFilePath(String testSuiteFilePath) { + if (testSuiteFilePath != null && testSuiteFilePath.trim().isEmpty()) { + throw new IllegalArgumentException("Test suite file path cannot be empty"); + } this.testSuiteFilePath = testSuiteFilePath; }