Test Isjson in MXUnit

coldfusion, json, mxunit, testcase, testing

Solution

According to the MXUnit built-in assertions page there is not a function. Your best bet is to test the function the way you are or by using the `assertTrue()` function

assertTrue(isJSON(userEventItems), 'The return must be json');

Problem

I am working on the MxUnit test frame work for CFML. In it, I want to check whether the return value of a function is a valid JSON or not. Currently I am using: ``` assertEquals(True,IsJSON(userEventItems),'The return must be json'); ``` Is there any MXUnit function to check the assert is a JSON or not, like `assertIsQuery()` in MXUnit?

Original source