I want to pass the test case assertEquals with String 'success'. But the value getting from the query like {success}. How do I convert 'success' to {success}

System.assertEquals('success'', myMap.keySet());

in myMap, the key is 'success' But when I use it to myMap.KeySet(), it is returning {success}.


keySet() returns the Set which is represented by {...} in debug (same with list also). You should rather check if success exists in set:


You would want to compare the set to another set:

  new Set<String>{'success'}, 
  'Expected the set to contain one value called success'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.