Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Option to assert the exception message in generated tests #103

Open
vmassol opened this issue Oct 10, 2019 · 0 comments
Open

Option to assert the exception message in generated tests #103

vmassol opened this issue Oct 10, 2019 · 0 comments

Comments

@vmassol
Copy link
Contributor

vmassol commented Oct 10, 2019

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?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant