You need to sign in to do that
Don't have an account?
Mike 317
Testing APEX that sorts a list
Hey All,
I am working with a 3rd party and they have a VFP with a list that has sortable columns. The test class has test methods without system asserts. On the one hard, this makes sense because what would you actually assert? But on the other hand, this simply calls the method. It doesn't actually validate anything. Code snipet is below.
Is this ok? My gut wants a system assert that checks the results against what is expected. But i'm not sure if i'm just asking for too much. Thanks.
-Mike
I am working with a 3rd party and they have a VFP with a list that has sortable columns. The test class has test methods without system asserts. On the one hard, this makes sense because what would you actually assert? But on the other hand, this simply calls the method. It doesn't actually validate anything. Code snipet is below.
@isTest static void test_SortByAccount() { RecordReturnsCtrl ctrl = new RecordReturnsCtrl(); ctrl.columnName = 'Account'; ctrl.ascendingSort = false; ctrl.sortRecords(); }
Is this ok? My gut wants a system assert that checks the results against what is expected. But i'm not sure if i'm just asking for too much. Thanks.
-Mike
You can add two or three dummy values in the list which you want to sort. Then call sortRecords() method and use assert to check if this function returns the sorted list or not.Thanks