botsing icon indicating copy to clipboard operation
botsing copied to clipboard

Option to assert the exception message in generated tests

Open vmassol opened this issue 6 years ago • 0 comments

Example of generated test:

    @Test(timeout = 4000)
    public void test00() throws Throwable
    {
        Document document0 = XMLUtils.createDOMDocument();
        // Undeclared exception!
        try {
            XMLUtils.extractXML(document0, (-1164), (-1164));
            fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
            //
            // Failed to extract XML
            //
        }
    }

It would be nice to assert the exception message in the catch, as in:

        } catch (RuntimeException e) {
            //
            // Failed to extract XML
            //
            assertEquals("Failed to extract XML", e.getMessage());
        }

I noticed that you put the message in comment so you must have considered it would be a problem to add the assertion. Maybe make it optional at least?

vmassol avatar Oct 10 '19 14:10 vmassol