Skip to content

Two identical integration tests. #2728

Description

@ancavar

To Reproduce
Generate integration tests for controller's method which has @PreAuthorize, e.g.

@GetMapping("/demo")
@PreAuthorize("hasAuthority('write')")
publicStringdemo() {
return"demo";
}

Expected behavior

Only one such test is expected.

Actual behavior

@Test@DisplayName("demo: ")
publicvoidtestDemo() throwsException {
Object[] uriVariables = {};
MockHttpServletRequestBuildermockHttpServletRequestBuilder = get("/demo", uriVariables);
ResultActionsactual = mockMvc.perform(mockHttpServletRequestBuilder);
actual.andDo(print());
actual.andExpect((status()).is(403));
actual.andExpect((content()).string(""));
}
/** * @utbot.classUnderTest {@link NameController} * @utbot.methodUnderTest {@link NameController#demo()} */@Test@DisplayName("demo: ")
publicvoidtestDemo1() throwsException {
Object[] uriVariables = {};
MockHttpServletRequestBuildermockHttpServletRequestBuilder = get("/demo", uriVariables);
ResultActionsactual = mockMvc.perform(mockHttpServletRequestBuilder);
actual.andDo(print());
actual.andExpect((status()).is(403));
actual.andExpect((content()).string(""));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ctg-bugIssue is a bug

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions