Skip to content

No assert in test for method which returns Exception object #1870

New issue

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

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

Already on GitHub? Sign in to your account

Open
tyuldashev opened this issue Feb 28, 2023 · 0 comments
Open

No assert in test for method which returns Exception object #1870

tyuldashev opened this issue Feb 28, 2023 · 0 comments
Assignees
Labels
comp-codegen Issue is related to code generator ctg-bug Issue is a bug lang-java Issue is related to Java support

Comments

@tyuldashev
Copy link
Collaborator

Description

Some tests don't contain any assertions, even though we could try to compare returned Exception object.

To Reproduce

Steps to reproduce the behavior:

  1. Use UTBot Java project to reproduce.
  2. Invoke test generation for org.utbot.examples.exceptions.ExceptionExamples#createException method
  3. Open the generated test

Expected behavior

Tests are supposed to have assertions.

Actual behavior

Generated test has no assertion.

Visual proofs (screenshots, logs, images)

    @Test
    @DisplayName("createException: StringBuilderAppend -> return new IllegalArgumentException(\"Here we are: \" + Math.sqrt(10))")
    public void testCreateException_StringBuilderToString() throws Exception {
        ExceptionExamples exceptionExamples = new ExceptionExamples();

        IllegalArgumentException actual = exceptionExamples.createException();

        IllegalArgumentException expected = ((IllegalArgumentException) createInstance("java.lang.IllegalArgumentException"));
    }

Additional context

IllegalArgumentException in user code has a message, so it least we could compare that text with generated one.

@tyuldashev tyuldashev added ctg-bug Issue is a bug comp-codegen Issue is related to code generator labels Feb 28, 2023
@alisevych alisevych added the lang-java Issue is related to Java support label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-codegen Issue is related to code generator ctg-bug Issue is a bug lang-java Issue is related to Java support
Projects
Status: Todo
Development

No branches or pull requests

3 participants