From 8d194951a1dc1281aa074c5170098ea0001c473c Mon Sep 17 00:00:00 2001 From: Brian Kayser Date: Sat, 27 Apr 2024 13:06:51 -0400 Subject: [PATCH] adding Apex test coverage --- .../LightningForgotPasswordControllerTest.cls | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/force-app/main/default/classes/LightningForgotPasswordControllerTest.cls b/force-app/main/default/classes/LightningForgotPasswordControllerTest.cls index ab49bb8..1dad773 100644 --- a/force-app/main/default/classes/LightningForgotPasswordControllerTest.cls +++ b/force-app/main/default/classes/LightningForgotPasswordControllerTest.cls @@ -22,4 +22,29 @@ public with sharing class LightningForgotPasswordControllerTest { LightningForgotPasswordController controller = new LightningForgotPasswordController(); System.assertNotEquals(controller, null); } -} \ No newline at end of file + + /* Verifies that null setExperienceId returns null. */ + @IsTest + static void testLightningForgotPasswordControllerSetExperienceIdAsNull() { + System.assertEquals(LightningForgotPasswordController.setExperienceId(null), null); + } + + /* Verifies setExperienceId Exception. */ + @IsTest + static void testLightningForgotPasswordControllerSetExperienceIdException() { + System.assertNotEquals(LightningForgotPasswordController.setExperienceId('testText'), null); + } +} +/* +@IsTest +static void testSetExperienceId_Exception() { + // Test when an exception is thrown + String expId = 'yourInvalidExperienceId'; + Test.startTest(); + String errorMessage = YourClassName.setExperienceId(expId); + Test.stopTest(); + + // Assert that an error message is returned + System.assertNotEquals(null, errorMessage, 'Expected error message to not be null'); +} +*/ \ No newline at end of file