function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
developer srideveloper sri 

Test class for Enum class

Hi.. Can someone suggest me writing test class for below enum class


my Enum class is :


public enum ProductType {   






Thank you




Below is the format to write test class for enum class.


Test Class:

public class TestProductType {
    ProductType obj = ProductType.Primary;



Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
My Blog:-

developer srideveloper sri

Thanks for quick reply Hithesh!!!


I tried with your code and it got saved succesfully and method passed successfully.


And when I am seeing the code coverage for the enum class, it is showing 0%. I don't know why!!!!


Can you please suggest me the solution.



Thank you!!!!!!!!!