UnitTestBot / UTBotJava

Automated unit test generation and precise code analysis for Java
Apache License 2.0
133 stars 38 forks source link

Weird integration test for `@PostMapping` with Spring Security #2729

Open ancavar opened 6 months ago

ancavar commented 6 months ago

To Reproduce

  1. Add Spring Security.
  2. Generate integration test for @PostMapping, e.g.
    @PostMapping("/demo")
    public String demo() {
        return "demo";
    }

    Expected behavior

Probably shouldn't have this test.

Actual behavior

    ///region FUZZER: SUCCESSFUL EXECUTIONS for method demo()

    /**
     * @utbot.classUnderTest {@link NameController}
     * @utbot.methodUnderTest {@link NameController#demo()}
     */
    @Test
    @DisplayName("demo: ")
    public void testDemo() {
        String actual = nameController.demo();

        String expected = "demo";

        assertEquals(expected, actual);
    }